Qore Programming Language  1.7.0
QoreClass Class Reference

defines a Qore-language class More...

#include <QoreClass.h>

Inheritance diagram for QoreClass:

Public Member Methods

DLLEXPORT QoreClass (const char *n_name, const char *ns_path, 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 char *n_name, const char *ns_path, int64 n_domain=QDOM_DEFAULT)
 creates the QoreClass object and assigns the name and the functional domain More...
 
DLLEXPORT QoreClass (const QoreClass &old)
 copy constructor More...
 
DLLEXPORT QoreClass (std::string &&n_name, std::string &&ns_path, int64 n_domain=QDOM_DEFAULT)
 creates the QoreClass object and assigns the name and the functional domain More...
 
DLLEXPORT void addAbstractMethod (const char *n_name, ClassAccess access, int64 n_flags, const QoreTypeInfo *returnTypeInfo, const type_vec_t &n_typeList, const arg_vec_t &defaultArgList=arg_vec_t(), const name_vec_t &n_names=name_vec_t())
 adds an unimplemented abstract method variant to the class with return and parameter type info
 
DLLEXPORT void addAbstractMethod (const char *n_name, ClassAccess access=Public, int64 n_flags=QCF_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 addBaseClass (QoreClass *qc, bool virt=false)
 Adds a base class to the current class. More...
 
DLLEXPORT void addBuiltinBaseClass (QoreClass *qc)
 make a builtin class a child of another builtin class More...
 
DLLEXPORT void addBuiltinConstant (const char *name, QoreValue value, ClassAccess access=Public, const QoreTypeInfo *typeInfo=nullptr)
 adds a class constant to the class More...
 
DLLEXPORT void addBuiltinStaticVar (const char *name, QoreValue value, ClassAccess access=Public, const QoreTypeInfo *typeInfo=nullptr)
 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 addConstructor (const void *ptr, q_external_constructor_t meth, ClassAccess access=Public, int64 n_flags=QCF_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const type_vec_t &n_typeList=type_vec_t(), const arg_vec_t &defaultArgList=arg_vec_t(), const name_vec_t &n_names=name_vec_t())
 adds a constructor method variant with the external calling convention and includes the access specifier, additional functional domain info, and parameter type info More...
 
DLLEXPORT void addConstructor (q_constructor_n_t meth, ClassAccess access=Public, int64 n_flags=QCF_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, unsigned num_params=0,...)
 adds a constructor method variant with the access specifier, additional functional domain info, and parameter type info
 
DLLEXPORT void addDefaultBuiltinBaseClass (QoreClass *qc)
 make a builtin class a child of another builtin class and ensures that the given class's private data will be used in all class methods More...
 
DLLEXPORT void addMember (const char *mem, ClassAccess access, const QoreTypeInfo *n_typeInfo, QoreValue initial_value=QoreValue())
 adds a member
 
DLLEXPORT void addMethod (const char *n_name, q_method_n_t meth, ClassAccess access=Public, int64 n_flags=QCF_NO_FLAGS, int64 n_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
 adds a builtin method variant to a class More...
 
DLLEXPORT void addMethod (const void *ptr, const char *n_name, q_external_method_t meth, ClassAccess access=Public, int64 n_flags=QCF_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(), const name_vec_t &n_names=name_vec_t())
 adds a builtin method variant to a class with the calling convention for external modules More...
 
DLLEXPORT void addStaticMethod (const char *n_name, q_func_n_t meth, ClassAccess access=Public, int64 n_flags=QCF_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 addStaticMethod (const void *ptr, const char *n_name, q_external_static_method_t meth, ClassAccess access=Public, int64 n_flags=QCF_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(), const name_vec_t &n_names=name_vec_t())
 adds a builtin static method with extended information; additional functional domain info, return and parameter type info More...
 
virtual DLLEXPORT QoreClasscopy ()
 Called when a class is copied. More...
 
virtual DLLEXPORT QoreClasscopyImport ()
 Called when a class is copied for import. More...
 
DLLEXPORT QoreValue evalPseudoMethod (const QoreMethod *m, const QoreExternalMethodVariant *variant, const QoreValue n, const QoreListNode *args, ExceptionSink *xsink) const
 evaluates a pseudo-method on a pseudo-class More...
 
DLLEXPORT QoreValue evalPseudoMethod (const QoreValue n, const char *nme, const QoreListNode *args, ExceptionSink *xsink) const
 evaluates a pseudo-method on a pseudo-class More...
 
DLLEXPORT QoreObjectexecConstructor (const QoreClass &obj_cls, const QoreListNode *args, bool allow_abstract, ExceptionSink *xsink) const
 Creates a new object and executes the constructor and returns the new object. 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 QoreObjectexecConstructorVariant (const QoreExternalMethodVariant *mv, 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's "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 QoreExternalConstantfindConstant (const char *name) const
 Finds the given constant or returns nullptr if not found. More...
 
DLLEXPORT const QoreExternalNormalMemberfindLocalMember (const char *name) const
 Finds the given local member or returns nullptr. More...
 
DLLEXPORT const QoreMethodfindLocalMethod (const char *name) const
 finds a normal (non-static) method in the class hierarchy More...
 
DLLEXPORT const QoreExternalStaticMemberfindLocalStaticMember (const char *name) const
 Finds the given local static member or returns nullptr. More...
 
DLLEXPORT const QoreMethodfindLocalStaticMethod (const char *name) const
 finds a static method in the class hierarchy More...
 
DLLEXPORT const QoreMethodfindMethod (const char *nme) const
 finds a normal (non-static) method in the class hierarchy More...
 
DLLEXPORT const QoreMethodfindMethod (const char *nme, ClassAccess &access) const
 finds a normal (non-static) method in the class hierarchy at runtime and sets the access code More...
 
DLLEXPORT const QoreMethodfindStaticMethod (const char *nme) const
 finds a static method in the class hierarchy More...
 
DLLEXPORT const QoreMethodfindStaticMethod (const char *nme, ClassAccess &access) const
 finds a static method in the class hierarchy and sets the priv flag if it's a private method or not More...
 
DLLEXPORT const QoreExternalMethodVariantfindUserMethodVariant (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 BinaryNodegetBinaryHash () const
 returns a binary hash for the class's API 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 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 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 q_deserializer_t getDeserializer () const
 returns the deserializer method or nullptr if not present More...
 
DLLEXPORT const QoreMethodgetDestructor () const
 returns a const pointer to the QoreMethod object of the constructor method, if any is set More...
 
DLLEXPORT int64 getDomain () const
 returns the functional domain of the class More...
 
DLLEXPORT qore_classid_t getID () const
 returns the class ID of this class
 
DLLEXPORT QoreClassgetInjectedAsClass ()
 returns the class pointer for any injection target class if this class was injected, otherwise nullptr More...
 
DLLEXPORT const QoreClassgetInjectedAsClass () const
 returns the class pointer for any injection target class if this class was injected, otherwise nullptr More...
 
DLLEXPORT const char * getLanguage () const
 Returns the language this class is written in. More...
 
DLLEXPORT AbstractQoreClassUserDatagetManagedUserData () const
 retrieves the user-specific data pointer More...
 
template<typename T >
DLLLOCAL T * getManagedUserData () const
 retrieves the user-specific data pointer More...
 
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 * getModuleName () const
 Returns the module name the class was loaded from or nullptr if it is a builtin class. More...
 
DLLEXPORT const char * getName () const
 returns the class name
 
DLLEXPORT const QoreNamespacegetNamespace () const
 Returns the namespace that owns this class. More...
 
DLLEXPORT std::string getNamespacePath (bool anchored=false) const
 returns the full namespace path of the class More...
 
DLLEXPORT const QoreTypeInfo * getOrNothingTypeInfo () const
 returns the "or nothing" type information structure for this class
 
DLLEXPORT const char * getPath () const
 Returns the root-justified namespace path of the class including the class name. More...
 
DLLEXPORT QoreProgramgetProgram () const
 Returns the owning QoreProgram object (if not the static system namespace) More...
 
DLLEXPORT qore_type_t getPseudoClassType () const
 returns a pseudo-classes base type More...
 
DLLEXPORT QoreValue getReferencedKeyValue (const char *key) const
 Returns a referenced key value from the class's key-value store. More...
 
DLLEXPORT QoreValue getReferencedKeyValue (const std::string &key) const
 Returns a referenced key value from the class's key-value store. More...
 
DLLEXPORT bool getRelaxedAbstractMatch () const
 Returns the relaxed abstract matching flag. More...
 
DLLEXPORT q_serializer_t getSerializer () const
 returns the serializer method or nullptr if not present More...
 
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 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 hasParentClass () const
 returns true if the class has one or more parent classes
 
DLLEXPORT bool hasPublicMembersInHierarchy () const
 returns true if the class has any publicly-declared members
 
DLLEXPORT bool hasTransientMember () const
 Returns true if the class has at least one locally-declared transient member. More...
 
DLLEXPORT bool inHierarchy (const QoreClass &cls, ClassAccess &n_access) const
 Returns true if the class passed as an argument is present in the current class's hierachy, even if not accessible from the class due to private:internal inheritance. More...
 
DLLEXPORT bool inHierarchyStrict (const QoreClass &cls, ClassAccess &n_access) const
 Returns true if the class passed as an argument is present in the current class's hierachy, even if not accessible from the class due to private:internal inheritance; does not check injected compatibility. More...
 
DLLEXPORT bool isAbstract () const
 returns true if the class has at least one unimplemented abstract method variant More...
 
DLLEXPORT bool isEqual (const QoreClass &cls) const
 returns true if the classes are equal More...
 
DLLEXPORT bool isFinal () const
 returns true if the class is final More...
 
DLLEXPORT bool isInjected () const
 returns true if the class has been injected as a dependency injection More...
 
DLLEXPORT bool isModulePublic () const
 returns true if the class has its module public flag set More...
 
DLLEXPORT bool isPrivateMember (const char *str) const
 returns true if the member is private More...
 
DLLEXPORT bool isPseudoClass () const
 returns true if the class is a pseudo class 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 rescanParents ()
 rescan builtin parent classes in a class hierarchy; to be used with out-of-order class hierarchy construction More...
 
DLLEXPORT int runtimeCheckInstantiateClass (ExceptionSink *xsink) const
 Throws a Qore-language exception if the class cannot be instantiated. More...
 
DLLEXPORT void setCopy (const void *ptr, q_external_copy_t m)
 sets the builtin copy method for the class using the new generic calling convention More...
 
DLLEXPORT void setCopy (q_copy_t m)
 sets the builtin copy method for the class More...
 
DLLEXPORT void setDeserializer (q_deserializer_t m)
 sets the deserializer method for builtin classes More...
 
DLLEXPORT void setDestructor (const void *ptr, q_external_destructor_t m)
 sets the builtin destructor method for the class with the external calling convention More...
 
DLLEXPORT void setDestructor (q_destructor_t m)
 sets the builtin destructor method for the class More...
 
DLLEXPORT void setFinal ()
 sets the final flag of the class
 
DLLEXPORT void setGateAccessFlag ()
 sets the class's gate access flag so that memberGate() and methodGate() methods will be called with an extra boolean argument giving the current class access before the call More...
 
DLLEXPORT QoreValue setKeyValue (const std::string &key, QoreValue val)
 Sets a key value in the class's key-value store unconditionally. More...
 
DLLEXPORT bool setKeyValueIfNotSet (const std::string &key, const char *str)
 Sets a key value in the class's key-value store only if no value exists for the given key. More...
 
DLLEXPORT QoreValue setKeyValueIfNotSet (const std::string &key, QoreValue val)
 Sets a key value in the class's key-value store only if no value exists for the given key. More...
 
DLLEXPORT void setLanguage (const char *lang)
 Sets the language for classes imported from another programming language. More...
 
DLLEXPORT void setManagedUserData (AbstractQoreClassUserData *cud)
 sets a pointer to user-specific data in the class More...
 
DLLEXPORT void setPublicMemberFlag ()
 sets the class's public member flag so that undeclared member references will fail More...
 
DLLEXPORT void setRelaxedAbstractMatch ()
 Sets relaxed abstract matching. More...
 
DLLEXPORT void setSerializer (q_serializer_t m)
 sets the serializer method for builtin classes 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 setSystem ()
 marks the class as a builtin class
 
DLLEXPORT void setSystemConstructor (q_system_constructor_t m)
 sets the builtin constructor for system objects (ex: used as constant values) More...
 
DLLEXPORT void setUserData (const void *ptr)
 sets a pointer to user-specific data in the class More...
 

Private Member Methods

DLLEXPORT QoreClass ()
 For use with QoreClass::copyImport()
 
virtual DLLEXPORT ~QoreClass ()
 Deletes the object and frees all memory.
 

Friends

class QoreBuiltinClass
 
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

◆ QoreClass() [1/4]

DLLEXPORT QoreClass::QoreClass ( std::string &&  n_name,
std::string &&  ns_path,
int64  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
Since
Qore 1.0

◆ QoreClass() [2/4]

DLLEXPORT QoreClass::QoreClass ( const char *  n_name,
const char *  ns_path,
int64  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
Since
Qore 1.0

◆ QoreClass() [3/4]

DLLEXPORT QoreClass::QoreClass ( const char *  n_name,
const char *  ns_path,
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
ns_paththe full pathname of the class with namespaces, including the root "::" namespace as the leading element
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
Since
Qore 1.0

◆ QoreClass() [4/4]

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

◆ addBaseClass()

DLLEXPORT void QoreClass::addBaseClass ( QoreClass qc,
bool  virt = false 
)

Adds a base class to the current class.

Parameters
qcthe class to add
virtif the base class is "virtual", meaning that the current class's binary object is also compatible with this base class's data (meaning that the base class's private data object is also a base class of this class's private data object)

◆ addBuiltinBaseClass()

DLLEXPORT void QoreClass::addBuiltinBaseClass ( QoreClass qc)

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

◆ addBuiltinConstant()

DLLEXPORT void QoreClass::addBuiltinConstant ( const char *  name,
QoreValue  value,
ClassAccess  access = Public,
const QoreTypeInfo *  typeInfo = nullptr 
)

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
accessthe access protection of the constant
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

◆ addBuiltinStaticVar()

DLLEXPORT void QoreClass::addBuiltinStaticVar ( const char *  name,
QoreValue  value,
ClassAccess  access = Public,
const QoreTypeInfo *  typeInfo = nullptr 
)

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
accessthe access protection of the static variable
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

◆ addBuiltinVirtualBaseClass()

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's private data object is actually a subclass of the parent class and all methods are virtual, so the base class's constructor, destructor, and copy constructor will never be run and the base class methods will be passed a pointer to the subclass's data

Parameters
qcthe base class to add

◆ addConstructor()

DLLEXPORT void QoreClass::addConstructor ( const void *  ptr,
q_external_constructor_t  meth,
ClassAccess  access = Public,
int64  n_flags = QCF_NO_FLAGS,
int64  n_domain = QDOM_DEFAULT,
const type_vec_t n_typeList = type_vec_t(),
const arg_vec_t defaultArgList = arg_vec_t(),
const name_vec_t n_names = name_vec_t() 
)

adds a constructor method variant with the external calling convention and includes the access specifier, additional functional domain info, and parameter type info

Since
Qore 0.9

◆ addDefaultBuiltinBaseClass()

DLLEXPORT void QoreClass::addDefaultBuiltinBaseClass ( QoreClass qc)

make a builtin class a child of another builtin class and ensures that the given class's 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

◆ addMethod() [1/2]

DLLEXPORT void QoreClass::addMethod ( const char *  n_name,
q_method_n_t  meth,
ClassAccess  access = Public,
int64  n_flags = QCF_NO_FLAGS,
int64  n_domain = QDOM_DEFAULT,
const QoreTypeInfo *  returnTypeInfo = 0,
unsigned  num_params = 0,
  ... 
)

adds a builtin method variant to a class

Example:
// the actual function can be declared with the class to be expected as the private data as follows:
static QoreValue AL_lock(QoreObject* self, QoreAutoLock* m, const QoreListNode* args, q_rt_flags_t rtflag, ExceptionSink* xsink);
...
// and then casted to (q_method_t) in the addMethod call:
QC_AutoLock->addMethod("lock", (q_method_n_t)AL_lock, Public, QCF_NO_FLAGS, QDOM_DEFAULT, nothingTypeInfo);
#define QDOM_DEFAULT
the default domain (no domain)
Definition: Restrictions.h:159
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
the implementation of Qore's object data type, reference counted, dynamically-allocated only
Definition: QoreObject.h:60
uint64_t q_rt_flags_t
runtime code execution flags
Definition: common.h:263
QoreValue(* q_method_n_t)(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)
the type used for builtin QoreClass method signatures
Definition: common.h:330
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:275

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
accessthe access modifier for the method variant
n_flagscode flags
n_domainfunctional domain
returnTypeInfothe return type of the method
num_paramsthe number of parameters
See also
Qoreclass::addStaticMethod()
QoreClass::setConstructor()
QoreClass::setDestructor()
QoreClass::setCopy()

◆ addMethod() [2/2]

DLLEXPORT void QoreClass::addMethod ( const void *  ptr,
const char *  n_name,
q_external_method_t  meth,
ClassAccess  access = Public,
int64  n_flags = QCF_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(),
const name_vec_t n_names = name_vec_t() 
)

adds a builtin method variant to a class with the calling convention for external modules

Example:
// the actual function can be declared with the class to be expected as the private data as follows:
static QoreValue AL_lock(const QoreMethod& method, const void* ptr, QoreObject* self, QoreAutoLock* m, const QoreListNode* args, q_rt_flags_t flags, ExceptionSink* xsink)
...
// and then casted to (q_method_t) in the addMethod call:
QC_AutoLock->addMethod(nullptr, "lock", (q_external_method_t)AL_lock, Public, QCF_NO_FLAGS, QDOM_DEFAULT, nothingTypeInfo);
a method in a QoreClass
Definition: QoreClass.h:125
QoreValue(* q_external_method_t)(const QoreMethod &method, const void *ptr, QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)
the type used for builtin QoreClass method signatures
Definition: common.h:345

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::addConstructor(). To set the destructor method, call QoreClass::setDestructor(). To set the copy method, call QoreClass::setCopy().

Parameters
ptruser-defined data that will be included in the call to meth
n_namethe name of the method, must be unique in the class
meththe method to be added
accessthe access modifier for the method variant
n_flagscode flags
n_domainfunctional domain
returnTypeInfothe return type of the method
n_typeLista list of type information for parameters to the variant
defaultArgLista list of default arguments to each parameter
n_namesa list of parameter names
See also
Qoreclass::addStaticMethod()
QoreClass::addConstructor()
QoreClass::setDestructor()
QoreClass::setCopy()
Since
Qore 0.8.13

◆ addStaticMethod()

DLLEXPORT void QoreClass::addStaticMethod ( const void *  ptr,
const char *  n_name,
q_external_static_method_t  meth,
ClassAccess  access = Public,
int64  n_flags = QCF_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(),
const name_vec_t n_names = name_vec_t() 
)

adds a builtin static method with extended information; additional functional domain info, return and parameter type info

Since
Qore 0.9

◆ copy()

virtual DLLEXPORT QoreClass* QoreClass::copy ( )
virtual

Called when a class is copied.

Since
Qore 0.9.5

◆ copyImport()

virtual DLLEXPORT QoreClass* QoreClass::copyImport ( )
virtual

Called when a class is copied for import.

Since
Qore 0.9.5

◆ evalPseudoMethod() [1/2]

DLLEXPORT QoreValue QoreClass::evalPseudoMethod ( const QoreMethod m,
const QoreExternalMethodVariant variant,
const QoreValue  n,
const QoreListNode args,
ExceptionSink xsink 
) const

evaluates a pseudo-method on a pseudo-class

The current class must be a pseudo-class or the call with abort in debug builds and crash in non-debug builds

The method and variant arguments must belong to the class

Parameters
mthe method to call; must be non-nullptr and must belong to the class
variantmay be nullptr meanin that the variant is matched in the call
nthe value to use for the call
argscall arguments, if any (may be nullptr)
xsinkQore-language exception info is stored here
Returns
the return value of the call
Since
Qore 0.9

◆ evalPseudoMethod() [2/2]

DLLEXPORT QoreValue QoreClass::evalPseudoMethod ( const QoreValue  n,
const char *  nme,
const QoreListNode args,
ExceptionSink xsink 
) const

evaluates a pseudo-method on a pseudo-class

The current class must be a pseudo-class or the call with abort in debug builds and crash in non-debug builds

Since
Qore 0.9

◆ execConstructor() [1/2]

DLLEXPORT QoreObject* QoreClass::execConstructor ( const QoreClass obj_cls,
const QoreListNode args,
bool  allow_abstract,
ExceptionSink xsink 
) const

Creates a new object and executes the constructor and returns the new object.

The object created will be an instance of the first argument, which may be a different class than the current class.

Parameters
obj_clsthe class for the object to be returned
argsthe arguments for the method
allow_abstractif construction of abstract classes is allowed; this should only be true when called from an external language module where the class has been inherited and all abstract methods have been overridden in the subclass in the other language, otherwise allowing an abstract class to be constructed will result in runtime errors / core dumps
xsinkQore-language exception information is added here
Since
Qore 0.9.5

◆ execConstructor() [2/2]

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

◆ execConstructorVariant()

DLLEXPORT QoreObject* QoreClass::execConstructorVariant ( const QoreExternalMethodVariant mv,
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
mvthe constructor variant to use; must belong to a constructor method of the current class
argsthe arguments for the method
xsinkQore-language exception information is added here
Returns
the object created

◆ execCopy()

DLLEXPORT QoreObject* QoreClass::execCopy ( QoreObject old,
ExceptionSink xsink 
) const

executes a class's "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

◆ execSystemConstructor()

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

◆ findConstant()

DLLEXPORT const QoreExternalConstant* QoreClass::findConstant ( const char *  name) const

Finds the given constant or returns nullptr if not found.

Since
Qore 0.9

◆ findLocalMember()

DLLEXPORT const QoreExternalNormalMember* QoreClass::findLocalMember ( const char *  name) const

Finds the given local member or returns nullptr.

Since
Qore 0.9

◆ findLocalMethod()

DLLEXPORT const QoreMethod* QoreClass::findLocalMethod ( const char *  name) const

finds a normal (non-static) method in the class hierarchy

Parameters
namethe name of the method
Returns
a pointer to the method found, or nullptr if no such method exists in the class

◆ findLocalStaticMember()

DLLEXPORT const QoreExternalStaticMember* QoreClass::findLocalStaticMember ( const char *  name) const

Finds the given local static member or returns nullptr.

Since
Qore 0.9

◆ findLocalStaticMethod()

DLLEXPORT const QoreMethod* QoreClass::findLocalStaticMethod ( const char *  name) const

finds a static method in the class hierarchy

Parameters
namethe name of the method
Returns
a pointer to the method found, or nullptr if no such method exists in the class

◆ findMethod() [1/2]

DLLEXPORT const QoreMethod* QoreClass::findMethod ( const char *  nme) const

finds a normal (non-static) method in the class hierarchy

Note
used at run-time: will not return inaccessible methods
See also
findLocalMethod()

◆ findMethod() [2/2]

DLLEXPORT const QoreMethod* QoreClass::findMethod ( const char *  nme,
ClassAccess &  access 
) const

finds a normal (non-static) method in the class hierarchy at runtime and sets the access code

Note
used at run-time: will not return inaccessible methods
See also
findLocalMethod()

◆ findStaticMethod() [1/2]

DLLEXPORT const QoreMethod* QoreClass::findStaticMethod ( const char *  nme) const

finds a static method in the class hierarchy

Note
used at run-time: will not return inaccessible methods
See also
findLocalStaticMethod()

◆ findStaticMethod() [2/2]

DLLEXPORT const QoreMethod* QoreClass::findStaticMethod ( const char *  nme,
ClassAccess &  access 
) const

finds a static method in the class hierarchy and sets the priv flag if it's a private method or not

Note
used at run-time: will not return inaccessible methods
See also
findLocalStaticMethod()

◆ findUserMethodVariant()

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

◆ getBinaryHash()

DLLEXPORT BinaryNode* QoreClass::getBinaryHash ( ) const

returns a binary hash for the class's API

Since
Qore 0.9

◆ getClass() [1/3]

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 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 is from a different QoreProgram object, the value returned could be a different pointer to the qc parameter passed

◆ getClass() [2/3]

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

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

◆ getClass() [3/3]

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

◆ getConstructor()

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

◆ getCopyMethod()

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

◆ getDeserializer()

DLLEXPORT q_deserializer_t QoreClass::getDeserializer ( ) const

returns the deserializer method or nullptr if not present

Since
Qore 0.9

◆ getDestructor()

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

◆ getDomain()

DLLEXPORT int64 QoreClass::getDomain ( ) const

returns the functional domain of the class

Since
Qore 0.9

◆ getInjectedAsClass() [1/2]

DLLEXPORT QoreClass* QoreClass::getInjectedAsClass ( )

returns the class pointer for any injection target class if this class was injected, otherwise nullptr

Returns
the class pointer for any injection target class if this class was injected, otherwise nullptr
Since
Qore 1.0.3

◆ getInjectedAsClass() [2/2]

DLLEXPORT const QoreClass* QoreClass::getInjectedAsClass ( ) const

returns the class pointer for any injection target class if this class was injected, otherwise nullptr

Returns
the class pointer for any injection target class if this class was injected, otherwise nullptr
Since
Qore 1.0.3

◆ getLanguage()

DLLEXPORT const char* QoreClass::getLanguage ( ) const

Returns the language this class is written in.

Returns
Qore for Qore classe, Java for Java classes, and Python for Python classes
Since
Qore 1.0.1

◆ getManagedUserData() [1/2]

DLLEXPORT AbstractQoreClassUserData* QoreClass::getManagedUserData ( ) const

retrieves the user-specific data pointer

Since
Qore 0.8.13

◆ getManagedUserData() [2/2]

template<typename T >
DLLLOCAL T* QoreClass::getManagedUserData ( ) const
inline

retrieves the user-specific data pointer

Since
Qore 0.8.13

◆ getMemberGateMethod()

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

◆ getMemberNotificationMethod()

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

◆ getMethodGate()

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

◆ getMethodList()

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

◆ getModuleName()

DLLEXPORT const char* QoreClass::getModuleName ( ) const

Returns the module name the class was loaded from or nullptr if it is a builtin class.

Since
Qore 0.9

◆ getNamespace()

DLLEXPORT const QoreNamespace* QoreClass::getNamespace ( ) const

Returns the namespace that owns this class.

Since
Qore 0.9

◆ getNamespacePath()

DLLEXPORT std::string QoreClass::getNamespacePath ( bool  anchored = false) const

returns the full namespace path of the class

Parameters
anchoredif true then the path will always be prefixed by "::" for the unnamed root namespace
Since
Qore 0.9

◆ getPath()

DLLEXPORT const char* QoreClass::getPath ( ) const

Returns the root-justified namespace path of the class including the class name.

Note
equivalent to getNamespacePath(true)
Since
Qore 1.0

◆ getProgram()

DLLEXPORT QoreProgram* QoreClass::getProgram ( ) const

Returns the owning QoreProgram object (if not the static system namespace)

Since
Qore 0.9.5

◆ getPseudoClassType()

DLLEXPORT qore_type_t QoreClass::getPseudoClassType ( ) const

returns a pseudo-classes base type

if the class is not a pseudo-class, or is the default pseudo-class taking any value, then -1 is returned

Since
Qore 0.9

◆ getReferencedKeyValue() [1/2]

DLLEXPORT QoreValue QoreClass::getReferencedKeyValue ( const char *  key) const

Returns a referenced key value from the class's key-value store.

Parameters
keythe key to check
Returns
the value corresponding to the key; the caller is responsible for dereferencing the value returned
Note
All class key-value operations are atomic
Since
Qore 1.0.13

◆ getReferencedKeyValue() [2/2]

DLLEXPORT QoreValue QoreClass::getReferencedKeyValue ( const std::string &  key) const

Returns a referenced key value from the class's key-value store.

Parameters
keythe key to check
Returns
the value corresponding to the key; the caller is responsible for dereferencing the value returned
Note
All class key-value operations are atomic
Since
Qore 1.0

◆ getRelaxedAbstractMatch()

DLLEXPORT bool QoreClass::getRelaxedAbstractMatch ( ) const

Returns the relaxed abstract matching flag.

For use with languages that do not support exact type mappings from Qore

Returns
the relaxed abstract matching flag
Since
Qore 1.0.1

◆ getSerializer()

DLLEXPORT q_serializer_t QoreClass::getSerializer ( ) const

returns the serializer method or nullptr if not present

Since
Qore 0.9

◆ getStaticMethodList()

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

◆ getSystemConstructor()

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

◆ getUserData()

DLLEXPORT const void* QoreClass::getUserData ( ) const

retrieves the user-specific data pointer

Deprecated:
use getManagedUserData() instead

◆ hasTransientMember()

DLLEXPORT bool QoreClass::hasTransientMember ( ) const

Returns true if the class has at least one locally-declared transient member.

Since
Qore 0.9

◆ inHierarchy()

DLLEXPORT bool QoreClass::inHierarchy ( const QoreClass cls,
ClassAccess &  n_access 
) const

Returns true if the class passed as an argument is present in the current class's hierachy, even if not accessible from the class due to private:internal inheritance.

Since
Qore 0.9

◆ inHierarchyStrict()

DLLEXPORT bool QoreClass::inHierarchyStrict ( const QoreClass cls,
ClassAccess &  n_access 
) const

Returns true if the class passed as an argument is present in the current class's hierachy, even if not accessible from the class due to private:internal inheritance; does not check injected compatibility.

Since
Qore 1.0.3

◆ isAbstract()

DLLEXPORT bool QoreClass::isAbstract ( ) const

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

Since
Qore 0.9

◆ isEqual()

DLLEXPORT bool QoreClass::isEqual ( const QoreClass cls) const

returns true if the classes are equal

Since
Qore 0.9

◆ isFinal()

DLLEXPORT bool QoreClass::isFinal ( ) const

returns true if the class is final

Since
Qore 0.9

◆ isInjected()

DLLEXPORT bool QoreClass::isInjected ( ) const

returns true if the class has been injected as a dependency injection

Since
Qore 0.9

◆ isModulePublic()

DLLEXPORT bool QoreClass::isModulePublic ( ) const

returns true if the class has its module public flag set

Since
Qore 0.9

◆ isPrivateMember()

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

◆ isPseudoClass()

DLLEXPORT bool QoreClass::isPseudoClass ( ) const

returns true if the class is a pseudo class

Since
Qore 0.9

◆ isPublicOrPrivateMember()

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

◆ rescanParents()

DLLEXPORT void QoreClass::rescanParents ( )

rescan builtin parent classes in a class hierarchy; to be used with out-of-order class hierarchy construction

For example, when Qore classes are generated externally such as with the jni module, parent class information may need to be rescanned after adding to the class hierarchy to ensure that all virtual parents are correctly marked in child classes

Since
Qore 0.8.13

◆ runtimeCheckInstantiateClass()

DLLEXPORT int QoreClass::runtimeCheckInstantiateClass ( ExceptionSink xsink) const

Throws a Qore-language exception if the class cannot be instantiated.

Since
Qore 0.9

◆ setCopy() [1/2]

DLLEXPORT void QoreClass::setCopy ( const void *  ptr,
q_external_copy_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, const void* ptr, QoreObject* self, QoreObject* old, QoreAutoLock *m, ExceptionSink* xsink)
...
// and then casted to (q_external_copy_t) in the addMethod call:
QC_AutoLock->setCopy((q_external_copy_t)AL_copy);
defines a Qore-language class
Definition: QoreClass.h:239
void(* q_external_copy_t)(const QoreClass &thisclass, const void *ptr, QoreObject *self, QoreObject *old, AbstractPrivateData *private_data, ExceptionSink *xsink)
the type used for builtin QoreClass copy signatures with the new generic calling convention
Definition: common.h:428

◆ setCopy() [2/2]

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, QoreAutoLock *m, ExceptionSink* xsink)
...
// and then casted to (q_copy_t) in the addMethod call:
QC_AutoLock->setCopy((q_copy_t)AL_copy);
void(* q_copy_t)(QoreObject *self, QoreObject *old, AbstractPrivateData *private_data, ExceptionSink *xsink)
the type used for builtin QoreClass copy signatures
Definition: common.h:417

◆ setDeserializer()

DLLEXPORT void QoreClass::setDeserializer ( q_deserializer_t  m)

sets the deserializer method for builtin classes

Parameters
mthe deserializer method
Since
Qore 0.9

◆ setDestructor() [1/2]

DLLEXPORT void QoreClass::setDestructor ( const void *  ptr,
q_external_destructor_t  m 
)

sets the builtin destructor method for the class with the external 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, const void* ptr, QoreObject* self, QoreAutoLock* al, ExceptionSink* xsink);
...
// and then casted to (q_external_destructor_t) in the setDestructor call:
QC_AutoLock->setDestructor((q_external_destructor_t)AL_destructor);
void(* q_external_destructor_t)(const QoreClass &thisclass, const void *ptr, QoreObject *self, AbstractPrivateData *private_data, ExceptionSink *xsink)
the type used for builtin QoreClass destructor signatures with the new generic calling convention and...
Definition: common.h:408

◆ setDestructor() [2/2]

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 setDestructor call:
QC_AutoLock->setDestructor((q_destructor_t)AL_destructor);
void(* q_destructor_t)(QoreObject *self, AbstractPrivateData *private_data, ExceptionSink *xsink)
the type used for builtin QoreClass destructor signatures
Definition: common.h:398

◆ setGateAccessFlag()

DLLEXPORT void QoreClass::setGateAccessFlag ( )

sets the class's gate access flag so that memberGate() and methodGate() methods will be called with an extra boolean argument giving the current class access before the call

Since
Qore 0.8.13

◆ setKeyValue()

DLLEXPORT QoreValue QoreClass::setKeyValue ( const std::string &  key,
QoreValue  val 
)

Sets a key value in the class's key-value store unconditionally.

Parameters
keythe key to store
valuethe value to store; must be already referenced for storage
Returns
any value previously stored in that key; must be dereferenced by the caller
Note
All class key-value operations are atomic
Since
Qore 1.0

◆ setKeyValueIfNotSet() [1/2]

DLLEXPORT bool QoreClass::setKeyValueIfNotSet ( const std::string &  key,
const char *  str 
)

Sets a key value in the class's key-value store only if no value exists for the given key.

Parameters
keythe key to store
valuethe string to store; will be converted to a QoreStringNode if stored
returnstrue if the value was set, false if not (a value is already in place)
Note
All class key-value operations are atomic
Since
Qore 1.0

◆ setKeyValueIfNotSet() [2/2]

DLLEXPORT QoreValue QoreClass::setKeyValueIfNotSet ( const std::string &  key,
QoreValue  val 
)

Sets a key value in the class's key-value store only if no value exists for the given key.

Parameters
keythe key to store
valuethe value to store; must be already referenced for storage
Returns
returns value if another value already exists for that key, otherwise returns no value
Note
  • All class key-value operations are atomic
  • if value is returned, the caller must dereference it
Since
Qore 1.0

◆ setLanguage()

DLLEXPORT void QoreClass::setLanguage ( const char *  lang)

Sets the language for classes imported from another programming language.

Since
Qore 1.0.1

◆ setManagedUserData()

DLLEXPORT void QoreClass::setManagedUserData ( AbstractQoreClassUserData cud)

sets a pointer to user-specific data in the class

Since
Qore 0.8.13

◆ setPublicMemberFlag()

DLLEXPORT void QoreClass::setPublicMemberFlag ( )

sets the class's public member flag so that undeclared member references will fail

Since
Qore 0.8.13

◆ setRelaxedAbstractMatch()

DLLEXPORT void QoreClass::setRelaxedAbstractMatch ( )

Sets relaxed abstract matching.

For use with languages that do not support exact type mappings from Qore

Since
Qore 1.0.1

◆ setSerializer()

DLLEXPORT void QoreClass::setSerializer ( q_serializer_t  m)

sets the serializer method for builtin classes

Parameters
mthe serializer method
Since
Qore 0.9

◆ setSynchronousClass()

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

◆ setSystemConstructor()

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

◆ setUserData()

DLLEXPORT void QoreClass::setUserData ( const void *  ptr)

sets a pointer to user-specific data in the class

Deprecated:
use setManagedUserData(AbstractQoreClassUserData*) instead

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