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

The abstract base class for Qore classes. More...

#include <QC_AbstractClass.dox.h>

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

Public Member Methods

 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...
 

Detailed Description

The abstract base class for Qore classes.

Restrictions:
Qore::PO_NO_REFLECTION

This class cannot be instantiated directly and also cannot be directly inherited by user-defined classes.

Since
Qore 0.9

Member Function Documentation

◆ constructor()

Qore::Reflection::AbstractClass::constructor ( )

Throws an exception if called directly; this class can only be instantiated by builtin subclasses.

Exceptions
ABSTRACTCLASS-CONSTRUCTOR-ERRORthis exception is thrown if this class is constructed directly (also if directly inherited by user classes)

◆ getDomain()

int Qore::Reflection::AbstractClass::getDomain ( )

returns the functional domain of the class (for builtin classes only) as a bitfield of functional_domain_constants

Code Flags:
RET_VALUE_ONLY
Example:
int i = cls.getDomain();
Returns
the functional domain of the class (for builtin classes only) as a bitfield of functional_domain_constants
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
See also
getDomainStringList()
Note
user classes always return 0 here; a value is only returned by builtin classes

◆ getDomainStringList()

list< string > Qore::Reflection::AbstractClass::getDomainStringList ( )

returns a list of functional domain strings for the class (for builtin classes only); an empty list is returned for user classes

Code Flags:
RET_VALUE_ONLY
Example:
list<string> l = cls.getDomainStringList();
Returns
a list of functional domain strings for the class (for builtin classes only)
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
See also
getDomain()
Note
user classes always return an empty list here

◆ getHash()

binary Qore::Reflection::AbstractClass::getHash ( )

returns a unique binary hash for the class

Code Flags:
RET_VALUE_ONLY
Example:
binary b = cls.getHash();
Returns
a unique binary hash for the class
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ getId()

int Qore::Reflection::AbstractClass::getId ( )

returns the internal ID of the class which is only valid for the current execution session

Code Flags:
RET_VALUE_ONLY
Example:
if (cls1.getId() == cls2.getId()) {
printf("classes are the same\n");
}
Returns
the internal ID of the class which is only valid for the current execution session
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ getLanguage()

string Qore::Reflection::AbstractClass::getLanguage ( )

returns the class's programming language

Code Flags:
CONSTANT
Example:
string lang = cls.getLanguage();
Returns
the class's programming language
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
Since
Qore 1.0.1

◆ getMethod()

AbstractMethod Qore::Reflection::AbstractClass::getMethod ( string  name)

returns the given method or throws an exception if the method does not exist in the local class

Code Flags:
RET_VALUE_ONLY
Example:
AbstractMethod m = cls.getMethod(name);

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

Parameters
namethe name of the method
Returns
the given method
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 getVariant() for a method that will return a method variant given the method name and the method variant arguments
See also
Class::findMethod() for a similar method that searches theh class hierarchy instead of just the local class

◆ getMethods()

list< AbstractMethod > Qore::Reflection::AbstractClass::getMethods ( )

returns a list of all class methods including special and static methods

Code Flags:
RET_VALUE_ONLY
Example:
list<AbstractMethod> l = cls.getMethods();
Returns
a list of all class methods including special and static methods
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ getModifierList()

list< string > Qore::Reflection::AbstractClass::getModifierList ( )

returns a list of strings of modifiers describing the class

Code Flags:
RET_VALUE_ONLY
Example:
list<string> l = cls.getModifierList();
Returns
list of strings of modifiers describing the class; possible values are:
  • "abstract": the class is abstract
  • "final": the class has the final flag set
  • "public": the class has the module public flag set (not related to any inheritance properties in a class hierarchy)
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
See also
getModifiers()

◆ getModifiers()

int Qore::Reflection::AbstractClass::getModifiers ( )

returns a bitfield of modifiers describing the class

Code Flags:
RET_VALUE_ONLY
Example:
int i = cls.getModifiers();
Returns
a bitfield of modifiers describing the class; possible values are:
  • MC_ABSTRACT: the class is abstract
  • MC_FINAL: the class has the final flag set
  • MC_PUBLIC: the class has the module public flag set (not related to any inheritance properties in a class hierarchy)
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
See also
getModifierList()

◆ getName()

string Qore::Reflection::AbstractClass::getName ( )

returns the class's name

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

◆ getParentClasses()

list< hash< ClassAccessInfo > > Qore::Reflection::AbstractClass::getParentClasses ( )

Returns a list of immediate parent classes and access information; if the Class has no parent classes, then an empty list is returned.

Code Flags:
RET_VALUE_ONLY
Example:
list<hash<ClassAccessInfo>> l = cls.getParentClasses();
Returns
a list of immediate parent classes and access information; if the Class has no parent classes, then an empty list is returned
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ getVariant()

AbstractMethodVariant Qore::Reflection::AbstractClass::getVariant ( string  name,
  ... 
)

returns the given method variant, otherwise throws an exception if no method variant can be matched

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

Searches normal methods (including special methods) and then static methods for the given method name and and then matches the arguments by type to return the variant

Parameters
namethe name of the method
...Type arguments giving parameter types
Returns
the given method variant
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
GETVARIANT-ERRORinvalid argument to method
METHOD-ERRORunknown method
VARIANT-MATCH-ERRORno 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

◆ getVariantArgs()

AbstractMethodVariant Qore::Reflection::AbstractClass::getVariantArgs ( string  name,
*softlist< Type argv 
)

returns the given method variant, otherwise throws an exception if no method variant can be matched

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

Searches normal methods (including special methods) and then static methods for the given method name and and then matches the arguments by type

Parameters
namethe name of the method
argvType arguments giving parameter types
Returns
the given method variant
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed
GETVARIANT-ERRORinvalid argument to method
METHOD-ERRORunknown method
VARIANT-MATCH-ERRORno 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

◆ getVariants()

list< AbstractMethodVariant > Qore::Reflection::AbstractClass::getVariants ( )

returns a list of all class method variants including variants for special and static methods

Code Flags:
RET_VALUE_ONLY
Example:
list<AbstractMethodVariant> l = cls.getVariants();
Returns
a list of all class method variants including variants for special and static methods
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ hasMemberGate()

bool Qore::Reflection::AbstractClass::hasMemberGate ( )

returns True if the class implements a "memberGate" method

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

◆ hasMemberNotification()

bool Qore::Reflection::AbstractClass::hasMemberNotification ( )

returns True if the class implements a "memberNotification" method

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

◆ hasMethodGate()

bool Qore::Reflection::AbstractClass::hasMethodGate ( )

returns True if the class implements a "methodGate" method

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

◆ isAbstract()

bool Qore::Reflection::AbstractClass::isAbstract ( )

returns True if the class has at least one abstract method

Code Flags:
RET_VALUE_ONLY
Example:
bool b = cls.isAbstract();
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ isBuiltin()

bool Qore::Reflection::AbstractClass::isBuiltin ( )

returns True if the class is a builtin class

Code Flags:
RET_VALUE_ONLY
Example:
bool b = cls.isBuiltin();
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ isEqual()

bool Qore::Reflection::AbstractClass::isEqual ( AbstractClass  cls)

Returns True if the Class object passed as an argument is equal to the current object; False if not.

Code Flags:
RET_VALUE_ONLY
Example:
bool b = c1.isEqual(c2);
Parameters
clsthe class to check with the current object for equality
Returns
True if the Class object passed as an argument is equal to the current object; False if not
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ isInjected()

bool Qore::Reflection::AbstractClass::isInjected ( )

returns True if the class was injected as a dependency injection

Code Flags:
RET_VALUE_ONLY
Example:
bool b = cls.isInjected();
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ isModulePublic()

bool Qore::Reflection::AbstractClass::isModulePublic ( )

returns True if the class has the module public flag set

Code Flags:
RET_VALUE_ONLY
Example:
bool b = cls.isModulePublic();
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ isPseudoClass()

bool Qore::Reflection::AbstractClass::isPseudoClass ( )

returns True if the class is a pseudo-class

Code Flags:
RET_VALUE_ONLY
Example:
bool b = cls.isPseudoClass();
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

◆ isUser()

bool Qore::Reflection::AbstractClass::isUser ( )

returns True if the class is a user class

Code Flags:
RET_VALUE_ONLY
Example:
bool b = cls.isUser();
Exceptions
PROGRAM-ERRORthrown if the Program object holding the class has been destroyed

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