| Qore reflection Module 1.14.0

Loading...
Searching...
No Matches
Public Member Functions | List of all members
Qore::Reflection::AbstractClass Class Reference

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

`#include <QC_AbstractClass.dox.h>`

Inheritance diagram for Qore::Reflection::AbstractClass:

## Public Member Functions
| constructor ()
| Throws an exception if called directly; this class can only be instantiated by builtin subclasses.
int | getDomain ()
| returns the functional domain of the class (for builtin classes only) as a bitfield of Functional Domain Constants
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
binary | getHash ()
| returns a unique binary hash for the class
int | getId ()
| returns the internal ID of the class which is only valid for the current execution session
string | getLanguage ()
| returns the class's programming language
AbstractMethod | getMethod (string name)
| returns the given method or throws an exception if the method does not exist in the local class
list< AbstractMethod > | getMethods ()
| returns a list of all class methods including special and static methods
list< string > | getModifierList ()
| returns a list of strings of modifiers describing the class
int | getModifiers ()
| returns a bitfield of modifiers describing the class
string | getName ()
| returns the class's name
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.
AbstractMethodVariant | getVariant (string name,...)
| returns the given method variant, otherwise throws an exception if no method variant can be matched
AbstractMethodVariant | getVariantArgs (string name, *softlist< Type > argv)
| returns the given method variant, otherwise throws an exception if no method variant can be matched
list< AbstractMethodVariant > | getVariants ()
| returns a list of all class method variants including variants for special and static methods
bool | hasMemberGate ()
| returns True if the class implements a "memberGate" method
bool | hasMemberNotification ()
| returns True if the class implements a "memberNotification" method
bool | hasMethodGate ()
| returns True if the class implements a "methodGate" method
bool | isAbstract ()
| returns True if the class has at least one abstract method
bool | isBuiltin ()
| returns True if the class is a builtin class
bool | isEqual (AbstractClass cls)
| Returns True if the Class object passed as an argument is equal to the current object; False if not.
bool | isInjected ()
| returns True if the class was injected as a dependency injection
bool | isModulePublic ()
| returns True if the class has the module public flag set
bool | isPseudoClass ()
| returns True if the class is a pseudo-class
bool | isUser ()
| returns True if the class is a user class

## 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-ERROR | this 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-ERROR | thrown 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-ERROR | thrown 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-ERROR | thrown 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-ERROR | thrown 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-ERROR | thrown 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

  name | the name of the method

Returns
  the given method

Exceptions

  PROGRAM-ERROR | thrown if the Program object holding the class has been destroyed
  METHOD-ERROR | unknown method
  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
  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-ERROR | thrown 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 Methods
  - `"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-ERROR | thrown 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 Methods
  - 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-ERROR | thrown 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-ERROR | thrown 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-ERROR | thrown 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

  name | the name of the method
  ... | Type arguments giving parameter types

Returns
  the given method variant

Exceptions

  PROGRAM-ERROR | thrown if the Program object holding the class has been destroyed
  GETVARIANT-ERROR | invalid argument to method
  METHOD-ERROR | unknown method
  VARIANT-MATCH-ERROR | no variant van be found matching the given argument types
  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()
  - getExactVariant()
  - getExactVariantArgs()

## ◆ 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

  name | the name of the method
  argv | Type arguments giving parameter types

Returns
  the given method variant

Exceptions

  PROGRAM-ERROR | thrown if the Program object holding the class has been destroyed
  GETVARIANT-ERROR | invalid argument to method
  METHOD-ERROR | unknown method
  VARIANT-MATCH-ERROR | no variant van be found matching the given argument types
  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
  - getVariant()
  - getExactVariant()
  - getExactVariantArgs()

## ◆ 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-ERROR | thrown 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-ERROR | thrown 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-ERROR | thrown 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-ERROR | thrown 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-ERROR | thrown 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-ERROR | thrown 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

  cls | the 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-ERROR | thrown 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-ERROR | thrown 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-ERROR | thrown 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-ERROR | thrown 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-ERROR | thrown if the Program object holding the class has been destroyed

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

- modules/reflection/src/QC_AbstractClass.dox.h