Qore reflection Module 1.19.2
Loading...
Searching...
No Matches
Qore::Reflection::Class Class Reference

This class provides information about Qore classes. More...

#include <QC_Class.dox.h>

Inheritance diagram for Qore::Reflection::Class:
Qore::Reflection::AbstractClass

Public Member Methods

 constructor (string path)
 Creates the object from the class name or namespace-justified path as a string. More...
 
hash< MethodAccessInfofindMethod (string name)
 Returns information about the given method if it's accessible in the class hierarchy or throws an exception if the method does not exist. More...
 
hash< MethodAccessInfofindNormalMethod (string name)
 Returns information about the given normal (non-static) method if it's accessible in the class hierarchy or throws an exception if the method does not exist. More...
 
hash< MethodAccessInfofindStaticMethod (string name)
 Returns information about the given static method if it's accessible in the class hierarchy or throws an exception if the method does not exist. More...
 
list< ClassgetClassHierarchy ()
 Returns a list of all unique classes in the class hierarchy (including classes inherited with private:internal access protection) in constructor execution order; the current class is always returned in the last position of the list. More...
 
ClassConstant getConstant (string name)
 Returns the given class constant or throws an exception if the constant is not defined. More...
 
list< ClassConstantgetConstants ()
 Returns a list of all declared class constants. More...
 
ConstructorMethod getConstructorMethod ()
 returns the given constructor method or throws an exception if the class does not implement a constructor method More...
 
ConstructorMethodVariant getConstructorVariant (...)
 Returns the given constructor method variant, otherwise throws an exception if no constructor method variant can be matched. More...
 
ConstructorMethodVariant getConstructorVariantArgs (*softlist< Type > argv)
 Returns the given constructor method variant, otherwise throws an exception if no constructor method variant can be matched. More...
 
list< ConstructorMethodVariantgetConstructorVariants ()
 returns a list of all constructor method variants More...
 
CopyMethod getCopyMethod ()
 returns the given copy method or throws an exception if the class does not implement a copy method More...
 
CopyMethodVariant getCopyVariant ()
 Returns the copy method variant, otherwise throws an exception if no copy method variant has been defined. More...
 
DestructorMethod getDestructorMethod ()
 returns the given destructor method or throws an exception if the class does not implement a destructor method More...
 
DestructorMethodVariant getDestructorVariant ()
 Returns the destructor method variant, otherwise throws an exception if no destructor method variant has been defined. More...
 
*CopyMethodVariant getIfCopyVariant ()
 returns the copy method variant or nothing if no copy method has been defined More...
 
*DestructorMethodVariant getIfDestructorVariant ()
 returns the destructor variant or nothing if no destructor has been defined More...
 
int getInheritanceAccess (Class base_class)
 Returns the accessibility of the class passed as an argument in the hierarchy of the current class as an access value or 0 if the argument class is not present in the current class's hierarchy at all. More...
 
AbstractClassMember getMember (string name)
 returns the requested member or throws an exception if the member is not defined in the class More...
 
list< AbstractClassMembergetMembers ()
 returns a list of all declared class members, non-static (first) and static (second) in declaration order More...
 
*string getModuleName ()
 Returns the module name providing the class or nothing if the class was not provided by a module. More...
 
Namespace getNamespace ()
 Returns the namespace for the class. More...
 
NormalMember getNormalMember (string name)
 returns the requested normal (non-static) member or throws an exception if the normal member is not defined in the class More...
 
NormalMethod getNormalMethod (string name)
 returns the given normal (non-special, non-static) method or throws an exception if the method does not exist More...
 
list< NormalMethodgetNormalMethods ()
 returns a list of all normal (non-static, non-special) class methods More...
 
NormalMethodVariant getNormalVariant (string name,...)
 returns the given normal (non-static, non-special) method variant, otherwise throws an exception if no method variant can be matched More...
 
NormalMethodVariant getNormalVariantArgs (string name, *softlist< Type > argv)
 Returns the given normal (non-static, non-special) method variant, otherwise throws an exception if no method variant can be matched. More...
 
list< NormalMethodVariantgetNormalVariants ()
 returns a list of all normal (non-static, non-special) method variants More...
 
Type getOrNothingType ()
 Returns the "or nothing" type object for this class. More...
 
string getPathName ()
 returns the class's full namespace-justified path name More...
 
StaticMember getStaticMember (string name)
 returns the requested static member or throws an exception if the static member is not defined in the class More...
 
StaticMethod getStaticMethod (string name)
 returns the given static method or throws an exception if the method does not exist More...
 
StaticMethodVariant getStaticVariant (string name,...)
 Returns the given static method variant, otherwise throws an exception if no static method variant can be matched. More...
 
StaticMethodVariant getStaticVariantArgs (string name, *softlist< Type > argv)
 Returns the given static method variant, otherwise throws an exception if no static method variant can be matched. More...
 
list< StaticMethodVariantgetStaticVariants ()
 returns a list of all static method variants More...
 
Type getType ()
 Returns the type object for this class. More...
 
bool hasConstructorMethod ()
 returns True if the class has at least one constructor method variant More...
 
bool hasCopyMethod ()
 returns True if the class has a copy method More...
 
bool hasDestructorMethod ()
 returns True if the class has a destructor method More...
 
int instanceOf (object obj)
 Returns the accessibility of the current class in the given object as an access value or 0 if the object does not inherit the class at all. More...
 
object newObject (...)
 creates an object if the current class with the given arguments More...
 
object newObjectArgs (*softlist argv)
 creates an object if the current class with the arguments for the constructor given as a list More...
 
- Public Member Methods inherited from Qore::Reflection::AbstractClass
 constructor ()
 Throws an exception if called directly; this class can only be instantiated by builtin subclasses. More...
 
int getDomain ()
 returns the functional domain of the class (for builtin classes only) as a bitfield of functional_domain_constants More...
 
list< string > getDomainStringList ()
 returns a list of functional domain strings for the class (for builtin classes only); an empty list is returned for user classes More...
 
binary getHash ()
 returns a unique binary hash for the class More...
 
int getId ()
 returns the internal ID of the class which is only valid for the current execution session More...
 
string getLanguage ()
 returns the class's programming language More...
 
AbstractMethod getMethod (string name)
 returns the given method or throws an exception if the method does not exist in the local class More...
 
list< AbstractMethodgetMethods ()
 returns a list of all class methods including special and static methods More...
 
list< string > getModifierList ()
 returns a list of strings of modifiers describing the class More...
 
int getModifiers ()
 returns a bitfield of modifiers describing the class More...
 
string getName ()
 returns the class's name More...
 
list< hash< ClassAccessInfo > > getParentClasses ()
 Returns a list of immediate parent classes and access information; if the Class has no parent classes, then an empty list is returned. More...
 
AbstractMethodVariant getVariant (string name,...)
 returns the given method variant, otherwise throws an exception if no method variant can be matched More...
 
AbstractMethodVariant getVariantArgs (string name, *softlist< Type > argv)
 returns the given method variant, otherwise throws an exception if no method variant can be matched More...
 
list< AbstractMethodVariantgetVariants ()
 returns a list of all class method variants including variants for special and static methods More...
 
bool hasMemberGate ()
 returns True if the class implements a "memberGate" method More...
 
bool hasMemberNotification ()
 returns True if the class implements a "memberNotification" method More...
 
bool hasMethodGate ()
 returns True if the class implements a "methodGate" method More...
 
bool isAbstract ()
 returns True if the class has at least one abstract method More...
 
bool isBuiltin ()
 returns True if the class is a builtin class More...
 
bool isEqual (AbstractClass cls)
 Returns True if the Class object passed as an argument is equal to the current object; False if not. More...
 
bool isInjected ()
 returns True if the class was injected as a dependency injection More...
 
bool isModulePublic ()
 returns True if the class has the module public flag set More...
 
bool isPseudoClass ()
 returns True if the class is a pseudo-class More...
 
bool isUser ()
 returns True if the class is a user class More...
 

Static Public Member Methods

static list< ClassfindAllRegex (string pattern, *int re_opts)
 Returns a list of classes matching the regular expression pattern argument or an empty list if no classes match. More...
 
static list< ClassfindAllRegex (Program pgm, string pattern, *int re_opts)
 Returns a list of classes matching the regular expression pattern argument or an empty list if no classes match. More...
 
static Class forName (string path)
 Returns a Class object from the class name or namespace-justified path as a string. More...
 
static Class forName (Program pgm, string path)
 Returns a Class object from the class name or namespace-justified path as a string. More...
 
static Class getClass (object obj)
 Returns the class for the object. More...
 

Detailed Description

This class provides information about Qore classes.

Restrictions:
Qore::PO_NO_REFLECTION
Since
Qore 0.9

Member Function Documentation

◆ constructor()

Qore::Reflection::Class::constructor ( string  path)

Creates the object from the class name or namespace-justified path as a string.

Example:
Class cls("Thread::Mutex");
Parameters
paththe class name or namespace-justified path as a string
Exceptions
UNKNOWN-CLASScannot find a class with the given name or path
ENCODING-CONVERSION-ERRORthis 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]

static list< Class > Qore::Reflection::Class::findAllRegex ( Program  pgm,
string  pattern,
*int  re_opts 
)
static

Returns a list of classes matching the regular expression pattern argument or an empty list if no classes match.

Code Flags:
RET_VALUE_ONLY
Example:
# return all accessible classes that start with the letter "T"
list<Class> l = Class::findAllRegex(pgm, "^T");
Parameters
pgmthe Program object to search
patternthe regular expression pattern to match
re_optssee regex_constants for possible values
Returns
a list of classes matching the regular expression pattern argument or an empty list if no classes match

◆ findAllRegex() [2/2]

static list< Class > Qore::Reflection::Class::findAllRegex ( string  pattern,
*int  re_opts 
)
static

Returns a list of classes matching the regular expression pattern argument or an empty list if no classes match.

Code Flags:
RET_VALUE_ONLY
Example:
# return all accessible classes that start with the letter "T"
list<Class> l = Class::findAllRegex("^T");
Parameters
patternthe regular expression pattern to match
re_optssee regex_constants for possible values
Returns
a list of classes matching the regular expression pattern argument or an empty list if no classes match

◆ findMethod()

hash< MethodAccessInfo > Qore::Reflection::Class::findMethod ( string  name)

Returns information about the given method if it's accessible in the class hierarchy or throws an exception if the method does not exist.

Code Flags:
RET_VALUE_ONLY
Example:
MethodAccessInfo info = cls.findMethod(name);
printf("find('%s::%s()': found '%s::%s()'; class access %y, variants: %d\n", cls.getName(), name,
info.method.getClass().getName(), info.access_string, info.method.getVariants().size());

Searches the class hierarchy for normal methods (including special methods) and then static methods for the given method name

Parameters
namethe name of the method
Returns
information about the given method; the access information in the hash is the access of the class containing the method; to get the access modifier of any method variant, the maximum of the access value provided here and the access value of the variant must be taken.
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
METHOD-ERRORunknown method
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion
Note
Methods group variants with the same name; see AbstractMethod::getVariant() for a method to retrieve a specific variant from a method.
See also

◆ findNormalMethod()

hash< MethodAccessInfo > Qore::Reflection::Class::findNormalMethod ( string  name)

Returns information about the given normal (non-static) method if it's accessible in the class hierarchy or throws an exception if the method does not exist.

Code Flags:
RET_VALUE_ONLY
Example:
MethodAccessInfo info = cls.getNormalMethod(name);
printf("find('%s::%s()': found '%s::%s()'; class access %y, variants: %d\n", cls.getName(), name,
info.method.getClass().getName(), info.access_string, info.method.getVariants().size());

Searches the class hierarchy for normal methods for the given method name

Parameters
namethe name of the method
Returns
information about the given method; the access information in the hash is the access of the class containing the method; to get the access modifier of any method variant, the maximum of the access value provided here and the access value of the variant must be taken.
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
METHOD-ERRORunknown method
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion
Note
Methods group variants with the same name; see AbstractMethod::getVariant() for a method to retrieve a specific variant from a method.
See also

◆ findStaticMethod()

hash< MethodAccessInfo > Qore::Reflection::Class::findStaticMethod ( string  name)

Returns information about the given static method if it's accessible in the class hierarchy or throws an exception if the method does not exist.

Code Flags:
RET_VALUE_ONLY
Example:
MethodAccessInfo info = cls.getStaticMethod(name);
printf("find('%s::%s()': found '%s::%s()'; class access %y, variants: %d\n", cls.getName(), name,
info.method.getClass().getName(), info.access_string, info.method.getVariants().size());

Searches the class hierarchy for static methods for the given method name

Parameters
namethe name of the method
Returns
information about the given method; the access information in the hash is the access of the class containing the method; to get the access modifier of any method variant, the maximum of the access value provided here and the access value of the variant must be taken.
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
METHOD-ERRORunknown method
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion
Note
Methods group variants with the same name; see AbstractMethod::getVariant() for a method to retrieve a specific variant from a method.
See also

◆ forName() [1/2]

static Class Qore::Reflection::Class::forName ( Program  pgm,
string  path 
)
static

Returns a Class object from the class name or namespace-justified path as a string.

Code Flags:
RET_VALUE_ONLY
Example:
Class cls = Class::forName(pgm, "Thread::Mutex");
Parameters
pgmthe Program object to search
paththe class name or namespace-justified path as a string
Returns
a class object corresponding to the name or namespace-justified path provided as an argument
Exceptions
UNKNOWN-CLASScannot find a class with the given name or path
ENCODING-CONVERSION-ERRORthis 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]

static Class Qore::Reflection::Class::forName ( string  path)
static

Returns a Class object from the class name or namespace-justified path as a string.

Code Flags:
RET_VALUE_ONLY
Example:
Class cls = Class::forName("Thread::Mutex");
Parameters
paththe class name or namespace-justified path as a string
Returns
a class object corresponding to the name or namespace-justified path provided as an argument
Exceptions
UNKNOWN-CLASScannot find a class with the given name or path
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion

◆ getClass()

static Class Qore::Reflection::Class::getClass ( object  obj)
static

Returns the class for the object.

Code Flags:
CONSTANT
Example:
Class cls = Class::getClass(obj);
Parameters
objthe object to return the class for
Returns
the class for the object

◆ getClassHierarchy()

list< Class > Qore::Reflection::Class::getClassHierarchy ( )

Returns a list of all unique classes in the class hierarchy (including classes inherited with private:internal access protection) in constructor execution order; the current class is always returned in the last position of the list.

Code Flags:
RET_VALUE_ONLY
Example:
list<Class> l = cls.getClassHierarchy();
Returns
a list of all unique classes in the class hierarchy (including classes inherited with private:internal access protection) in constructor execution order; the current class is always returned in the last position of the list
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ getConstant()

ClassConstant Qore::Reflection::Class::getConstant ( string  name)

Returns the given class constant or throws an exception if the constant is not defined.

Code Flags:
RET_VALUE_ONLY
Example:
ClassConstant con = cls.getConstant(name);
Returns
the given class constant or throws an exception if the constant is not defined
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
UNKNOWN-CONSTANTthrown if the constant cannot be found
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion

◆ getConstants()

list< ClassConstant > Qore::Reflection::Class::getConstants ( )

Returns a list of all declared class constants.

Code Flags:
RET_VALUE_ONLY
Example:
list<ClassConstant> l = cls.getConstants();
Returns
a list of all declared class constants
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ getConstructorMethod()

ConstructorMethod Qore::Reflection::Class::getConstructorMethod ( )

returns the given constructor method or throws an exception if the class does not implement a constructor method

Code Flags:
RET_VALUE_ONLY
Example:
ConstructorMethod m = cls.getConstructorMethod();
Returns
the given constructor method
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
METHOD-ERRORthe class does not implement a constructor method
See also

◆ getConstructorVariant()

ConstructorMethodVariant Qore::Reflection::Class::getConstructorVariant (   ...)

Returns the given constructor method variant, otherwise throws an exception if no constructor method variant can be matched.

Code Flags:
RET_VALUE_ONLY
Example:
ConstructorMethodVariant m = cls.getConstructorVariant(IntType, StringType);

Searches constructor methods only and then matches the arguments by type to return the variant

Parameters
...Type arguments giving parameter types
Returns
the given constructor method variant
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
GETVARIANT-ERRORinvalid argument to method
METHOD-ERRORno constructor method defined
VARIANT-MATCH-ERRORno constructor method variant van be found matching the given argument types
See also

◆ getConstructorVariantArgs()

ConstructorMethodVariant Qore::Reflection::Class::getConstructorVariantArgs ( *softlist< Type argv)

Returns the given constructor method variant, otherwise throws an exception if no constructor method variant can be matched.

Code Flags:
RET_VALUE_ONLY
Example:
ConstructorMethodVariant m = cls.getConstructorVariantArgs((IntType, StringType));

Searches static methods only for the given method name and and then matches the arguments by type

Parameters
argvType arguments giving parameter types
Returns
the given static method variant
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
GETVARIANT-ERRORinvalid argument to method
METHOD-ERRORno constructor method defined
VARIANT-MATCH-ERRORno method constructor variant van be found matching the given argument types
See also

◆ getConstructorVariants()

list< ConstructorMethodVariant > Qore::Reflection::Class::getConstructorVariants ( )

returns a list of all constructor method variants

Code Flags:
RET_VALUE_ONLY
Example:
list<ConstructorMethodVariant> l = cls.getConstructorVariants();
Returns
a list of all constructor method variants
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ getCopyMethod()

CopyMethod Qore::Reflection::Class::getCopyMethod ( )

returns the given copy method or throws an exception if the class does not implement a copy method

Code Flags:
RET_VALUE_ONLY
Example:
CopyMethod m = cls.getCopyMethod();
Returns
the given copy method
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
METHOD-ERRORthe class does not implement a copy method
See also

◆ getCopyVariant()

CopyMethodVariant Qore::Reflection::Class::getCopyVariant ( )

Returns the copy method variant, otherwise throws an exception if no copy method variant has been defined.

Code Flags:
RET_VALUE_ONLY
Example:
CopyMethodVariant m = cls.getCopyVariant();

Searches copy methods only

Returns
the given copy method variant
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
GETVARIANT-ERRORinvalid argument to method
METHOD-ERRORno copy method defined
See also

◆ getDestructorMethod()

DestructorMethod Qore::Reflection::Class::getDestructorMethod ( )

returns the given destructor method or throws an exception if the class does not implement a destructor method

Code Flags:
RET_VALUE_ONLY
Example:
DestructorMethod m = cls.getDestructorMethod();
Returns
the given destructor method
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
METHOD-ERRORthe class does not implement a destructor method
See also

◆ getDestructorVariant()

DestructorMethodVariant Qore::Reflection::Class::getDestructorVariant ( )

Returns the destructor method variant, otherwise throws an exception if no destructor method variant has been defined.

Code Flags:
RET_VALUE_ONLY
Example:
DestructorMethodVariant m = cls.getDestructorVariant();

Searches destructor methods only

Returns
the given destructor method variant
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
GETVARIANT-ERRORinvalid argument to method
METHOD-ERRORno destructor method defined
See also

◆ getIfCopyVariant()

*CopyMethodVariant Qore::Reflection::Class::getIfCopyVariant ( )

returns the copy method variant or nothing if no copy method has been defined

Code Flags:
RET_VALUE_ONLY
Example:
*CopyMethodVariant dv = cls.getIfCopyVariant();
Returns
the copy method variant or nothing if no copy method has been defined
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
Note
copy methods may not be overloaded, therefore if a copy method is defined, it will only have one variant
See also
getCopyVariant()

◆ getIfDestructorVariant()

*DestructorMethodVariant Qore::Reflection::Class::getIfDestructorVariant ( )

returns the destructor variant or nothing if no destructor has been defined

Code Flags:
RET_VALUE_ONLY
Example:
*DestructorMethodVariant dv = cls.getIfDestructorVariant();
Returns
the destructor variant or nothing if no destructor has been defined
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
See also
getDestructorVariant()

◆ getInheritanceAccess()

int Qore::Reflection::Class::getInheritanceAccess ( Class  base_class)

Returns the accessibility of the class passed as an argument in the hierarchy of the current class as an access value or 0 if the argument class is not present in the current class's hierarchy at all.

Code Flags:
CONSTANT
Example:
if (!cls.getInheritanceAccess(base_class)) {
printf("class %y does not inherit class %y\n", cls.getPathName(), base_class.getPathName());
}
Parameters
base_classthe class to try to find in the current class's hieerarchy
Returns
an access value giving the accessibility of the base class in the current class's hierarchy or 0 if the argument class is not present in the current class's hierarchy at all; see Access Constants for possible return values (plus 0 meaning no inheritance)

◆ getMember()

AbstractClassMember Qore::Reflection::Class::getMember ( string  name)

returns the requested member or throws an exception if the member is not defined in the class

Code Flags:
RET_VALUE_ONLY
Example:
AbstractClassMember m = cls.getMember(name);
Returns
the requested member or throws an exception if the member is not defined in the class
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
UNKNOWN-MEMBERif the requested member is not defined in the class
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion
See also

◆ getMembers()

list< AbstractClassMember > Qore::Reflection::Class::getMembers ( )

returns a list of all declared class members, non-static (first) and static (second) in declaration order

Code Flags:
RET_VALUE_ONLY
Example:
list<AbstractClassMember> l = cls.getMembers();
Returns
a list of all declared class members, non-static (first) and static (second) in declaration order
Note
only members declared in the local class are returned
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ getModuleName()

*string Qore::Reflection::Class::getModuleName ( )

Returns the module name providing the class or nothing if the class was not provided by a module.

Code Flags:
RET_VALUE_ONLY
Example:
*string str = cls.getModuleName();
Returns
the module name providing the class or nothing if the class was not provided by a module

◆ getNamespace()

Namespace Qore::Reflection::Class::getNamespace ( )

Returns the namespace for the class.

Code Flags:
CONSTANT
Example:
Namespace ns = cls.getNamespace();
Returns
the namespace for the class
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ getNormalMember()

NormalMember Qore::Reflection::Class::getNormalMember ( string  name)

returns the requested normal (non-static) member or throws an exception if the normal member is not defined in the class

Code Flags:
RET_VALUE_ONLY
Example:
NormalMember m = cls.getNormalMember(name);
Returns
the requested normal (non-static) member or throws an exception if the member is not defined in the class
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
UNKNOWN-NORMAL-MEMBERif the requested normal (non-static) member is not defined in the class
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion
See also

◆ getNormalMethod()

NormalMethod Qore::Reflection::Class::getNormalMethod ( string  name)

returns the given normal (non-special, non-static) method or throws an exception if the method does not exist

Code Flags:
RET_VALUE_ONLY
Example:
NormalMethod m = cls.getNormalMethod(name);
Parameters
namethe name of the normal (non-special, non-static) method
Returns
the given normal (non-special, non-static) method
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
UNKNOWN-METHODunknown method or method is not normal
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion
See also

◆ getNormalMethods()

list< NormalMethod > Qore::Reflection::Class::getNormalMethods ( )

returns a list of all normal (non-static, non-special) class methods

Code Flags:
RET_VALUE_ONLY
Example:
list<NormalMethod> l = cls.getNormalMethods();
Returns
a list of all normal (non-static, non-special) class methods
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ getNormalVariant()

NormalMethodVariant Qore::Reflection::Class::getNormalVariant ( string  name,
  ... 
)

returns the given normal (non-static, non-special) method variant, otherwise throws an exception if no method variant can be matched

Code Flags:
RET_VALUE_ONLY
Example:
NormalMethodVariant m = cls.getNormalVariant(name, IntType, StringType);

Searches normal (non-static, non-special) methods only for the given method name and and then matches the arguments by type to return the variant.

Parameters
namethe name of the normal (non-static, non-special) method
...Type arguments giving parameter types
Returns
the given normal (non-static, non-special) method variant
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
GETVARIANT-ERRORinvalid argument to method
METHOD-ERRORunknown normal (non-static, non-special) method
VARIANT-MATCH-ERRORno normal (non-static, non-special) method variant van be found matching the given argument types
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion
See also

◆ getNormalVariantArgs()

NormalMethodVariant Qore::Reflection::Class::getNormalVariantArgs ( string  name,
*softlist< Type argv 
)

Returns the given normal (non-static, non-special) method variant, otherwise throws an exception if no method variant can be matched.

Code Flags:
RET_VALUE_ONLY
Example:
NormalMethodVariant m = cls.getNormalVariantArgs(name, (IntType, StringType));

Searches normal (non-static, non-special) methods only for the given method name and and then matches the arguments by type

Parameters
namethe name of the normal (non-static, non-special) method
argvType arguments giving parameter types
Returns
the given normal (non-static, non-special) method variant
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
GETVARIANT-ERRORinvalid argument to method
METHOD-ERRORunknown normal (non-static, non-special) method
VARIANT-MATCH-ERRORno normal (non-static, non-special) method variant van be found matching the given argument types
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion
See also

◆ getNormalVariants()

list< NormalMethodVariant > Qore::Reflection::Class::getNormalVariants ( )

returns a list of all normal (non-static, non-special) method variants

Code Flags:
RET_VALUE_ONLY
Example:
list<NormalMethodVariant> l = cls.getNormalVariants();
Returns
a list of all normal (non-static, non-special) method variants
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ getOrNothingType()

Type Qore::Reflection::Class::getOrNothingType ( )

Returns the "or nothing" type object for this class.

Code Flags:
RET_VALUE_ONLY
Example:
Type t = cls.getOrNothingType();
Returns
the "or nothing" type object for this class
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
See also
getType()

◆ getPathName()

string Qore::Reflection::Class::getPathName ( )

returns the class's full namespace-justified path name

Code Flags:
RET_VALUE_ONLY
Example:
string name = cls.getPathName();
Returns
the class's full namespace-justified path name
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
See also
getName()

◆ getStaticMember()

StaticMember Qore::Reflection::Class::getStaticMember ( string  name)

returns the requested static member or throws an exception if the static member is not defined in the class

Code Flags:
RET_VALUE_ONLY
Example:
StaticMember m = cls.getStaticMember(name);
Returns
the requested static member or throws an exception if the member is not defined in the class
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
UNKNOWN-STATIC-MEMBERif the requested static member is not defined in the class
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion
See also

◆ getStaticMethod()

StaticMethod Qore::Reflection::Class::getStaticMethod ( string  name)

returns the given static method or throws an exception if the method does not exist

Code Flags:
RET_VALUE_ONLY
Example:
StaticMethod m = cls.getStaticMethod(name);
Parameters
namethe name of the static method
Returns
the given static method
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
UNKNOWN-METHODunknown method or method is not static
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion
See also

◆ getStaticVariant()

StaticMethodVariant Qore::Reflection::Class::getStaticVariant ( string  name,
  ... 
)

Returns the given static method variant, otherwise throws an exception if no static method variant can be matched.

Code Flags:
RET_VALUE_ONLY
Example:
StaticMethodVariant m = cls.getStaticVariant(name, IntType, StringType);

Searches static methods only for the given method name and and then matches the arguments by type to return the variant

Parameters
namethe name of the static method
...Type arguments giving parameter types
Returns
the given static method variant
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
GETVARIANT-ERRORinvalid argument to method
METHOD-ERRORunknown static method
VARIANT-MATCH-ERRORno static method variant van be found matching the given argument types
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion
See also

◆ getStaticVariantArgs()

StaticMethodVariant Qore::Reflection::Class::getStaticVariantArgs ( string  name,
*softlist< Type argv 
)

Returns the given static method variant, otherwise throws an exception if no static method variant can be matched.

Code Flags:
RET_VALUE_ONLY
Example:
StaticMethodVariant m = cls.getStaticVariantArgs(name, (IntType, StringType));

Searches static methods only for the given method name and and then matches the arguments by type

Parameters
namethe name of the static method
argvType arguments giving parameter types
Returns
the given static method variant
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
GETVARIANT-ERRORinvalid argument to method
METHOD-ERRORunknown static method
VARIANT-MATCH-ERRORno method static variant van be found matching the given argument types
ENCODING-CONVERSION-ERRORthis exception could be thrown if the string argument is not in the default character encoding and an error occurs during encoding conversion
See also

◆ getStaticVariants()

list< StaticMethodVariant > Qore::Reflection::Class::getStaticVariants ( )

returns a list of all static method variants

Code Flags:
RET_VALUE_ONLY
Example:
list<StaticMethodVariant> l = cls.getStaticVariants();
Returns
a list of all static method variants
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ getType()

Type Qore::Reflection::Class::getType ( )

Returns the type object for this class.

Code Flags:
RET_VALUE_ONLY
Example:
Type t = cls.getType();
Returns
the type object for this class
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
See also
getOrNothingType()

◆ hasConstructorMethod()

bool Qore::Reflection::Class::hasConstructorMethod ( )

returns True if the class has at least one constructor method variant

Code Flags:
RET_VALUE_ONLY
Example:
bool b = cls.hasConstructorMethod();
Returns
True if the class has at least one constructor method variant
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ hasCopyMethod()

bool Qore::Reflection::Class::hasCopyMethod ( )

returns True if the class has a copy method

Code Flags:
RET_VALUE_ONLY
Example:
bool b = cls.hasCopyMethod();
Returns
True if the class has a copy method
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ hasDestructorMethod()

bool Qore::Reflection::Class::hasDestructorMethod ( )

returns True if the class has a destructor method

Code Flags:
RET_VALUE_ONLY
Example:
bool b = cls.hasDestructorMethod();
Returns
True if the class has a destructor method
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ instanceOf()

int Qore::Reflection::Class::instanceOf ( object  obj)

Returns the accessibility of the current class in the given object as an access value or 0 if the object does not inherit the class at all.

Code Flags:
CONSTANT
Example:
if (!cls.instanceOf(obj)) {
printf("object of class %y does not inherit %y\n", obj.className(), cls.getPathName());
}
Parameters
objthe object to test
Returns
an access value giving the accessibility of the class in the object or 0 if the object does not inherit the class at all; see Access Constants for possible return values (plus 0 meaning no inheritance)

◆ newObject()

object Qore::Reflection::Class::newObject (   ...)

creates an object if the current class with the given arguments

Example:
object o = cls.newObject();
Parameters
...the arguments for the cosntructor, if any
Returns
an object if the current class based on the constructor arguments passed
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
CREATE-OBJECT-ERRORclass implements features restricted by current parse options / sandboxing restrictions
CONSTRUCTOR-IS-PRIVATEattempt to instantiate an object with a private constructor from outside the class
ABSTRACT-CLASS-ERRORthrown if the class has abstract methods
Note
see the class documentation for the class to be instantiated for a list of additional exceptions that can be thrown
See also

◆ newObjectArgs()

object Qore::Reflection::Class::newObjectArgs ( *softlist  argv)

creates an object if the current class with the arguments for the constructor given as a list

Example:
object o = cls.newObjectArgs(args);
Parameters
argvthe arguments for the constructor
Returns
an object if the current class based on the constructor arguments passed
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
CREATE-OBJECT-ERRORclass implements features restricted by current parse options / sandboxing restrictions
CONSTRUCTOR-IS-PRIVATEattempt to instantiate an object with a private constructor from outside the class
ABSTRACT-CLASS-ERRORthrown if the class has abstract methods
Note
see the class documentation for the class to be instantiated for a list of additional exceptions that can be thrown
See also

The documentation for this class was generated from the following file: