This class provides information about Qore constants defined in Qore namespaces.
More...
|
static list< Constant > | findAllRegex (string pattern, *int re_opts) |
| Returns a list of constants matching the regular expression pattern argument or an empty list if no namespace constants match. More...
|
|
static list< Constant > | findAllRegex (Program pgm, string pattern, *int re_opts) |
| Returns a list of constants matching the regular expression pattern argument or an empty list if no namespace constants match. More...
|
|
static Constant | forName (string path) |
| Returns a Constant object from the constant name or namespace-justified path as a string. More...
|
|
static Constant | forName (Program pgm, string path) |
| Returns a Constant object from the constant name or namespace-justified path as a string. More...
|
|
This class provides information about Qore constants defined in Qore namespaces.
- Restrictions:
- Qore::PO_NO_REFLECTION
- See also
- ClassConstant
- Since
- Qore 0.9.0
◆ constructor()
Qore::Reflection::Constant::constructor |
( |
string |
path | ) |
|
Creates the object from the constant name or namespace-justified path as a string.
- Example:
- Parameters
-
path | the constant name or namespace-justified path as a string |
- Exceptions
-
UNKNOWN-CONSTANT | cannot find a constant with the given name or path |
ENCODING-CONVERSION-ERROR | this exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion |
- Note
- searches namespace constants only; does not search class constants
- See also
- forName()
◆ findAllRegex() [1/2]
static list<Constant> Qore::Reflection::Constant::findAllRegex |
( |
Program |
pgm, |
|
|
string |
pattern, |
|
|
*int |
re_opts |
|
) |
| |
|
static |
Returns a list of constants matching the regular expression pattern argument or an empty list if no namespace constants match.
- Code Flags:
- RET_VALUE_ONLY
- Example:
list<Constant> l = Constant::findAllRegex(pgm, "^T");
- Parameters
-
pgm | the Program object to search |
pattern | the regular expression pattern to match |
re_opts | see regex_constants for possible values |
- Returns
- a list of constants matching the regular expression pattern argument or an empty list if no constants match
- Note
- searches namespace constants only; does not search class constants
◆ findAllRegex() [2/2]
static list<Constant> Qore::Reflection::Constant::findAllRegex |
( |
string |
pattern, |
|
|
*int |
re_opts |
|
) |
| |
|
static |
Returns a list of constants matching the regular expression pattern argument or an empty list if no namespace constants match.
- Code Flags:
- RET_VALUE_ONLY
- Example:
list<Constant> l = Constant::findAllRegex("^T");
- Parameters
-
pattern | the regular expression pattern to match |
re_opts | see regex_constants for possible values |
- Returns
- a list of constants matching the regular expression pattern argument or an empty list if no constants match
- Note
- searches namespace constants only; does not search class constants
◆ forName() [1/2]
static Constant Qore::Reflection::Constant::forName |
( |
Program |
pgm, |
|
|
string |
path |
|
) |
| |
|
static |
Returns a Constant object from the constant name or namespace-justified path as a string.
- Code Flags:
- RET_VALUE_ONLY
- Example:
Constant con = Constant::forName(pgm, "Option::HAVE_FORK");
- Parameters
-
pgm | the Program object to search |
path | the constant name or namespace-justified path as a string |
- Returns
- a constant object corresponding to the name or namespace-justified path provided as an argument
- Exceptions
-
UNKNOWN-CONSTANT | cannot find a constant with the given name or path |
ENCODING-CONVERSION-ERROR | this exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion |
- Note
- searches namespace constants only; does not search class constants
◆ forName() [2/2]
static Constant Qore::Reflection::Constant::forName |
( |
string |
path | ) |
|
|
static |
Returns a Constant object from the constant name or namespace-justified path as a string.
- Code Flags:
- RET_VALUE_ONLY
- Example:
Constant con = Constant::forName("Option::HAVE_FORK");
- Parameters
-
path | the constant name or namespace-justified path as a string |
- Returns
- a constant object corresponding to the name or namespace-justified path provided as an argument
- Exceptions
-
UNKNOWN-CONSTANT | cannot find a constant with the given name or path |
ENCODING-CONVERSION-ERROR | this exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion |
- Note
- searches namespace constants only; does not search class constants
◆ getNamespace()
Namespace Qore::Reflection::Constant::getNamespace |
( |
| ) |
|
Returns the namespace for the constant.
- Code Flags:
- CONSTANT
- Example:
Namespace ns = con.getNamespace();
- Returns
- the namespace for the constant
The documentation for this class was generated from the following file: