This class provides information about Qore constants defined in Qore namespaces.
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]
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
-
- 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]
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
-
- 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]
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
◆ forName() [2/2]
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
◆ 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:
- /export/home/dnichols/src/qore/git/qore/build/modules/reflection/QC_Constant.dox.h