A class representing a Qore function.
More...
A class representing a Qore function.
- Restrictions:
- Qore::PO_NO_REFLECTION
- Since
- Qore 0.9.0
◆ call()
auto Qore::Reflection::Function::call |
( |
|
... | ) |
|
calls the function with the given arguments
- Example:
auto v = f.call(arg1, arg2);
- Parameters
-
... | optional arguments to the function |
- Returns
- the return value of the function call
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the function has been destroyed |
- See also
- callArgs()
◆ callArgs()
auto Qore::Reflection::Function::callArgs |
( |
*softlist< auto > |
argv | ) |
|
calls the given function with the given arguments as a list
- Example:
auto v = f.callArgs(argv);
- Parameters
-
argv | optional arguments to the function |
- Returns
- the return value of the function call
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the function has been destroyed |
- See also
- call()
◆ constructor()
Qore::Reflection::Function::constructor |
( |
string |
path | ) |
|
Creates the function from the name or namespace-justified path supplied as an argument.
- Example:
Function f("Qore::printf");
- Parameters
-
path | the function name or namespace-justified path as a string |
- Exceptions
-
UNKNOWN-FUNCTION | cannot find a function 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 functions matching the regular expression pattern argument or an empty list if no functions match.
- Code Flags:
- RET_VALUE_ONLY
- Example:
list<Function> l = Function::findAllRegex("^gg");
- Parameters
-
- Returns
- a list of functions matching the regular expression pattern argument or an empty list if no functions match
◆ findAllRegex() [2/2]
Returns a list of functions matching the regular expression pattern argument or an empty list if no functions match.
- Code Flags:
- RET_VALUE_ONLY
- Example:
list<Function> l = Function::findAllRegex(pgm, "^gg");
- Parameters
-
- Returns
- a list of functions matching the regular expression pattern argument or an empty list if no functions match
◆ forName() [1/2]
Returns a Function object from the function name or namespace-justified path as a string.
- Code Flags:
- RET_VALUE_ONLY
- Example:
Function f = Function::forName("Qore::printf");
- Parameters
-
path | the function name or namespace-justified path as a string |
- Returns
- a function object corresponding to the name or namespace-justified path provided as an argument
- Exceptions
-
UNKNOWN-FUNCTION | cannot find a function 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 |
◆ forName() [2/2]
Returns a Function object from the function name or namespace-justified path as a string.
- Code Flags:
- RET_VALUE_ONLY
- Example:
Function f = Function::forName(pgm, "Qore::printf");
- Parameters
-
pgm | the Program object to search |
path | the function name or namespace-justified path as a string |
- Returns
- a function object corresponding to the name or namespace-justified path provided as an argument
- Exceptions
-
UNKNOWN-FUNCTION | cannot find a function 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 |
◆ getVariant()
Returns the given direct child function variant declared in this function or throws an exception if the function variant is not defined.
- Code Flags:
- RET_VALUE_ONLY
- Example:
FunctionVariant v = n.getVariant(IntType, StringType);
- Parameters
-
... | type arguments for the variant; types must be compatible for the search to be successful |
- Returns
- given function variant or throws an exception if the function variant is not defined in this function
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the function has been destroyed |
RUNTIME-OVERLOAD-ERROR | thrown if the function variant cannot be matched to the given arguments |
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
-
◆ getVariantArgs()
Returns the given direct child function variant declared in this function or throws an exception if the function variant is not defined.
- Code Flags:
- RET_VALUE_ONLY
- Example:
FunctionVariant v = n.getVariantArgs((IntType, StringType));
- Parameters
-
argv | type arguments for the variant; types must be compatible for the search to be successful |
- Returns
- given function variant or throws an exception if the function variant is not defined in this function
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the function has been destroyed |
RUNTIME-OVERLOAD-ERROR | thrown if the function variant cannot be matched to the given arguments |
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
-
◆ getVariants()
returns the variants implemented by the function
- Code Flags:
- RET_VALUE_ONLY
- Example:
list<FunctionVariant> l = f.getVariants();
- Returns
- the variants implemented by the function
- Exceptions
-
PROGRAM-ERROR | thrown if the Program object holding the function has been destroyed |
The documentation for this class was generated from the following file: