The abstract base class for Qore global variables.
More...
The abstract base class for Qore global variables.
- Restrictions:
- Qore::PO_NO_REFLECTION
- Since
- Qore 0.9.0
◆ constructor()
Qore::Reflection::GlobalVar::constructor |
( |
string |
path | ) |
|
Creates the object from the global variable name or namespace-justified path as a string.
- Example:
- Parameters
-
path | the global variable name or namespace-justified path as a string |
- Exceptions
-
UNKNOWN-GLOBAL-VAR | cannot find a global variable 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 |
- See also
- forName()
◆ findAllRegex() [1/2]
Returns a list of global variables matching the regular expression pattern argument or an empty list if no global variables match.
- Code Flags:
- RET_VALUE_ONLY
- Example:
list<GlobalVar> l = GlobalVar::findAllRegex("^E");
- Parameters
-
- Returns
- a list of global variables matching the regular expression pattern argument or an empty list if no global variables match
◆ findAllRegex() [2/2]
Returns a list of global variables matching the regular expression pattern argument or an empty list if no global variables match.
- Code Flags:
- RET_VALUE_ONLY
- Example:
list<GlobalVar> l = GlobalVar::findAllRegex(pgm, "^E");
- Parameters
-
- Returns
- a list of global variables matching the regular expression pattern argument or an empty list if no global variables match
◆ forName() [1/2]
Returns a global variable object corresponding to the name or namespace-justified path provided as an argument.
- Code Flags:
- RET_VALUE_ONLY
- Example:
GlobalVar var = GlobalVar::forName("::ENV");
- Parameters
-
path | the global variable name or namespace-justified path as a string |
- Returns
- a global variable object corresponding to the name or namespace-justified path provided as an argument
- Exceptions
-
UNKNOWN-GLOBAL-VAR | cannot find a global variable with the given name or path |
ENCODING-CONVERSION-ERROR | this exception could be thrown if the string argument is not in the default characterencoding" and an error occurs during encoding conversion |
◆ forName() [2/2]
Returns a global variable object corresponding to the name or namespace-justified path provided as an argument.
- Code Flags:
- RET_VALUE_ONLY
- Example:
GlobalVar var = GlobalVar::forName(pgm, "::ENV");
- Parameters
-
pgm | the Program object to search |
path | the global variable name or namespace-justified path as a string |
- Returns
- a global variable object corresponding to the name or namespace-justified path provided as an argument
- Exceptions
-
UNKNOWN-GLOBAL-VAR | cannot find a global variable with the given name or path |
ENCODING-CONVERSION-ERROR | this exception could be thrown if the string argument is not in the default characterencoding" and an error occurs during encoding conversion |
◆ getName()
string Qore::Reflection::GlobalVar::getName |
( |
| ) |
|
returns the global variable name
- Code Flags:
- RET_VALUE_ONLY
- Example:
string name = var.getName();
- Returns
- the global variable name
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the global variable has been destroyed |
◆ getNamespace()
Namespace Qore::Reflection::GlobalVar::getNamespace |
( |
| ) |
|
Returns the namespace for the global variable.
- Code Flags:
- CONSTANT
- Example:
Namespace ns = var.getNamespace();
- Returns
- the namespace for the global variable
◆ getSourceLocation()
Returns the source location of the global variable declaration.
- Code Flags:
- RET_VALUE_ONLY
- Example:
hash<SourceLocationInfo> loc = var.getSourceLocation();
- Returns
- the source location of the global variable declaration
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the global variable has been destroyed |
◆ getType()
Type Qore::Reflection::GlobalVar::getType |
( |
| ) |
|
Returns the type object for this global variable.
- Code Flags:
- RET_VALUE_ONLY
- Example:
- Returns
- the type object for this global variable
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the global variable has been destroyed |
◆ getValue()
auto Qore::Reflection::GlobalVar::getValue |
( |
| ) |
|
Returns the value of the global variable.
- Code Flags:
- RET_VALUE_ONLY
- Example:
auto val = var.getValue();
- Returns
- the value of the global variable
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the global variable has been destroyed |
◆ isBuiltin()
bool Qore::Reflection::GlobalVar::isBuiltin |
( |
| ) |
|
returns True if the global variable is a builtin global variable
- Code Flags:
- RET_VALUE_ONLY
- Example:
bool b = var.isBuiltin();
- Returns
- True if the global variable is a builtin global variable
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the global variable has been destroyed |
- Note
- complementary to isUser()
◆ isEqual()
bool Qore::Reflection::GlobalVar::isEqual |
( |
GlobalVar |
var | ) |
|
Returns True if the global variable passed as an argument is equal to the current object; False if not.
- Code Flags:
- CONSTANT
- Example:
bool b = var1.isEqual(var2);
- Parameters
-
var | the global variable to check with the current object for equality |
- Returns
- True if the object passed as an argument is equal to the current object; False if not
- Note
- if this method is called on user global variables created from the same source code but in different Program containers, it will return False
◆ isModulePublic()
bool Qore::Reflection::GlobalVar::isModulePublic |
( |
| ) |
|
returns True if the global variable has the module public flag set
- Code Flags:
- RET_VALUE_ONLY
- Example:
bool b = var.isModulePublic();
- Returns
- True if the global variable has the module public flag set
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the global variable has been destroyed |
◆ isUser()
bool Qore::Reflection::GlobalVar::isUser |
( |
| ) |
|
returns True if the global variable is a user global variable
- Code Flags:
- RET_VALUE_ONLY
- Example:
- Returns
- True if the global variable is a user global variable
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the global variable has been destroyed |
- Note
- complementary to isBuiltin()
◆ setValue()
nothing Qore::Reflection::GlobalVar::setValue |
( |
auto |
val | ) |
|
Sets the value of the global variable.
- Example:
- Parameters
-
val | the new value of the global variable |
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the global variable has been destroyed |
RUNTIME-TYPE-ERROR | value type is not compatible with the global variable's type |
The documentation for this class was generated from the following file:
- /export/home/dnichols/src/qore/git/qore/build/modules/reflection/QC_GlobalVar.dox.h