Loading...
Searching...
No Matches
Qore::Reflection::AbstractConstant Class Reference

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

`#include <QC_AbstractConstant.dox.h>`

Inheritance diagram for Qore::Reflection::AbstractConstant:

## Public Member Functions

| constructor ()
| Throws an exception; this class cannot be created directly or used in a user class hierarchy. More...
list< string > | getModifierList ()
| returns a list of strings of modifiers describing the constant More...
int | getModifiers ()
| returns a bitfield of modifiers describing the constant More...
*string | getModuleName ()
| Returns the module name providing the constant or NOTHING if the constant was not provided by a module. More...
string | getName ()
| returns the constant's name More...
hash< SourceLocationInfo > | getSourceLocation ()
| Returns the source location of the contant declaration. More...
Type | getType ()
| Returns the type object for this constant. More...
auto | getValue ()
| Returns the value of the constant. More...
bool | isBuiltin ()
| returns True if the constant is builtin More...
bool | isClassConstant ()
| returns True if the constant is a class constant More...
bool | isEqual (AbstractConstant con)
| Returns True if the AbstractConstant object passed as an argument is equal to the current object; False if not. More...
bool | isUser ()
| returns True if the constant is a user constant More...

## Detailed Description

This class provides information about Qore class members.

Restrictions:
  Qore::PO_NO_REFLECTION

Since
  Qore 0.9.0

## Member Function Documentation

## constructor()

Qore::Reflection::AbstractConstant::constructor | ( |  | ) |

Throws an exception; this class cannot be created directly or used in a user class hierarchy.

Exceptions

  ABSTRACTCONSTANT-CONSTRUCTOR-ERROR | the AbstractConstant class cannot be constructed directly or inherited directly by a user-defined class

## getModifierList()

list< string > Qore::Reflection::AbstractConstant::getModifierList | ( |  | ) |

returns a list of strings of modifiers describing the constant

Code Flags:
  RET_VALUE_ONLY

Example:
  list<string> l = con.getModifierList();

Returns
  list of strings of modifiers describing the member; possible values are:
  - `"private"`: gives the accessibility of the constant (class constants only)
  - `"private:internal"`: gives the accessibility of the constant (class constants only)
  - `"public"`: for non-class constants, this is returned if the public flag is on the constant, meaning that it will be exported to child Program objects, otherwise thhis gives the access permission for class constants

Exceptions

  PROGRAM-ERROR | thrown if the Program object holding the constant has been destroyed

See also
  getModifiers()

## getModifiers()

int Qore::Reflection::AbstractConstant::getModifiers | ( |  | ) |

returns a bitfield of modifiers describing the constant

Code Flags:
  RET_VALUE_ONLY

Example:
  int i = con.getModifiers();

Returns
  a bitfield of modifiers describing the constant; possible values are:
  - MC_PRIVATE: gives the accessibility of the constant (class constants only)
  - MC_PRIVATEINTERNAL: gives the accessibility of the constant (class constants only)
  - MC_PUBLIC: for non-class constants, this is returned if the public flag is on the constant, meaning that it will be exported to child Program objects, otherwise thhis gives the access permission for class constants

Exceptions

  PROGRAM-ERROR | thrown if the Program object holding the constant has been destroyed

See also
  getModifierList()

## getModuleName()

*string Qore::Reflection::AbstractConstant::getModuleName | ( |  | ) |

Returns the module name providing the constant or NOTHING if the constant was not provided by a module.

Code Flags:
  RET_VALUE_ONLY

Example:
  *string str = f.getModuleName();

Returns
  the module name providing the constant or NOTHING if the constant was not provided by a module

Since
  Qore 0.9.5

## getName()

string Qore::Reflection::AbstractConstant::getName | ( |  | ) |

returns the constant's name

Code Flags:
  RET_VALUE_ONLY

Example:
  string name = con.getName();

Returns
  the constant's name

Exceptions

  PROGRAM-ERROR | thrown if the Program object holding the constant has been destroyed

## getSourceLocation()

hash< SourceLocationInfo > Qore::Reflection::AbstractConstant::getSourceLocation | ( |  | ) |

Returns the source location of the contant declaration.

Code Flags:
  RET_VALUE_ONLY

Example:
  hash<SourceLocationInfo> loc = con.getSourceLocation();

Returns
  the source location of the contant declaration

Exceptions

  PROGRAM-ERROR | thrown if the Program object holding the constant has been destroyed

## getType()

Type Qore::Reflection::AbstractConstant::getType | ( |  | ) |

Returns the type object for this constant.

Code Flags:
  RET_VALUE_ONLY

Example:
  Type t = con.getType();

Returns
  the type object for this constant

Exceptions

  PROGRAM-ERROR | thrown if the Program object holding the constant has been destroyed

## getValue()

auto Qore::Reflection::AbstractConstant::getValue | ( |  | ) |

Returns the value of the constant.

Code Flags:
  RET_VALUE_ONLY

Example:
  auto v = con.getValue();

Returns
  the value for the constant

Exceptions

  PROGRAM-ERROR | thrown if the Program object holding the constant has been destroyed

## isBuiltin()

bool Qore::Reflection::AbstractConstant::isBuiltin | ( |  | ) |

returns True if the constant is builtin

Code Flags:
  RET_VALUE_ONLY

Example:
  bool b = con.isBuiltin();

Exceptions

  PROGRAM-ERROR | thrown if the Program object holding the constant has been destroyed

## isClassConstant()

bool Qore::Reflection::AbstractConstant::isClassConstant | ( |  | ) |

returns True if the constant is a class constant

Code Flags:
  RET_VALUE_ONLY

Example:
  bool b = con.isClassConstant();

Returns
  True if the constant is a class constant

Exceptions

  PROGRAM-ERROR | thrown if the Program object holding the constant has been destroyed

## isEqual()

bool Qore::Reflection::AbstractConstant::isEqual | ( | AbstractConstant | con | ) |

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

Code Flags:
  CONSTANT

Example:
  bool b = con1.isEqual(con2);

Parameters

  con | the constant to check with the current object for equality

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

## isUser()

bool Qore::Reflection::AbstractConstant::isUser | ( |  | ) |

returns True if the constant is a user constant

Code Flags:
  RET_VALUE_ONLY

Example:
  bool b = con.isUser();

Exceptions

  PROGRAM-ERROR | thrown if the Program object holding the constant has been destroyed

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

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