Qore Programming Language  0.8.11.1
Public Member Functions | Friends | List of all members
QoreClass Class Reference

defines a Qore-language class More...

#include <QoreClass.h>

Public Member Functions

DLLEXPORT QoreClass (const char *n_name, int n_domain=QDOM_DEFAULT)
 creates the QoreClass object and assigns the name and the functional domain More...
 
DLLEXPORT QoreClass (const char *n_name, int64 n_domain, const QoreTypeInfo *n_typeInfo)
 creates the QoreClass object and assigns the name, the functional domain, and a custom QoreTypeInfo object created with AbstractQoreClassTypeInfoHelper More...
 
DLLEXPORT QoreClass (const QoreClass &old)
 copy constructor More...
 
DLLLOCAL QoreClass ()
 constructor not exported in library's API
 
DLLEXPORT ~QoreClass ()
 deletes the object and frees all memory
 
DLLEXPORT void addAbstractMethodVariantExtended3 (const char *n_name, bool priv=false, int64 n_flags=QC_NO_FLAGS, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds an unimplemented abstract method variant to the class with extended information; with return and parameter type info
 
DLLEXPORT void addBuiltinBaseClass (QoreClass *qc, QoreListNode *xargs=0)
 make a builtin class a child of another builtin class More...
 
DLLEXPORT void addBuiltinConstant (const char *name, AbstractQoreNode *value, bool priv=false, const QoreTypeInfo *typeInfo=0)
 adds a class constant to the class More...
 
DLLEXPORT void addBuiltinStaticVar (const char *name, AbstractQoreNode *value, bool priv=false, const QoreTypeInfo *typeInfo=0)
 adds a static variable to the class More...
 
DLLEXPORT void addBuiltinVirtualBaseClass (QoreClass *qc)
 sets "virtual" base class for a class, meaning that the base class data is appropriate for use in the subclass builtin methods More...
 
DLLEXPORT void addDefaultBuiltinBaseClass (QoreClass *qc, QoreListNode *xargs=0)
 make a builtin class a child of another builtin class and ensures that the given class' private data will be used in all class methods More...
 
DLLEXPORT void addMethod (const char *n_name, q_method_t meth, bool priv=false)
 adds a builtin method to a class More...
 
DLLEXPORT void addMethod2 (const char *n_name, q_method2_t meth, bool priv=false)
 adds a builtin method with the new generic calling convention
 
DLLEXPORT void addMethodExtended (const char *n_name, q_method_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin method with extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addMethodExtended (const char *n_name, q_method_int64_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin method with extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addMethodExtended2 (const char *n_name, q_method2_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin method with the new calling convention and extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addMethodExtended3 (const char *n_name, q_method_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin method with extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addMethodExtended3 (const char *n_name, q_method_int64_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin method with extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addMethodExtended3 (const char *n_name, q_method_bool_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin method with extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addMethodExtended3 (const char *n_name, q_method_double_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin method with extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addMethodExtendedList (const char *n_name, q_method_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, const type_vec_t &n_typeList=type_vec_t(), const arg_vec_t &defaultArgList=arg_vec_t())
 adds a builtin method with extended information; additional functional domain info, return and parameter type info from lists
 
DLLEXPORT void addMethodExtendedList2 (const char *n_name, q_method2_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, const type_vec_t &n_typeList=type_vec_t(), const arg_vec_t &defaultArgList=arg_vec_t())
 adds a builtin method with the new calling convention and extended information; additional functional domain info, return and parameter type info from lists
 
DLLEXPORT void addMethodExtendedList3 (const void *ptr, const char *n_name, q_method3_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, const type_vec_t &n_typeList=type_vec_t(), const arg_vec_t &defaultArgList=arg_vec_t())
 adds a builtin method with the even newer calling convention and extended information; additional functional domain info, return and parameter type info from lists More...
 
DLLEXPORT void addPrivateMember (const char *mem, const QoreTypeInfo *n_typeInfo, AbstractQoreNode *initial_value=0)
 adds a private member
 
DLLEXPORT void addPublicMember (const char *mem, const QoreTypeInfo *n_typeInfo, AbstractQoreNode *initial_value=0)
 adds a public member
 
DLLEXPORT void addStaticMethod (const char *n_name, q_func_t meth, bool priv=false)
 adds a builtin static method to a class More...
 
DLLEXPORT void addStaticMethod2 (const char *n_name, q_static_method2_t meth, bool priv=false)
 adds a builtin static method with the new generic calling convention
 
DLLEXPORT void addStaticMethodExtended (const char *n_name, q_func_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin static method with extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addStaticMethodExtended2 (const char *n_name, q_static_method2_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin static method with the new generic calling convention with extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addStaticMethodExtended3 (const char *n_name, q_func_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin static method with extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addStaticMethodExtended3 (const char *n_name, q_func_int64_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin static method with extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addStaticMethodExtended3 (const char *n_name, q_func_bool_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin static method with extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addStaticMethodExtended3 (const char *n_name, q_func_double_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin static method with extended information; additional functional domain info, return and parameter type info
 
DLLEXPORT void addStaticMethodExtendedList (const char *n_name, q_func_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, const type_vec_t &n_typeList=type_vec_t(), const arg_vec_t &defaultArgList=arg_vec_t())
 adds a builtin static method with extended information; additional functional domain info, return and parameter type info from lists
 
DLLEXPORT void addStaticMethodExtendedList2 (const char *n_name, q_static_method2_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, const type_vec_t &n_typeList=type_vec_t(), const arg_vec_t &defaultArgList=arg_vec_t())
 adds a builtin static method with the new generic calling convention with extended information; additional functional domain info, return and parameter type info from lists
 
DLLEXPORT void addStaticMethodExtendedList3 (const void *ptr, const char *n_name, q_static_method3_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, const type_vec_t &n_typeList=type_vec_t(), const arg_vec_t &defaultArgList=arg_vec_t())
 adds a builtin static method with the even newer generic calling convention with extended information; additional functional domain info, return and parameter type info from lists More...
 
DLLEXPORT QoreObjectexecConstructor (const QoreListNode *args, ExceptionSink *xsink) const
 creates a new object and executes the constructor on it and returns the new object More...
 
DLLEXPORT QoreObjectexecCopy (QoreObject *old, ExceptionSink *xsink) const
 executes a class' "copy" method on an object and returns the new object (or 0 in the case of an exception) More...
 
DLLEXPORT QoreObjectexecSystemConstructor (int code=0,...) const
 creates a new "system" object for use as the value of a constant, executes the system constructor on it and returns the new object More...
 
DLLEXPORT const QoreMethodfindLocalMethod (const char *name) const
 looks for a non-static method in the current class without searching base classes More...
 
DLLEXPORT const QoreMethodfindLocalStaticMethod (const char *name) const
 looks for a static method in the current class without searching base classes More...
 
DLLEXPORT const QoreMethodfindMethod (const char *nme) const
 finds a non-static method in the class hierarchy
 
DLLEXPORT const QoreMethodfindMethod (const char *nme, bool &priv) const
 finds a non-static method in the class hierarchy and sets the priv flag if it's a private method or not
 
DLLEXPORT const QoreMethodfindStaticMethod (const char *nme) const
 finds a static method in the class hierarchy
 
DLLEXPORT const QoreMethodfindStaticMethod (const char *nme, bool &priv) const
 finds a static method in the class hierarchy and sets the priv flag if it's a private method or not
 
DLLEXPORT const QoreExternalMethodVariant * findUserMethodVariant (const char *name, const QoreMethod *&method, const type_vec_t &argTypeList) const
 returns the user variant for the given non-static method and argument types More...
 
DLLEXPORT QoreClassgetClass (qore_classid_t cid) const
 returns a pointer to the QoreClass object representing the class ID passed if it exists in the class hierarchy More...
 
DLLEXPORT const QoreClassgetClass (qore_classid_t cid, bool &priv) const
 returns a pointer to the QoreClass object representing the class ID passed if it exists in the class hierarchy and sets a flag indicating if it's privately inherited or not More...
 
DLLEXPORT const QoreClassgetClass (const QoreClass &qc, bool &priv) const
 returns a pointer to the QoreClass object representing the class ID passed if it exists in the class hierarchy and sets a flag indicating if it's privately inherited or not More...
 
DLLEXPORT const QoreMethodgetConstructor () const
 returns a const pointer to the QoreMethod object of the constuctor method, if any is set More...
 
DLLEXPORT const QoreMethodgetCopyMethod () const
 returns a const pointer to the QoreMethod object of the destructor method, if any is set More...
 
DLLEXPORT const QoreMethodgetDestructor () const
 returns a const pointer to the QoreMethod object of the constructor method, if any is set More...
 
DLLEXPORT int getDomain () const
 returns the functional domain of the class More...
 
DLLEXPORT int64 getDomain64 () const
 returns the functional domain of the class More...
 
DLLEXPORT qore_classid_t getID () const
 returns the class ID of this class
 
DLLEXPORT const QoreMethodgetMemberGateMethod () const
 returns a const pointer to the QoreMethod object of the memberGate method, if any is set More...
 
DLLEXPORT const QoreMethodgetMemberNotificationMethod () const
 returns a const pointer to the QoreMethod object of the memberNotification method, if any is set More...
 
DLLEXPORT const QoreMethodgetMethodGate () const
 returns a const pointer to the QoreMethod object of the methodGate method, if any is set More...
 
DLLEXPORT QoreListNodegetMethodList () const
 returns a list strings of all non-static methods in the class, the caller owns the reference count returned More...
 
DLLEXPORT const char * getName () const
 returns the class name
 
DLLEXPORT const QoreTypeInfo * getOrNothingTypeInfo () const
 returns the "or nothing" type information structure for this class
 
DLLEXPORT QoreListNodegetStaticMethodList () const
 returns a list strings of all static methods in the class, the caller owns the reference count returned More...
 
DLLEXPORT const QoreMethodgetSystemConstructor () const
 returns a const pointer to the QoreMethod object of the constuctor method, if any is set More...
 
DLLEXPORT const QoreTypeInfo * getTypeInfo () const
 returns the type information structure for this class
 
DLLEXPORT const void * getUserData () const
 retrieves the user-specific data pointer
 
DLLEXPORT bool hasAbstract () const
 returns true if the class has at least one abstract method variant More...
 
DLLEXPORT bool hasCopy () const
 returns true if the class implements a copy method
 
DLLEXPORT bool hasMemberGate () const
 returns true if the class implements a "memberGate" method
 
DLLEXPORT bool hasMemberNotification () const
 returns true if the class implements a "memberNotification" method
 
DLLEXPORT bool hasMethodGate () const
 returns true if the class implements a "methodGate" method
 
DLLEXPORT bool isPrivateMember (const char *str) const
 returns true if the member is private More...
 
DLLEXPORT bool isPublicOrPrivateMember (const char *str, bool &priv) const
 returns true if the member is private or public More...
 
DLLEXPORT bool isSystem () const
 returns true if the class is a builtin class
 
DLLEXPORT int numMethods () const
 returns the number of non-static methods in this class (user and builtin)
 
DLLEXPORT int numStaticMethods () const
 returns the number of static methods in this class (user and builtin)
 
DLLEXPORT int numStaticUserMethods () const
 returns the number of static user methods in this class
 
DLLEXPORT int numUserMethods () const
 returns the number of non-static user methods in this class
 
DLLEXPORT void recheckBuiltinMethodHierarchy ()
 rechecks for inherited methods in base classes when adding builtin classes
 
DLLEXPORT void setConstructor (q_constructor_t m)
 sets the builtin constructor method for the class (or adds an overloaded variant) More...
 
DLLEXPORT void setConstructor2 (q_constructor2_t m)
 sets the builtin constructor method for the class using the new calling convention (or adds an overloaded variant) More...
 
DLLEXPORT void setConstructorExtended (q_constructor_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, unsigned num_params=0,...)
 sets the constructor method with extended information; can set a private constructor, set additional functional domain info, and parameter type info (or adds an overloaded variant)
 
DLLEXPORT void setConstructorExtended2 (q_constructor2_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, unsigned num_params=0,...)
 sets the constructor method using the new calling convention with extended information; can set a private constructor, set additional functional domain info, and parameter type info (or adds an overloaded variant)
 
DLLEXPORT void setConstructorExtended3 (q_constructor_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, unsigned num_params=0,...)
 sets the constructor method with extended information; can set a private constructor, set additional functional domain info, and parameter type info (or adds an overloaded variant)
 
DLLEXPORT void setConstructorExtendedList (q_constructor_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const type_vec_t &n_typeList=type_vec_t(), const arg_vec_t &defaultArgList=arg_vec_t())
 sets the constructor method with extended information; can set a private constructor, set additional functional domain info, and parameter type info from lists (or adds an overloaded variant)
 
DLLEXPORT void setConstructorExtendedList2 (q_constructor2_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const type_vec_t &n_typeList=type_vec_t(), const arg_vec_t &defaultArgList=arg_vec_t())
 sets the constructor method using the new calling convention with extended information; can set a private constructor, set additional functional domain info, and parameter type info from lists (or adds an overloaded variant)
 
DLLEXPORT void setConstructorExtendedList3 (const void *ptr, q_constructor3_t meth, bool priv=false, int64 n_flags=QC_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const type_vec_t &n_typeList=type_vec_t(), const arg_vec_t &defaultArgList=arg_vec_t())
 sets the constructor method using the new calling convention with extended information; can set a private constructor, set additional functional domain info, and parameter type info from lists (or adds an overloaded variant) More...
 
DLLEXPORT void setCopy (q_copy_t m)
 sets the builtin copy method for the class More...
 
DLLEXPORT void setCopy2 (q_copy2_t m)
 sets the builtin copy method for the class using the new generic calling convention More...
 
DLLEXPORT void setCopy3 (const void *ptr, q_copy3_t m)
 sets the builtin copy method for the class using the new generic calling convention More...
 
DLLEXPORT void setDeleteBlocker (q_delete_blocker_t m)
 sets the deleteBlocker method for the class More...
 
DLLEXPORT void setDestructor (q_destructor_t m)
 sets the builtin destructor method for the class More...
 
DLLEXPORT void setDestructor2 (q_destructor2_t m)
 sets the builtin destructor method for the class with the new generic calling convention More...
 
DLLEXPORT void setDestructor3 (const void *ptr, q_destructor3_t m)
 sets the builtin destructor method for the class with the new generic calling convention More...
 
DLLEXPORT void setSynchronousClass ()
 call this function if your builtin class requires *all* methods (except the constructor) to be run in an RMutex lock More...
 
DLLEXPORT void setSystemConstructor (q_system_constructor_t m)
 sets the builtin constructor for system objects (ex: used as constant values) More...
 
DLLEXPORT void setSystemConstructor2 (q_system_constructor2_t m)
 sets the builtin constructor for system objects (ex: used as constant values) using the new calling convention More...
 
DLLEXPORT void setUserData (const void *ptr)
 sets a pointer to user-specific data in the class
 

Friends

class QoreMethodIterator
 
class QoreObject
 
class QoreStaticMethodIterator
 

Detailed Description

defines a Qore-language class

Qore's classes can be either implemented by Qore language code (user classes) or in C++ (builtin classes), or both, as in the case of a builtin class that also has user methods.

Constructor & Destructor Documentation

DLLEXPORT QoreClass::QoreClass ( const char *  n_name,
int  n_domain = QDOM_DEFAULT 
)

creates the QoreClass object and assigns the name and the functional domain

Note
class names and subnamespaces names must be unique in a namespace; i.e. no class may have the same name as a subnamespace within a namespace and vice-versa
Parameters
n_namethe name of the class
n_domainthe functional domain of the class to be used to enforce functional restrictions within a Program object
See also
QoreProgram
DLLEXPORT QoreClass::QoreClass ( const char *  n_name,
int64  n_domain,
const QoreTypeInfo *  n_typeInfo 
)

creates the QoreClass object and assigns the name, the functional domain, and a custom QoreTypeInfo object created with AbstractQoreClassTypeInfoHelper

Note
class names and subnamespaces names must be unique in a namespace; i.e. no class may have the same name as a subnamespace within a namespace and vice-versa
Parameters
n_namethe name of the class
n_domainthe functional domain of the class to be used to enforce functional restrictions within a Program object
n_typeInfothe custom QoreTypeInfo object created with AbstractQoreClassTypeInfoHelper
See also
QoreProgram
AbstractQoreClassTypeInfoHelper
DLLEXPORT QoreClass::QoreClass ( const QoreClass old)

copy constructor

should be only called under the appropriate lock (ex: program parse lock while parsing)

Member Function Documentation

DLLEXPORT void QoreClass::addBuiltinBaseClass ( QoreClass qc,
QoreListNode xargs = 0 
)

make a builtin class a child of another builtin class

the xargs argument must not be used; before qore supported function overloading, base class arguments could be given here

Parameters
qcthe base class to add
xargsDEPRECATED must be 0; do not use
DLLEXPORT void QoreClass::addBuiltinConstant ( const char *  name,
AbstractQoreNode value,
bool  priv = false,
const QoreTypeInfo *  typeInfo = 0 
)

adds a class constant to the class

Parameters
namethe name of the constant; cannot be the same as the name of a static variable
valuethe value of the constant
privtrue if private, false if public
typeInfoonly need to set if the value assigned to the constant is not an internally-defined type and therefore the type info cannot be automatically determined, otherwise this parameter may be passed as NULL, in which case the type info will be automatically determined
DLLEXPORT void QoreClass::addBuiltinStaticVar ( const char *  name,
AbstractQoreNode value,
bool  priv = false,
const QoreTypeInfo *  typeInfo = 0 
)

adds a static variable to the class

Parameters
namethe name of the static variable; cannot be the same as the name of a class constant
valuethe initial of the static variable
privtrue if private, false if public
typeInfoonly need to set if the initial value assigned to the static variable (as given by the 'value' parameter) is not an internally-defined type and therefore the type info cannot be automatically determined, otherwise this parameter may be passed as NULL, in which case the type info will be automatically determined
DLLEXPORT void QoreClass::addBuiltinVirtualBaseClass ( QoreClass qc)

sets "virtual" base class for a class, meaning that the base class data is appropriate for use in the subclass builtin methods

this method adds a base class placeholder for a subclass - where the subclass' private data object is actually a subclass of the parent class and all methods are virtual, so the base class' constructor, destructor, and copy constructor will never be run and the base class methods will be passed a pointer to the subclass' data

Parameters
qcthe base class to add
DLLEXPORT void QoreClass::addDefaultBuiltinBaseClass ( QoreClass qc,
QoreListNode xargs = 0 
)

make a builtin class a child of another builtin class and ensures that the given class' private data will be used in all class methods

In the case this function is used, this objects of class cannot have private data saved against the class ID. The xargs argument must not be used; before qore supported function overloading, base class arguments could be given here

Parameters
qcthe base class to add
xargsDEPRECATED must be 0; do not use
DLLEXPORT void QoreClass::addMethod ( const char *  n_name,
q_method_t  meth,
bool  priv = false 
)

adds a builtin method to a class

in debuggging mode, the call will abort if the name of the method is "constructor", "destructor", or "copy", or if the method already exists in the class. To set the constructor method, call QoreClass::setConstructor(). To set the destructor method, call QoreClass::setDestructor(). To set the copy method, call QoreClass::setCopy().

Parameters
n_namethe name of the method, must be unique in the class
meththe method to be added
privif true then the variant will be added as a private variant
// the actual function can be declared with the class to be expected as the private data as follows:
static AbstractQoreNode *AL_lock(QoreObject *self, QoreAutoLock *m, const QoreListNode *params, ExceptionSink *xsink);
...
// and then casted to (q_method_t) in the addMethod call:
QC_AutoLock->addMethod("lock", (q_method_t)AL_lock);
See also
Qoreclass::addStaticMethod()
QoreClass::setConstructor()
QoreClass::setDestructor()
QoreClass::setCopy()
DLLEXPORT void QoreClass::addMethodExtendedList3 ( const void *  ptr,
const char *  n_name,
q_method3_t  meth,
bool  priv = false,
int64  n_flags = QC_NO_FLAGS,
int64  n_domain = QDOM_DEFAULT,
const QoreTypeInfo *  returnTypeInfo = 0,
const type_vec_t n_typeList = type_vec_t(),
const arg_vec_t defaultArgList = arg_vec_t() 
)

adds a builtin method with the even newer calling convention and extended information; additional functional domain info, return and parameter type info from lists

Parameters
ptra pointer to user-defined data that will be passed to the method function when it is called
n_namethe name of the method to add the variant to
meththe function pointer of the code to call
n_flagsflags for the code being added
privif true then the variant will be added as a private variant
n_domainthe functional domain of the class to be used to enforce functional restrictions within a Program object
returnTypeInfothe type of value returned by the variant
n_typeLista list of type information for parameters to the variant
defaultArgLista list of default arguments to each parameter
DLLEXPORT void QoreClass::addStaticMethod ( const char *  n_name,
q_func_t  meth,
bool  priv = false 
)

adds a builtin static method to a class

Parameters
n_namethe name of the method, must be unique in the class
meththe method to be added
privif true then the method will be added as a private method
DLLEXPORT void QoreClass::addStaticMethodExtendedList3 ( const void *  ptr,
const char *  n_name,
q_static_method3_t  meth,
bool  priv = false,
int64  n_flags = QC_NO_FLAGS,
int64  n_domain = QDOM_DEFAULT,
const QoreTypeInfo *  returnTypeInfo = 0,
const type_vec_t n_typeList = type_vec_t(),
const arg_vec_t defaultArgList = arg_vec_t() 
)

adds a builtin static method with the even newer generic calling convention with extended information; additional functional domain info, return and parameter type info from lists

Parameters
ptra pointer to user-defined data that will be passed to the method function when it is called
n_namethe name of the method to add the variant to
meththe function pointer of the code to call
privif true then the variant will be added as a private variant
n_flagsflags for the code being added
n_domainthe functional domain of the class to be used to enforce functional restrictions within a Program object
returnTypeInfothe type of value returned by the variant
n_typeLista list of type information for parameters to the variant
defaultArgLista list of default arguments to each parameter
DLLEXPORT QoreObject* QoreClass::execConstructor ( const QoreListNode args,
ExceptionSink xsink 
) const

creates a new object and executes the constructor on it and returns the new object

if a Qore-language exception occurs, 0 is returned.

Parameters
argsthe arguments for the method
xsinkQore-language exception information is added here
Returns
the object created
DLLEXPORT QoreObject* QoreClass::execCopy ( QoreObject old,
ExceptionSink xsink 
) const

executes a class' "copy" method on an object and returns the new object (or 0 in the case of an exception)

Parameters
oldthe original object to copy
xsinkQore-language exception information is added here
Returns
the object created
DLLEXPORT QoreObject* QoreClass::execSystemConstructor ( int  code = 0,
  ... 
) const

creates a new "system" object for use as the value of a constant, executes the system constructor on it and returns the new object

if a Qore-language exception occurs, 0 is returned

Parameters
codean optional code for the constructor; this parameter is here because passing a variable number of arguments requires at least one fixed parameter before the (possibly empty) list
Returns
the object created
DLLEXPORT const QoreMethod* QoreClass::findLocalMethod ( const char *  name) const

looks for a non-static method in the current class without searching base classes

not thread-safe with parsing operations; do not call this function while new code is being parsed into the class

Parameters
namethe name of the method
Returns
a pointer to the method found, or 0 if no such method exists in the class
DLLEXPORT const QoreMethod* QoreClass::findLocalStaticMethod ( const char *  name) const

looks for a static method in the current class without searching base classes

not thread-safe with parsing operations; do not call this function while new code is being parsed into the class

Parameters
namethe name of the static method
Returns
a pointer to the method found, or 0 if no such method exists in the class
DLLEXPORT const QoreExternalMethodVariant* QoreClass::findUserMethodVariant ( const char *  name,
const QoreMethod *&  method,
const type_vec_t argTypeList 
) const

returns the user variant for the given non-static method and argument types

argTypeList must have a non-null value for each type in the list

DLLEXPORT QoreClass* QoreClass::getClass ( qore_classid_t  cid) const

returns a pointer to the QoreClass object representing the class ID passed if it exists in the class hierarchy

if the class ID is equal to the current class or is a base class of the current class, the appropriate QoreClass pointer will be returned. Do not delete or change the QoreClass* returned if non-null. FIXME: should return const QoreClass*, fix in next update

Parameters
cidthe class ID of the QoreClass to find
Returns
a pointer to the QoreClass object representing the class ID passed if it exists in the class hierarchy
DLLEXPORT const QoreClass* QoreClass::getClass ( qore_classid_t  cid,
bool &  priv 
) const

returns a pointer to the QoreClass object representing the class ID passed if it exists in the class hierarchy and sets a flag indicating if it's privately inherited or not

if the class ID is equal to the current class or is a base class of the current class, the appropriate QoreClass pointer will be returned.

Parameters
cidthe class ID of the QoreClass to find
priva flag indicating if the class is privately inherited or not
Returns
a pointer to the QoreClass object representing the class ID passed if it exists in the class hierarchy
DLLEXPORT const QoreClass* QoreClass::getClass ( const QoreClass qc,
bool &  priv 
) const

returns a pointer to the QoreClass object representing the class ID passed if it exists in the class hierarchy and sets a flag indicating if it's privately inherited or not

if the class ID is equal to the current class or is a base class of the current class, the appropriate QoreClass pointer will be returned.

Parameters
qcthe class to check the hierarchy for
priva flag indicating if the class is privately inherited or not
Returns
a pointer to the QoreClass object corresponding to the class passed if it exists in the class hierarchy; in the case that the passed class if from a different QoreProgram object, the value returned could be a different pointer to the qc parameter passed
DLLEXPORT const QoreMethod* QoreClass::getConstructor ( ) const

returns a const pointer to the QoreMethod object of the constuctor method, if any is set

executes in constant time

Returns
a const pointer to the QoreMethod object of the constuctor method, if any is set
DLLEXPORT const QoreMethod* QoreClass::getCopyMethod ( ) const

returns a const pointer to the QoreMethod object of the destructor method, if any is set

executes in constant time

Returns
a const pointer to the QoreMethod object of the destructor method, if any is set
DLLEXPORT const QoreMethod* QoreClass::getDestructor ( ) const

returns a const pointer to the QoreMethod object of the constructor method, if any is set

executes in constant time

Returns
a const pointer to the QoreMethod object of the constructor method, if any is set
DLLEXPORT int QoreClass::getDomain ( ) const

returns the functional domain of the class

DEPRECATED: use getDomain64() instead

DLLEXPORT int64 QoreClass::getDomain64 ( ) const

returns the functional domain of the class

added in qore 0.8.0

DLLEXPORT const QoreMethod* QoreClass::getMemberGateMethod ( ) const

returns a const pointer to the QoreMethod object of the memberGate method, if any is set

executes in constant time

Returns
a const pointer to the QoreMethod object of the memberGate method, if any is set
DLLEXPORT const QoreMethod* QoreClass::getMemberNotificationMethod ( ) const

returns a const pointer to the QoreMethod object of the memberNotification method, if any is set

executes in constant time

Returns
a const pointer to the QoreMethod object of the memberNotification method, if any is set
DLLEXPORT const QoreMethod* QoreClass::getMethodGate ( ) const

returns a const pointer to the QoreMethod object of the methodGate method, if any is set

executes in constant time

Returns
a const pointer to the QoreMethod object of the methodGate method, if any is set
DLLEXPORT QoreListNode* QoreClass::getMethodList ( ) const

returns a list strings of all non-static methods in the class, the caller owns the reference count returned

always returns a list; if there are no non-static methods then an empty list is returned

Returns
a list strings of all non-static methods in the class, the caller owns the reference count returned
DLLEXPORT QoreListNode* QoreClass::getStaticMethodList ( ) const

returns a list strings of all static methods in the class, the caller owns the reference count returned

always returns a list; if there are no static methods then an empty list is returned

Returns
a list strings of all static methods in the class, the caller owns the reference count returned
DLLEXPORT const QoreMethod* QoreClass::getSystemConstructor ( ) const

returns a const pointer to the QoreMethod object of the constuctor method, if any is set

executes in constant time

Returns
a const pointer to the QoreMethod object of the constuctor method, if any is set
DLLEXPORT bool QoreClass::hasAbstract ( ) const

returns true if the class has at least one abstract method variant

Returns
true if the class has at least one abstract method variant
DLLEXPORT bool QoreClass::isPrivateMember ( const char *  str) const

returns true if the member is private

Parameters
strthe member name to check
Returns
true if the member is private
DLLEXPORT bool QoreClass::isPublicOrPrivateMember ( const char *  str,
bool &  priv 
) const

returns true if the member is private or public

Parameters
strthe member name to check
privtrue if the member is private, false if public
Returns
true if the member is private
DLLEXPORT void QoreClass::setConstructor ( q_constructor_t  m)

sets the builtin constructor method for the class (or adds an overloaded variant)

Parameters
mthe constructor method
DLLEXPORT void QoreClass::setConstructor2 ( q_constructor2_t  m)

sets the builtin constructor method for the class using the new calling convention (or adds an overloaded variant)

Parameters
mthe constructor method
DLLEXPORT void QoreClass::setConstructorExtendedList3 ( const void *  ptr,
q_constructor3_t  meth,
bool  priv = false,
int64  n_flags = QC_NO_FLAGS,
int64  n_domain = QDOM_DEFAULT,
const type_vec_t n_typeList = type_vec_t(),
const arg_vec_t defaultArgList = arg_vec_t() 
)

sets the constructor method using the new calling convention with extended information; can set a private constructor, set additional functional domain info, and parameter type info from lists (or adds an overloaded variant)

Parameters
ptra pointer to user-defined data that will be passed to the method function when it is called
meththe function pointer of the code to call
privif true then the variant will be added as a private variant
n_flagsflags for the code being added
n_domainthe functional domain of the class to be used to enforce functional restrictions within a Program object
n_typeLista list of type information for parameters to the variant
defaultArgLista list of default arguments to each parameter
DLLEXPORT void QoreClass::setCopy ( q_copy_t  m)

sets the builtin copy method for the class

copy methods should either call QoreObject::setPrivate() or call xsink->raiseException() (but should not do both)

Parameters
mthe copy method to set
// the actual function can be declared with the class to be expected as the private data as follows:
static void AL_copy(QoreObject *self, QoreObject *old, class QoreAutoLock *m, ExceptionSink *xsink)
...
// and then casted to (q_copy_t) in the addMethod call:
QC_AutoLock->setCopy((q_copy_t)AL_copy);
DLLEXPORT void QoreClass::setCopy2 ( q_copy2_t  m)

sets the builtin copy method for the class using the new generic calling convention

copy methods should either call QoreObject::setPrivate() or call xsink->raiseException() (but should not do both)

Parameters
mthe copy method to set
// the actual function can be declared with the class to be expected as the private data as follows:
static void AL_copy(const QoreClass &thisclass, QoreObject *self, QoreObject *old, QoreAutoLock *m, ExceptionSink *xsink)
...
// and then casted to (q_copy2_t) in the addMethod call:
QC_AutoLock->setCopy((q_copy2_t)AL_copy);
DLLEXPORT void QoreClass::setCopy3 ( const void *  ptr,
q_copy3_t  m 
)

sets the builtin copy method for the class using the new generic calling convention

copy methods should either call QoreObject::setPrivate() or call xsink->raiseException() (but should not do both)

Parameters
ptruser-defined data that will be passed to the destructor when it's called
mthe copy method to set
// the actual function can be declared with the class to be expected as the private data as follows:
static void AL_copy(const QoreClass &thisclass, QoreObject *self, QoreObject *old, QoreAutoLock *m, ExceptionSink *xsink)
...
// and then casted to (q_copy2_t) in the addMethod call:
QC_AutoLock->setCopy((q_copy2_t)AL_copy);
DLLEXPORT void QoreClass::setDeleteBlocker ( q_delete_blocker_t  m)

sets the deleteBlocker method for the class

this method will be run when the object is deleted; it should be set only for classes where the objects' lifecycles are or may be managed externally. This function must be called before this class is added as a parent class to any other class; if it is called classes have added this class as a parent class, then the child classes will not have their delete blocker flag set.

Parameters
mthe deleteBlocker method to set
Note
delete blocker methods are called with the object's status lock held, therefore be very careful what you call from within the deleteBlocker function
DLLEXPORT void QoreClass::setDestructor ( q_destructor_t  m)

sets the builtin destructor method for the class

you only need to implement destructor methods if the destructor should destroy the object before the reference count reaches zero.

Parameters
mthe destructor method to run
// the actual function can be declared with the class to be expected as the private data as follows:
static void AL_destructor(QoreObject *self, QoreAutoLock *al, ExceptionSink *xsink);
...
// and then casted to (q_destructor_t) in the addMethod call:
QC_AutoLock->setDestructor((q_destructor_t)AL_destructor);
DLLEXPORT void QoreClass::setDestructor2 ( q_destructor2_t  m)

sets the builtin destructor method for the class with the new generic calling convention

you only need to implement destructor methods if the destructor should destroy the object before the reference count reaches zero.

Parameters
mthe destructor method to run
// the actual function can be declared with the class to be expected as the private data as follows:
static void AL_destructor(const QoreClass &thisclass, QoreObject *self, QoreAutoLock *al, ExceptionSink *xsink);
...
// and then casted to (q_destructor_t) in the addMethod call:
QC_AutoLock->setDestructor2((q_destructor_t)AL_destructor);
DLLEXPORT void QoreClass::setDestructor3 ( const void *  ptr,
q_destructor3_t  m 
)

sets the builtin destructor method for the class with the new generic calling convention

you only need to implement destructor methods if the destructor should destroy the object before the reference count reaches zero.

Parameters
ptruser-defined data that will be passed to the destructor when it's called
mthe destructor method to run
// the actual function can be declared with the class to be expected as the private data as follows:
static void AL_destructor(const QoreClass &thisclass, QoreObject *self, QoreAutoLock *al, ExceptionSink *xsink);
...
// and then casted to (q_destructor_t) in the addMethod call:
QC_AutoLock->setDestructor2((q_destructor_t)AL_destructor);
DLLEXPORT void QoreClass::setSynchronousClass ( )

call this function if your builtin class requires *all* methods (except the constructor) to be run in an RMutex lock

use this for classes that require exclusive access to the private data in all functions

DLLEXPORT void QoreClass::setSystemConstructor ( q_system_constructor_t  m)

sets the builtin constructor for system objects (ex: used as constant values)

Note
system constructors in a class hierarchy must call the base class constructors manually
Parameters
mthe constructor method
DLLEXPORT void QoreClass::setSystemConstructor2 ( q_system_constructor2_t  m)

sets the builtin constructor for system objects (ex: used as constant values) using the new calling convention

Note
system constructors in a class hierarchy must call the base class constructors manually
Parameters
mthe constructor method

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