32 #ifndef _QORE_QORECLASS_H 34 #define _QORE_QORECLASS_H 64 DLLEXPORT
extern QoreClass* QC_HTTPCLIENT;
75 class AbstractQoreFunctionVariant;
76 class AbstractFunctionSignature;
79 class qore_method_private;
80 class MethodFunctionBase;
81 class QoreExternalMethodVariant;
82 class QoreExternalStaticMethodVariant;
85 class MethodVariantBase;
92 friend class StaticMethodCallNode;
94 friend class qore_class_private;
95 friend class qore_method_private;
100 class qore_method_private* priv;
106 DLLLOCAL QoreMethod& operator=(
const QoreMethod&);
124 DLLEXPORT
bool isUser()
const;
146 DLLEXPORT
const char*
getName()
const;
152 DLLEXPORT
const std::string&
getNameStr()
const;
167 DLLEXPORT
const QoreTypeInfo* getUniqueReturnTypeInfo()
const;
176 DLLLOCAL QoreMethod(
const QoreClass* p_class, MethodFunctionBase* n_func,
bool n_static =
false);
178 DLLLOCAL ~QoreMethod();
179 DLLLOCAL
bool inMethod(
const QoreObject*
self)
const;
180 DLLLOCAL QoreMethod* copy(
const QoreClass* p_class)
const;
181 DLLLOCAL
void assign_class(
const QoreClass* p_class);
182 DLLLOCAL MethodFunctionBase* getFunction()
const;
198 friend class BCSMList;
199 friend class qore_object_private;
200 friend class qore_class_private;
202 friend class BCANode;
203 friend class qore_method_private;
206 friend class ConstructorMethodFunction;
213 class qore_class_private* priv;
219 DLLLOCAL
void insertStaticMethod(
QoreMethod* o);
221 DLLLOCAL
const QoreMethod* parseResolveSelfMethodIntern(
const char* nme);
244 DLLEXPORT
const QoreClass* getClassIntern(
qore_classid_t cid,
bool& priv)
const;
253 DLLEXPORT QoreClass(
const char* n_name,
int n_domain =
QDOM_DEFAULT);
263 DLLEXPORT QoreClass(
const char* n_name,
int64 n_domain,
const QoreTypeInfo* n_typeInfo);
268 DLLEXPORT QoreClass(
const QoreClass &old);
271 DLLEXPORT ~QoreClass();
302 DLLEXPORT
void addStaticMethod(
const char* n_name,
q_func_n_t meth,
bool priv =
false,
int64 n_flags = QC_NO_FLAGS,
int64 n_domain =
QDOM_DEFAULT,
const QoreTypeInfo* returnTypeInfo = 0,
unsigned num_params = 0, ...);
328 DLLEXPORT
void addMethod(
const char* n_name,
q_method_t meth,
bool priv =
false);
333 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, ...);
348 DLLEXPORT
void addMethod2(
const char* n_name,
q_method2_t meth,
bool priv =
false);
353 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, ...);
378 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, ...);
396 DLLEXPORT
void addAbstractMethodVariantExtended3(
const char* n_name,
bool priv =
false,
int64 n_flags = QC_NO_FLAGS,
const QoreTypeInfo* returnTypeInfo = 0,
unsigned num_params = 0, ...);
406 DLLEXPORT
void addStaticMethod(
const char* n_name,
q_func_t meth,
bool priv =
false);
411 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, ...);
421 DLLEXPORT
void addStaticMethod2(
const char* n_name,
q_static_method2_t meth,
bool priv =
false);
451 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, ...);
456 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, ...);
461 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, ...);
466 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, ...);
626 DLLEXPORT
void setCopy3(
const void* ptr,
q_copy3_t m);
644 DLLEXPORT
bool isPrivateMember(
const char* str)
const;
652 DLLEXPORT
bool isPublicOrPrivateMember(
const char* str,
bool& priv)
const;
679 DLLEXPORT
QoreObject* execSystemConstructor(
int code = 0, ...)
const;
694 DLLEXPORT
const QoreMethod* findLocalMethod(
const char* name)
const;
702 DLLEXPORT
const QoreMethod* findLocalStaticMethod(
const char* name)
const;
745 DLLEXPORT
const QoreClass*
getClass(
const QoreClass& qc,
bool& priv)
const;
748 DLLEXPORT
int numMethods()
const;
751 DLLEXPORT
int numStaticMethods()
const;
754 DLLEXPORT
int numUserMethods()
const;
757 DLLEXPORT
int numStaticUserMethods()
const;
760 DLLEXPORT
bool hasCopy()
const;
766 DLLEXPORT
bool isSystem()
const;
769 DLLEXPORT
bool hasMemberGate()
const;
772 DLLEXPORT
bool hasMethodGate()
const;
775 DLLEXPORT
bool hasMemberNotification()
const;
780 DLLEXPORT
int getDomain()
const;
785 DLLEXPORT
int64 getDomain64()
const;
788 DLLEXPORT
const char*
getName()
const;
792 DLLEXPORT
const QoreMethod* findMethod(
const char* nme)
const;
796 DLLEXPORT
const QoreMethod* findStaticMethod(
const char* nme)
const;
799 DLLEXPORT
const QoreMethod* findMethod(
const char* nme,
bool& priv)
const;
802 DLLEXPORT
const QoreMethod* findStaticMethod(
const char* nme,
bool& priv)
const;
809 DLLEXPORT
void addBuiltinBaseClass(QoreClass* qc,
QoreListNode* xargs = 0);
818 DLLEXPORT
void addDefaultBuiltinBaseClass(QoreClass* qc,
QoreListNode* xargs = 0);
827 DLLEXPORT
void addBuiltinVirtualBaseClass(QoreClass* qc);
832 DLLEXPORT
void setSynchronousClass();
838 DLLEXPORT
const QoreMethod* getConstructor()
const;
844 DLLEXPORT
const QoreMethod* getSystemConstructor()
const;
850 DLLEXPORT
const QoreMethod* getDestructor()
const;
856 DLLEXPORT
const QoreMethod* getCopyMethod()
const;
862 DLLEXPORT
const QoreMethod* getMemberGateMethod()
const;
868 DLLEXPORT
const QoreMethod* getMethodGate()
const;
874 DLLEXPORT
const QoreMethod* getMemberNotificationMethod()
const;
877 DLLEXPORT
const QoreTypeInfo* getTypeInfo()
const;
880 DLLEXPORT
const QoreTypeInfo* getOrNothingTypeInfo()
const;
883 DLLEXPORT
void addPublicMember(
const char* mem,
const QoreTypeInfo* n_typeInfo,
AbstractQoreNode* initial_value = 0);
886 DLLEXPORT
void addPrivateMember(
const char* mem,
const QoreTypeInfo* n_typeInfo,
AbstractQoreNode* initial_value = 0);
889 DLLEXPORT
void setUserData(
const void* ptr);
892 DLLEXPORT
const void* getUserData()
const;
895 DLLEXPORT
void recheckBuiltinMethodHierarchy();
900 DLLEXPORT
const QoreExternalMethodVariant* findUserMethodVariant(
const char* name,
const QoreMethod*& method,
const type_vec_t& argTypeList)
const;
908 DLLEXPORT
void addBuiltinConstant(
const char* name,
AbstractQoreNode* value,
bool priv =
false,
const QoreTypeInfo* typeInfo = 0);
916 DLLEXPORT
void addBuiltinStaticVar(
const char* name,
AbstractQoreNode* value,
bool priv =
false,
const QoreTypeInfo* typeInfo = 0);
921 DLLEXPORT
bool hasAbstract()
const;
924 DLLLOCAL QoreClass();
927 DLLLOCAL
const QoreMethod* parseFindCommittedMethod(
const char* nme);
930 DLLLOCAL
void parseAssimilatePublicConstants(ConstantList& cmap);
932 DLLLOCAL
void parseAssimilatePrivateConstants(ConstantList& cmap);
934 DLLLOCAL
void parseAddPublicConstant(
const std::string& name,
AbstractQoreNode* val);
937 DLLLOCAL
int parseAddBaseClassArgumentList(BCAList* bcal);
939 DLLLOCAL
void setName(
const char* n);
943 DLLLOCAL BCSMList* getBCSMList()
const;
945 DLLLOCAL
bool has_delete_blocker()
const;
946 DLLLOCAL
bool parseCheckHierarchy(
const QoreClass* cls)
const;
947 DLLLOCAL
bool parseHasPublicMembersInHierarchy()
const;
948 DLLLOCAL
bool runtimeGetMemberInfo(
const char* mem,
const QoreTypeInfo*& memberTypeInfo,
bool& priv)
const;
949 DLLLOCAL
bool runtimeHasPublicMembersInHierarchy()
const;
951 DLLLOCAL
bool hasParentClass()
const;
952 DLLLOCAL
bool hasPrivateCopyMethod()
const;
954 DLLLOCAL
bool parseHasPrivateCopyMethod()
const;
955 DLLLOCAL
const QoreMethod* parseGetConstructor()
const;
957 DLLLOCAL
bool parseHasMethodGate()
const;
959 DLLLOCAL
void parseSetEmptyPublicMemberDeclaration();
961 DLLLOCAL
void unsetPublicMemberFlag();
971 DLLEXPORT ~QoreMethodIterator();
972 DLLEXPORT
bool next();
973 DLLEXPORT
const QoreMethod* getMethod()
const;
983 DLLEXPORT ~QoreStaticMethodIterator();
984 DLLEXPORT
bool next();
985 DLLEXPORT
const QoreMethod* getMethod()
const;
988 #endif // _QORE_QORECLASS_H DLLEXPORT const std::string & getNameStr() const
returns the method's name
AbstractQoreNode *(* q_method_t)(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin QoreClass method signatures
Definition: common.h:276
int64(* q_method_int64_t)(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin QoreClass method signatures, returns int64
Definition: common.h:286
To be used to iterate through a class' normal (non-static) methods.
Definition: QoreClass.h:965
DLLEXPORT const char * getClassName() const
returns the class name for the method
void(* q_destructor_t)(QoreObject *self, AbstractPrivateData *private_data, ExceptionSink *xsink)
the type used for builtin QoreClass destructor signatures
Definition: common.h:420
void(* q_copy2_t)(const QoreClass &thisclass, 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:458
AbstractQoreNode *(* q_method3_t)(const QoreMethod &method, const type_vec_t &typeList, const void *ptr, QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin QoreClass method signatures when called with the even newer generic calling...
Definition: common.h:340
QoreValue(* q_method_n_t)(QoreObject *self, AbstractPrivateData *private_data, const QoreValueList *args, q_rt_flags_t flags, ExceptionSink *xsink)
the new type used for builtin QoreClass method signatures
Definition: common.h:266
void(* q_constructor_n_t)(QoreObject *self, const QoreValueList *args, q_rt_flags_t rtflags, ExceptionSink *xsink)
the type used for builtin QoreClass constructor method signatures
Definition: common.h:367
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:402
void(* q_system_constructor2_t)(const QoreClass &thisclass, QoreObject *self, int code, va_list args)
the type used for builtin QoreClass system constructor method signatures using the new generic callin...
Definition: common.h:412
void(* q_destructor2_t)(const QoreClass &thisclass, QoreObject *self, AbstractPrivateData *private_data, ExceptionSink *xsink)
the type used for builtin QoreClass destructor signatures with the new generic calling convention ...
Definition: common.h:429
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreValueList.h:45
int64(* q_func_int64_t)(const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin function signatures returning an integer value
Definition: common.h:250
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:55
void(* q_constructor3_t)(const QoreClass &thisclass, const type_vec_t &typeList, const void *ptr, QoreObject *self, const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin QoreClass constructor method signatures using the even newer generic callin...
Definition: common.h:392
AbstractQoreNode *(* q_static_method3_t)(const QoreMethod &method, const type_vec_t &typeList, const void *ptr, const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin static method signatures for static methods using the even newer generic ca...
Definition: common.h:360
DLLEXPORT bool isUser() const
returns true if all variants of the method are user variants
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 ...
To be used to iterate through a class' static methods.
Definition: QoreClass.h:977
void(* q_constructor_t)(QoreObject *self, const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin QoreClass constructor method signatures
Definition: common.h:374
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:82
std::vector< AbstractQoreNode * > arg_vec_t
vector of value information for default argument lists
Definition: common.h:222
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
QoreValue(* q_func_n_t)(const QoreValueList *args, q_rt_flags_t flags, ExceptionSink *xsink)
the type used for builtin function signatures
Definition: common.h:239
defines a Qore-language class
Definition: QoreClass.h:195
bool(* q_delete_blocker_t)(QoreObject *self, AbstractPrivateData *private_data)
the typed used for QoreClass deleteBlocker signatures
Definition: common.h:477
DLLEXPORT const char * getName() const
returns the method's name
void(* q_copy3_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:469
DLLEXPORT bool newCallingConvention() const
DEPRECATED: always returns false, do not use.
DLLLOCAL bool parseIsPrivate() const
returns true if all overloaded variants of a methods are private, false if at least one variant is pu...
DLLEXPORT const QoreClass * getClass() const
returns a pointer to the parent class
the implementation of Qore's object data type, reference counted, dynamically-allocated only ...
Definition: QoreObject.h:64
unsigned qore_classid_t
used for the unique class ID for QoreClass objects
Definition: common.h:77
bool(* q_method_bool_t)(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin QoreClass method signatures when called with the even newer generic calling...
Definition: common.h:306
static unsigned num_params(const QoreListNode *n)
returns the number of arguments passed to the function
Definition: params.h:62
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:43
double(* q_method_double_t)(QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin QoreClass method signatures when called with the even newer generic calling...
Definition: common.h:316
AbstractQoreNode *(* q_static_method2_t)(const QoreMethod &method, const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin static method signatures for static methods using the new generic calling c...
Definition: common.h:349
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:228
AbstractQoreNode *(* q_func_t)(const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin function signatures
Definition: common.h:247
AbstractQoreNode *(* q_method2_t)(const QoreMethod &method, QoreObject *self, AbstractPrivateData *private_data, const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin QoreClass method signatures when called with the new generic calling conven...
Definition: common.h:327
DLLEXPORT bool isStatic() const
returns true if the method is static
DLLEXPORT bool isPrivate() const
returns true if all overloaded variants of a methods are private, false if at least one variant is pu...
double(* q_func_double_t)(const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin function signatures returning an double value
Definition: common.h:256
DLLEXPORT bool isSynchronized() const
DEPRECATED: always returns false, do not use.
void(* q_copy_t)(QoreObject *self, QoreObject *old, AbstractPrivateData *private_data, ExceptionSink *xsink)
the type used for builtin QoreClass copy signatures
Definition: common.h:448
std::vector< const QoreTypeInfo * > type_vec_t
vector of type information for parameter lists
Definition: common.h:219
a method in a QoreClass
Definition: QoreClass.h:91
void(* q_destructor3_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:439
DLLEXPORT bool existsVariant(const type_vec_t ¶mTypeInfo) const
returns true if a variant with the given parameter signature already exists in the method ...
void(* q_constructor2_t)(const QoreClass &thisclass, QoreObject *self, const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin QoreClass constructor method signatures using the new generic calling conve...
Definition: common.h:382
DLLEXPORT bool isBuiltin() const
returns true if all variants of the method are builtin variants
bool(* q_func_bool_t)(const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin function signatures returning a boolean value
Definition: common.h:253
#define QDOM_DEFAULT
the default domain (no domain)
Definition: Restrictions.h:137