00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _QORE_QORECLASS_H
00025
00026 #define _QORE_QORECLASS_H
00027
00028 #include <stdarg.h>
00029
00030
00031 DLLEXPORT extern qore_classid_t CID_AUTOGATE;
00032 DLLEXPORT extern qore_classid_t CID_AUTOLOCK;
00033 DLLEXPORT extern qore_classid_t CID_AUTOREADLOCK;
00034 DLLEXPORT extern qore_classid_t CID_AUTOWRITELOCK;
00035 DLLEXPORT extern qore_classid_t CID_CONDITION;
00036 DLLEXPORT extern qore_classid_t CID_COUNTER;
00037 DLLEXPORT extern qore_classid_t CID_DATASOURCE;
00038 DLLEXPORT extern qore_classid_t CID_DATASOURCEPOOL;
00039 DLLEXPORT extern qore_classid_t CID_FILE;
00040 DLLEXPORT extern qore_classid_t CID_FTPCLIENT;
00041 DLLEXPORT extern qore_classid_t CID_GATE;
00042 DLLEXPORT extern qore_classid_t CID_GETOPT;
00043 DLLEXPORT extern qore_classid_t CID_HTTPCLIENT;
00044 DLLEXPORT extern qore_classid_t CID_JSONRPCCLIENT;
00045 DLLEXPORT extern qore_classid_t CID_MUTEX;
00046 DLLEXPORT extern qore_classid_t CID_PROGRAM;
00047 DLLEXPORT extern qore_classid_t CID_QUEUE;
00048 DLLEXPORT extern qore_classid_t CID_RWLOCK;
00049 DLLEXPORT extern qore_classid_t CID_SSLCERTIFICATE;
00050 DLLEXPORT extern qore_classid_t CID_SSLPRIVATEKEY;
00051 DLLEXPORT extern qore_classid_t CID_SEQUENCE;
00052 DLLEXPORT extern qore_classid_t CID_SOCKET;
00053 DLLEXPORT extern qore_classid_t CID_XMLRPCCLIENT;
00054 DLLEXPORT extern qore_classid_t CID_TERMIOS;
00055
00056 class BCList;
00057 class BCSMList;
00058 class BCAList;
00059 class QoreObject;
00060 class QoreClass;
00061 class BCEAList;
00062 class ParamList;
00063 class QoreMemberInfo;
00064 class BuiltinMethod;
00065 class AbstractQoreFunction;
00066 class AbstractQoreFunctionVariant;
00067 class AbstractFunctionSignature;
00068 class UserMethod;
00069 class BCANode;
00070 class qore_method_private;
00071 class MethodFunctionBase;
00072 class QoreExternalMethodVariant;
00073 class QoreExternalStaticMethodVariant;
00074
00076
00079 class QoreMethod {
00080 friend class StaticMethodCallNode;
00081 friend class QoreObject;
00082 friend class qore_class_private;
00083
00084 private:
00086 struct qore_method_private *priv;
00087
00089 DLLLOCAL QoreMethod(const QoreMethod&);
00090
00092 DLLLOCAL QoreMethod& operator=(const QoreMethod&);
00093
00094 public:
00096
00099 DLLEXPORT bool isSynchronized() const;
00100
00102
00105 DLLEXPORT bool newCallingConvention() const;
00106
00108
00110 DLLEXPORT bool isUser() const;
00111
00113
00115 DLLEXPORT bool isBuiltin() const;
00116
00118
00120 DLLEXPORT bool isPrivate() const;
00121
00123
00126 DLLEXPORT bool isStatic() const;
00127
00129
00132 DLLEXPORT const char *getName() const;
00133
00135 DLLEXPORT const QoreClass *getClass() const;
00136
00138 DLLEXPORT const char *getClassName() const;
00139
00141 DLLEXPORT bool existsVariant(const type_vec_t ¶mTypeInfo) const;
00142
00143
00144
00145
00146
00147 DLLEXPORT const QoreTypeInfo *getUniqueReturnTypeInfo() const;
00148
00149 DLLLOCAL QoreMethod(const QoreClass *p_class, MethodFunctionBase *n_func, bool n_static = false);
00150
00151 DLLLOCAL ~QoreMethod();
00152 DLLLOCAL bool inMethod(const QoreObject *self) const;
00153 DLLLOCAL QoreMethod *copy(const QoreClass *p_class) const;
00154 DLLLOCAL void assign_class(const QoreClass *p_class);
00155 DLLLOCAL MethodFunctionBase *getFunction() const;
00156
00158
00160 DLLLOCAL bool parseIsPrivate() const;
00161
00163
00169 DLLLOCAL AbstractQoreNode *eval(QoreObject *self, const QoreListNode *args, ExceptionSink *xsink) const;
00170 DLLLOCAL AbstractQoreNode *evalNormalVariant(QoreObject *self, const QoreExternalMethodVariant *ev, const QoreListNode *args, ExceptionSink *xsink) const;
00171 };
00172
00174
00178 class QoreClass {
00179 friend class BCList;
00180 friend class BCNode;
00181 friend class BCSMList;
00182 friend class qore_object_private;
00183 friend class QoreObject;
00184 friend class BCANode;
00185 friend class qore_method_private;
00186 friend class QoreMethodIterator;
00187 friend class QoreStaticMethodIterator;
00188
00189 private:
00191 DLLLOCAL QoreClass& operator=(const QoreClass&);
00192
00194 struct qore_class_private *priv;
00195
00196
00197 DLLLOCAL QoreClass(qore_classid_t id, const char *nme);
00198
00199 DLLLOCAL void insertMethod(QoreMethod *o);
00200 DLLLOCAL void insertStaticMethod(QoreMethod *o);
00201 DLLLOCAL AbstractQoreNode *evalMethodGate(QoreObject *self, const char *nme, const QoreListNode *args, ExceptionSink *xsink) const;
00202 DLLLOCAL const QoreMethod *parseResolveSelfMethodIntern(const char *nme);
00203
00205
00214 DLLLOCAL AbstractQoreNode *evalMethod(QoreObject *self, const char *method_name, const QoreListNode *args, ExceptionSink *xsink) const;
00215
00216 DLLLOCAL AbstractQoreNode *evalMemberGate(QoreObject *self, const QoreString *nme, ExceptionSink *xsink) const;
00217
00218 DLLLOCAL void execMemberNotification(QoreObject *self, const char *mem, ExceptionSink *xsink) const;
00219
00220 DLLLOCAL bool execDeleteBlocker(QoreObject *self, ExceptionSink *xsink) const;
00221
00222 DLLLOCAL void execDestructor(QoreObject *self, ExceptionSink *xsink) const;
00223
00224 DLLEXPORT const QoreClass *getClassIntern(qore_classid_t cid, bool &priv) const;
00225
00226 public:
00228
00233 DLLEXPORT QoreClass(const char *n_name, int n_domain = QDOM_DEFAULT);
00234
00236
00243 DLLEXPORT QoreClass(const char *n_name, int64 n_domain, const QoreTypeInfo *n_typeInfo);
00244
00246 DLLEXPORT ~QoreClass();
00247
00249
00270 DLLEXPORT void addMethod(const char *n_name, q_method_t meth, bool priv = false);
00271
00273 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, ...);
00274
00276 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());
00277
00279 DLLEXPORT void addMethod2(const char *n_name, q_method2_t meth, bool priv = false);
00280
00282 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, ...);
00283
00285 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());
00286
00288
00298 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());
00299
00301
00306 DLLEXPORT void addStaticMethod(const char *n_name, q_func_t meth, bool priv = false);
00307
00309 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, ...);
00310
00312 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());
00313
00315 DLLEXPORT void addStaticMethod2(const char *n_name, q_static_method2_t meth, bool priv = false);
00316
00318 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, ...);
00319
00321 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());
00322
00324
00334 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());
00335
00337
00348 DLLEXPORT void setDestructor(q_destructor_t m);
00349
00351
00362 DLLEXPORT void setDestructor2(q_destructor2_t m);
00363
00365
00377 DLLEXPORT void setDestructor3(const void *ptr, q_destructor3_t m);
00378
00380
00383 DLLEXPORT void setConstructor(q_constructor_t m);
00384
00386 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, ...);
00387
00389 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());
00390
00392
00395 DLLEXPORT void setConstructor2(q_constructor2_t m);
00396
00398 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, ...);
00399
00401 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());
00402
00404
00412 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());
00413
00415
00418 DLLEXPORT void setSystemConstructor(q_system_constructor_t m);
00419
00421
00424 DLLEXPORT void setSystemConstructor2(q_system_constructor2_t m);
00425
00427
00438 DLLEXPORT void setCopy(q_copy_t m);
00439
00441
00452 DLLEXPORT void setCopy2(q_copy2_t m);
00453
00455
00467 DLLEXPORT void setCopy3(const void *ptr, q_copy3_t m);
00468
00470
00478 DLLEXPORT void setDeleteBlocker(q_delete_blocker_t m);
00479
00481
00485 DLLEXPORT bool isPrivateMember(const char *str) const;
00486
00488
00493 DLLEXPORT bool isPublicOrPrivateMember(const char *str, bool &priv) const;
00494
00496
00501 DLLEXPORT QoreObject *execConstructor(const QoreListNode *args, ExceptionSink *xsink) const;
00502
00504
00508 DLLEXPORT QoreObject *execSystemConstructor(int code = 0, ...) const;
00509
00511
00515 DLLEXPORT QoreObject *execCopy(QoreObject *old, ExceptionSink *xsink) const;
00516
00518
00523 DLLEXPORT const QoreMethod *findLocalMethod(const char *name) const;
00524
00526
00531 DLLEXPORT const QoreMethod *findLocalStaticMethod(const char *name) const;
00532
00534
00537 DLLEXPORT QoreListNode *getMethodList() const;
00538
00540
00543 DLLEXPORT QoreListNode *getStaticMethodList() const;
00544
00546
00554 DLLEXPORT QoreClass *getClass(qore_classid_t cid) const;
00555
00557
00564 DLLEXPORT const QoreClass *getClass(qore_classid_t cid, bool &priv) const;
00565
00567 DLLEXPORT int numMethods() const;
00568
00570 DLLEXPORT int numStaticMethods() const;
00571
00573 DLLEXPORT int numUserMethods() const;
00574
00576 DLLEXPORT int numStaticUserMethods() const;
00577
00579 DLLEXPORT bool hasCopy() const;
00580
00582 DLLEXPORT qore_classid_t getID() const;
00583
00585 DLLEXPORT bool isSystem() const;
00586
00588 DLLEXPORT bool hasMemberGate() const;
00589
00591 DLLEXPORT bool hasMethodGate() const;
00592
00594 DLLEXPORT bool hasMemberNotification() const;
00595
00597
00599 DLLEXPORT int getDomain() const;
00600
00602
00604 DLLEXPORT int64 getDomain64() const;
00605
00607 DLLEXPORT const char *getName() const;
00608
00610
00611 DLLEXPORT const QoreMethod *findMethod(const char *nme) const;
00612
00614
00615 DLLEXPORT const QoreMethod *findStaticMethod(const char *nme) const;
00616
00618 DLLEXPORT const QoreMethod *findMethod(const char *nme, bool &priv) const;
00619
00621 DLLEXPORT const QoreMethod *findStaticMethod(const char *nme, bool &priv) const;
00622
00624
00628 DLLEXPORT void addBuiltinBaseClass(QoreClass *qc, QoreListNode *xargs = 0);
00629
00631
00637 DLLEXPORT void addDefaultBuiltinBaseClass(QoreClass *qc, QoreListNode *xargs = 0);
00638
00640
00646 DLLEXPORT void addBuiltinVirtualBaseClass(QoreClass *qc);
00647
00649
00651 DLLEXPORT void setSynchronousClass();
00652
00654
00657 DLLEXPORT const QoreMethod *getConstructor() const;
00658
00660
00663 DLLEXPORT const QoreMethod *getSystemConstructor() const;
00664
00666
00669 DLLEXPORT const QoreMethod *getDestructor() const;
00670
00672
00675 DLLEXPORT const QoreMethod *getCopyMethod() const;
00676
00678
00681 DLLEXPORT const QoreMethod *getMemberGateMethod() const;
00682
00684
00687 DLLEXPORT const QoreMethod *getMethodGate() const;
00688
00690
00693 DLLEXPORT const QoreMethod *getMemberNotificationMethod() const;
00694
00696 DLLEXPORT const QoreTypeInfo *getTypeInfo() const;
00697
00699 DLLEXPORT void addPublicMember(const char *mem, const QoreTypeInfo *n_typeInfo, AbstractQoreNode *initial_value = 0);
00700
00702 DLLEXPORT void addPrivateMember(const char *mem, const QoreTypeInfo *n_typeInfo, AbstractQoreNode *initial_value = 0);
00703
00705 DLLEXPORT void setUserData(const void *ptr);
00706
00708 DLLEXPORT const void *getUserData() const;
00709
00711 DLLEXPORT void recheckBuiltinMethodHierarchy();
00712
00714
00716 DLLEXPORT const QoreExternalMethodVariant *findUserMethodVariant(const char *name, const QoreMethod *&method, const type_vec_t &argTypeList) const;
00717
00718 DLLLOCAL QoreClass();
00719
00720
00721 DLLLOCAL QoreClass(const QoreClass &old);
00722
00723 DLLLOCAL void addMethod(QoreMethod *f);
00724 DLLLOCAL const QoreMethod *parseResolveSelfMethod(const char *nme);
00725 DLLLOCAL const QoreMethod *parseResolveSelfMethod(NamedScope *nme);
00726 DLLLOCAL void addDomain(int64 dom);
00727 DLLLOCAL void addBaseClassesToSubclass(QoreClass *sc, bool is_virtual);
00728
00729
00730 DLLLOCAL const QoreMethod *parseFindCommittedMethod(const char *nme);
00731
00733
00737 DLLLOCAL void parseAddPrivateMember(char *name, QoreMemberInfo *mInfo);
00738
00740
00744 DLLLOCAL void parseAddPublicMember(char *name, QoreMemberInfo *mInfo);
00745
00746
00747 DLLLOCAL int parseAddBaseClassArgumentList(BCAList *bcal);
00748
00749 DLLLOCAL void setName(const char *n);
00750
00751 DLLLOCAL void parseInit();
00752 DLLLOCAL void parseCommit();
00753 DLLLOCAL void parseRollback();
00754 DLLLOCAL void resolveCopy();
00755 DLLLOCAL qore_classid_t getIDForMethod() const;
00756 DLLLOCAL void parseSetBaseClassList(BCList *bcl);
00757
00758 DLLLOCAL BCSMList *getBCSMList() const;
00759
00760 DLLLOCAL bool has_delete_blocker() const;
00761
00762 DLLLOCAL void initialize();
00763
00764 DLLLOCAL const QoreMethod *parseFindLocalMethod(const char *name) const;
00765
00766 DLLLOCAL const QoreMethod *parseFindMethodTree(const char *name);
00767
00768 DLLLOCAL const QoreMethod *parseFindStaticMethodTree(const char *name);
00769
00770 DLLLOCAL bool parseCheckHierarchy(const QoreClass *cls) const;
00771
00772 DLLLOCAL int parseCheckMemberAccess(const char *mem, const QoreTypeInfo *&memberTypeInfo, int pflag) const;
00773
00774 DLLLOCAL int parseCheckInternalMemberAccess(const char *mem, const QoreTypeInfo *&typeInfo) const;
00775
00776 DLLLOCAL const QoreClass *parseFindPublicPrivateMember(const char *mem, const QoreTypeInfo *&memberTypeInfo, bool &member_has_type_info, bool &priv) const;
00777 DLLLOCAL bool parseHasPublicMembersInHierarchy() const;
00778 DLLLOCAL bool runtimeGetMemberInfo(const char *mem, const QoreTypeInfo *&memberTypeInfo, bool &priv) const;
00779 DLLLOCAL bool runtimeHasPublicMembersInHierarchy() const;
00780 DLLLOCAL int initMembers(QoreObject *o, ExceptionSink *xsink) const;
00781 DLLLOCAL const QoreClass *parseGetClass(qore_classid_t cid, bool &priv) const;
00782 DLLLOCAL int addUserMethod(const char *mname, MethodVariantBase *f, bool n_static);
00783
00784 DLLLOCAL bool hasParentClass() const;
00785 DLLLOCAL QoreObject *execConstructor(const AbstractQoreFunctionVariant *variant, const QoreListNode *args, ExceptionSink *xsink) const;
00786 DLLLOCAL bool hasPrivateCopyMethod() const;
00787
00788 DLLLOCAL bool parseHasPrivateCopyMethod() const;
00789 DLLLOCAL const QoreMethod *parseGetConstructor() const;
00790
00791 DLLLOCAL bool parseHasMethodGate() const;
00792
00793 DLLLOCAL void parseSetEmptyPublicMemberDeclaration();
00794
00795 DLLLOCAL void unsetPublicMemberFlag();
00796 DLLLOCAL void parseInitPartial();
00797 };
00798
00800 class QoreMethodIterator {
00801 private:
00802 void *priv;
00803
00804 public:
00805 DLLEXPORT QoreMethodIterator(const QoreClass *qc);
00806 DLLEXPORT ~QoreMethodIterator();
00807 DLLEXPORT bool next();
00808 DLLEXPORT const QoreMethod *getMethod() const;
00809 };
00810
00812 class QoreStaticMethodIterator {
00813 private:
00814 void *priv;
00815
00816 public:
00817 DLLEXPORT QoreStaticMethodIterator(const QoreClass *qc);
00818 DLLEXPORT ~QoreStaticMethodIterator();
00819 DLLEXPORT bool next();
00820 DLLEXPORT const QoreMethod *getMethod() const;
00821 };
00822
00823 #endif // _QORE_QORECLASS_H