32 #ifndef _QORE_QORECLASS_H 34 #define _QORE_QORECLASS_H 71 DLLEXPORT
extern QoreClass* QC_HTTPCLIENT;
72 DLLEXPORT
extern QoreClass* QC_SSLCERTIFICATE;
73 DLLEXPORT
extern QoreClass* QC_SSLPRIVATEKEY;
85 class AbstractQoreFunctionVariant;
86 class AbstractFunctionSignature;
89 class qore_method_private;
90 class MethodFunctionBase;
93 class MethodVariantBase;
100 class QoreExternalMethodFunction;
124 friend class StaticMethodCallNode;
126 friend class qore_class_private;
127 friend class qore_method_private;
132 class qore_method_private* priv;
138 DLLLOCAL QoreMethod& operator=(
const QoreMethod&);
144 DLLEXPORT
bool isUser()
const;
169 DLLEXPORT
const char*
getName()
const;
175 DLLEXPORT
const std::string&
getNameStr()
const;
190 DLLEXPORT
const QoreTypeInfo* getUniqueReturnTypeInfo()
const;
207 DLLEXPORT
const QoreExternalMethodFunction*
getFunction()
const;
209 DLLLOCAL QoreMethod(
const QoreClass* p_class, MethodFunctionBase* n_func,
bool n_static =
false);
211 DLLLOCAL
bool inMethod(
const QoreObject*
self)
const;
212 DLLLOCAL QoreMethod* copy(
const QoreClass* p_class)
const;
213 DLLLOCAL
void assign_class(
const QoreClass* p_class);
215 DLLLOCAL ~QoreMethod();
229 virtual void doDeref() = 0;
240 friend class BCSMList;
241 friend class qore_object_private;
242 friend class qore_class_private;
244 friend class BCANode;
245 friend class qore_method_private;
248 friend class ConstructorMethodFunction;
270 DLLEXPORT
explicit QoreClass(
const char* n_name,
int n_domain);
280 DLLEXPORT QoreClass(
const char* n_name,
int64 n_domain,
const QoreTypeInfo* n_typeInfo);
285 DLLEXPORT QoreClass(
const QoreClass &old);
317 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, ...);
357 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, ...);
365 DLLEXPORT
void addAbstractMethod(
const char* n_name, ClassAccess access = Public,
int64 n_flags = QCF_NO_FLAGS,
const QoreTypeInfo* returnTypeInfo = 0,
unsigned num_params = 0, ...);
478 DLLEXPORT
void setFinal();
485 DLLEXPORT
bool isPrivateMember(
const char* str)
const;
493 DLLEXPORT
bool isPublicOrPrivateMember(
const char* str,
bool& priv)
const;
519 DLLEXPORT
QoreObject* execSystemConstructor(
int code = 0, ...)
const;
569 DLLEXPORT
const QoreClass*
getClass(
const QoreClass& qc,
bool& priv)
const;
572 DLLEXPORT
int numMethods()
const;
575 DLLEXPORT
int numStaticMethods()
const;
578 DLLEXPORT
int numUserMethods()
const;
581 DLLEXPORT
int numStaticUserMethods()
const;
584 DLLEXPORT
bool hasCopy()
const;
590 DLLEXPORT
bool isSystem()
const;
595 DLLEXPORT
bool isModulePublic()
const;
600 DLLEXPORT
bool isAbstract()
const;
605 DLLEXPORT
bool isFinal()
const;
610 DLLEXPORT
bool isInjected()
const;
615 DLLEXPORT
bool isPseudoClass()
const;
649 DLLEXPORT
void setSystem();
652 DLLEXPORT
bool hasMemberGate()
const;
655 DLLEXPORT
bool hasMethodGate()
const;
658 DLLEXPORT
bool hasMemberNotification()
const;
663 DLLEXPORT
int64 getDomain()
const;
666 DLLEXPORT
const char*
getName()
const;
673 DLLEXPORT
const QoreMethod* findMethod(
const char* nme)
const;
680 DLLEXPORT
const QoreMethod* findStaticMethod(
const char* nme)
const;
687 DLLEXPORT
const QoreMethod* findMethod(
const char* nme, ClassAccess& access)
const;
694 DLLEXPORT
const QoreMethod* findStaticMethod(
const char* nme, ClassAccess& access)
const;
701 DLLEXPORT
const QoreMethod* findLocalMethod(
const char* name)
const;
708 DLLEXPORT
const QoreMethod* findLocalStaticMethod(
const char* name)
const;
714 DLLEXPORT
void addBuiltinBaseClass(QoreClass* qc);
722 DLLEXPORT
void addDefaultBuiltinBaseClass(QoreClass* qc);
731 DLLEXPORT
void addBuiltinVirtualBaseClass(QoreClass* qc);
736 DLLEXPORT
void setSynchronousClass();
742 DLLEXPORT
const QoreMethod* getConstructor()
const;
748 DLLEXPORT
const QoreMethod* getSystemConstructor()
const;
754 DLLEXPORT
const QoreMethod* getDestructor()
const;
760 DLLEXPORT
const QoreMethod* getCopyMethod()
const;
766 DLLEXPORT
const QoreMethod* getMemberGateMethod()
const;
772 DLLEXPORT
const QoreMethod* getMethodGate()
const;
778 DLLEXPORT
const QoreMethod* getMemberNotificationMethod()
const;
781 DLLEXPORT
const QoreTypeInfo* getTypeInfo()
const;
784 DLLEXPORT
const QoreTypeInfo* getOrNothingTypeInfo()
const;
787 DLLEXPORT
void addMember(
const char* mem, ClassAccess access,
const QoreTypeInfo* n_typeInfo,
QoreValue initial_value =
QoreValue());
792 DLLEXPORT
void setUserData(
const void* ptr);
797 DLLEXPORT
const void* getUserData()
const;
812 template <
typename T>
813 DLLLOCAL T* getManagedUserData()
const {
814 return static_cast<T*
>(getManagedUserData());
818 DLLEXPORT
void recheckBuiltinMethodHierarchy();
831 DLLEXPORT
void addBuiltinConstant(
const char* name,
QoreValue value, ClassAccess access = Public,
const QoreTypeInfo* typeInfo =
nullptr);
839 DLLEXPORT
void addBuiltinStaticVar(
const char* name,
QoreValue value, ClassAccess access = Public,
const QoreTypeInfo* typeInfo =
nullptr);
848 DLLEXPORT
void rescanParents();
853 DLLEXPORT
void setPublicMemberFlag();
858 DLLEXPORT
void setGateAccessFlag();
875 DLLEXPORT std::string getNamespacePath(
bool anchored =
false)
const;
880 DLLEXPORT
bool isEqual(
const QoreClass& cls)
const;
890 DLLEXPORT
int runtimeCheckInstantiateClass(
ExceptionSink* xsink)
const;
905 DLLEXPORT
bool inHierarchy(
const QoreClass& cls, ClassAccess& n_access)
const;
910 DLLEXPORT
bool hasTransientMember()
const;
915 DLLEXPORT
const char* getModuleName()
const;
918 DLLLOCAL QoreClass();
921 DLLLOCAL
const QoreMethod* parseFindCommittedMethod(
const char* nme);
924 DLLLOCAL
int parseAddBaseClassArgumentList(BCAList* bcal);
926 DLLLOCAL
void setName(
const char* n);
930 DLLLOCAL BCSMList* getBCSMList()
const;
932 DLLLOCAL
bool has_delete_blocker()
const;
934 DLLLOCAL
bool parseHasPublicMembersInHierarchy()
const;
935 DLLLOCAL
bool runtimeHasPublicMembersInHierarchy()
const;
938 DLLLOCAL
bool hasParentClass()
const;
939 DLLLOCAL
bool hasPrivateCopyMethod()
const;
941 DLLLOCAL
bool parseHasPrivateCopyMethod()
const;
942 DLLLOCAL
const QoreMethod* parseGetConstructor()
const;
944 DLLLOCAL
bool parseHasMethodGate()
const;
946 DLLLOCAL
void parseSetEmptyPublicMemberDeclaration();
948 DLLLOCAL
void unsetPublicMemberFlag();
952 DLLEXPORT ~QoreClass();
956 QoreClass& operator=(
const QoreClass&) =
delete;
959 class qore_class_private* priv;
962 DLLLOCAL QoreClass(qore_class_private* priv);
965 DLLLOCAL
void insertStaticMethod(
QoreMethod* o);
967 DLLLOCAL
const QoreMethod* parseResolveSelfMethodIntern(
const char* nme);
998 DLLEXPORT ~QoreMethodIterator();
999 DLLEXPORT
bool next();
1000 DLLEXPORT
const QoreMethod* getMethod()
const;
1010 DLLEXPORT ~QoreStaticMethodIterator();
1011 DLLEXPORT
bool next();
1012 DLLEXPORT
const QoreMethod* getMethod()
const;
1051 DLLEXPORT QoreBuiltinClass(
const QoreBuiltinClass& old);
1063 DLLEXPORT ~QoreParentClassIterator();
1066 DLLEXPORT
bool next();
1069 DLLEXPORT
bool valid()
const;
1072 DLLEXPORT
const QoreClass& getParentClass()
const;
1075 DLLEXPORT ClassAccess
getAccess()
const;
1078 std::unique_ptr<class qore_parent_class_iterator_private> priv;
1090 DLLEXPORT ~QoreClassMemberIterator();
1093 DLLEXPORT
bool next();
1096 DLLEXPORT
bool valid()
const;
1102 DLLEXPORT
const char*
getName()
const;
1105 std::unique_ptr<class qore_class_member_iterator_private> priv;
1117 DLLEXPORT ~QoreClassStaticMemberIterator();
1120 DLLEXPORT
bool next();
1123 DLLEXPORT
bool valid()
const;
1129 DLLEXPORT
const char*
getName()
const;
1132 std::unique_ptr<class qore_class_static_member_iterator_private> priv;
1144 DLLEXPORT ~QoreClassConstantIterator();
1147 DLLEXPORT
bool next();
1150 DLLEXPORT
bool valid()
const;
1156 std::unique_ptr<class qore_class_constant_iterator> priv;
1170 DLLEXPORT ~QoreClassHierarchyIterator();
1173 DLLEXPORT
bool next();
1176 DLLEXPORT
bool valid()
const;
1184 DLLEXPORT
bool isVirtual()
const;
1187 std::unique_ptr<class qore_class_hierarchy_iterator> priv;
1201 DLLEXPORT ~QoreClassDestructorHierarchyIterator();
1204 DLLEXPORT
bool next();
1207 DLLEXPORT
bool valid()
const;
1215 DLLEXPORT
bool isVirtual()
const;
1218 class qore_class_destructor_hierarchy_iterator* priv;
1221 DLLEXPORT
const char* get_access_string(ClassAccess access);
1223 #endif // _QORE_QORECLASS_H DLLEXPORT bool isPrivate() const
returns true if all overloaded variants of a methods are private or class internal, false if at least one variant is public
external wrapper base class for class normal members
Definition: QoreReflection.h:174
void(* q_external_constructor_t)(const QoreMethod &method, const void *ptr, QoreObject *self, const QoreListNode *args, q_rt_flags_t rtflags, ExceptionSink *xsink)
the type used for builtin QoreClass constructor method signatures
Definition: common.h:366
To be used to iterate through a class's normal (non-static) methods.
Definition: QoreClass.h:992
external wrapper class for constants
Definition: QoreReflection.h:200
DLLEXPORT bool isBuiltin() const
returns true if all variants of the method are builtin variants
void(* q_destructor_t)(QoreObject *self, AbstractPrivateData *private_data, ExceptionSink *xsink)
the type used for builtin QoreClass destructor signatures
Definition: common.h:386
QoreValue(* q_external_static_method_t)(const QoreMethod &method, const void *ptr, const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)
the type used for external static methods
Definition: common.h:346
void(* q_system_constructor_t)(QoreObject *self, int code, va_list args)
the type used for builtin QoreClass system constructor method signatures
Definition: common.h:378
an abstract class for class-specific external user data
Definition: QoreClass.h:221
external wrapper base class for class static members
Definition: QoreReflection.h:153
external wrapper class for function and call variants
Definition: QoreReflection.h:38
iterates class constants
Definition: QoreClass.h:1138
iterates the class hierarchy in the order of destructor execution
Definition: QoreClass.h:1195
allows for temporary storage of a QoreClass pointer
Definition: QoreClass.h:1018
DLLEXPORT const char * getName() const
returns the method's name
contains constants, classes, and subnamespaces in QoreProgram objects
Definition: QoreNamespace.h:64
QoreHashNode *(* q_serializer_t)(const QoreObject &self, const AbstractPrivateData &data, QoreSerializationContext &context, ExceptionSink *xsink)
the type used for builtin QoreClass serializer method signatures
Definition: common.h:434
DLLEXPORT QoreValue execManaged(QoreObject *self, const QoreListNode *args, ExceptionSink *xsink) const
evaluates the method and returns the value, does not reference the object for the call ...
DLLEXPORT bool isUser() const
returns true if all variants of the method are user variants
To be used to iterate through a class's static methods.
Definition: QoreClass.h:1004
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:81
DLLEXPORT const QoreClass * getClass() const
returns a pointer to the parent class
iterates the class hierarchy in the order of constructor execution
Definition: QoreClass.h:1164
DLLEXPORT bool existsVariant(const type_vec_t ¶mTypeInfo) const
returns true if a variant with the given parameter signature already exists in the method ...
DLLEXPORT const std::string & getNameStr() const
returns the method's name
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
external wrapper base class for class members
Definition: QoreReflection.h:137
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:416
defines a Qore-language class
Definition: QoreClass.h:237
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:396
DLLEXPORT bool isStatic() const
returns true if the method is static
bool(* q_delete_blocker_t)(QoreObject *self, AbstractPrivateData *private_data)
the typed used for QoreClass deleteBlocker signatures
Definition: common.h:424
void(* q_deserializer_t)(QoreObject &self, const QoreHashNode *sdata, QoreDeserializationContext &context, ExceptionSink *xsink)
the type used for builtin QoreClass deserializer method signatures
Definition: common.h:446
DLLEXPORT const char * getClassName() const
returns the class name for the method
creates a builtin class
Definition: QoreClass.h:1045
void(* q_constructor_n_t)(QoreObject *self, const QoreListNode *args, q_rt_flags_t rtflags, ExceptionSink *xsink)
the type used for builtin QoreClass constructor method signatures
Definition: common.h:354
iterates static members of a class
Definition: QoreClass.h:1111
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:318
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
the implementation of Qore's object data type, reference counted, dynamically-allocated only ...
Definition: QoreObject.h:61
unsigned qore_classid_t
used for the unique class ID for QoreClass objects
Definition: common.h:79
static unsigned num_params(const QoreListNode *n)
returns the number of arguments passed to the function
Definition: params.h:54
external wrapper class for method variants
Definition: QoreReflection.h:90
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46
std::vector< std::string > name_vec_t
vector of parameter names for parameter lists
Definition: common.h:257
DLLEXPORT ClassAccess getAccess() const
returns the lowest access code of all variants in the method
DLLEXPORT const QoreExternalMethodFunction * getFunction() const
returns the function for the method
external wrapper class for source code location information
Definition: QoreReflection.h:187
DLLEXPORT method_type_e getMethodType() const
returns the type of method
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:260
std::vector< QoreValue > arg_vec_t
vector of value information for default argument lists
Definition: common.h:254
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:70
iterates normal (non-static) members of a class
Definition: QoreClass.h:1084
void(* q_copy_t)(QoreObject *self, QoreObject *old, AbstractPrivateData *private_data, ExceptionSink *xsink)
the type used for builtin QoreClass copy signatures
Definition: common.h:405
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:333
std::vector< const QoreTypeInfo * > type_vec_t
vector of type information for parameter lists
Definition: common.h:251
a method in a QoreClass
Definition: QoreClass.h:123
iterates parent classes for a class with inheritance access information
Definition: QoreClass.h:1057
QoreValue(* q_func_n_t)(const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)
the type used for builtin function signatures
Definition: common.h:307
holds arbitrary binary data
Definition: BinaryNode.h:41
#define QDOM_DEFAULT
the default domain (no domain)
Definition: Restrictions.h:152