00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _QORE_QORECLASS_H
00024
00025 #define _QORE_QORECLASS_H
00026
00027 #include <stdarg.h>
00028
00029
00030 DLLEXPORT extern qore_classid_t CID_AUTOGATE;
00031 DLLEXPORT extern qore_classid_t CID_AUTOLOCK;
00032 DLLEXPORT extern qore_classid_t CID_AUTOREADLOCK;
00033 DLLEXPORT extern qore_classid_t CID_AUTOWRITELOCK;
00034 DLLEXPORT extern qore_classid_t CID_CONDITION;
00035 DLLEXPORT extern qore_classid_t CID_COUNTER;
00036 DLLEXPORT extern qore_classid_t CID_DATASOURCE;
00037 DLLEXPORT extern qore_classid_t CID_DATASOURCEPOOL;
00038 DLLEXPORT extern qore_classid_t CID_FILE;
00039 DLLEXPORT extern qore_classid_t CID_FTPCLIENT;
00040 DLLEXPORT extern qore_classid_t CID_GATE;
00041 DLLEXPORT extern qore_classid_t CID_GETOPT;
00042 DLLEXPORT extern qore_classid_t CID_HTTPCLIENT;
00043 DLLEXPORT extern qore_classid_t CID_JSONRPCCLIENT;
00044 DLLEXPORT extern qore_classid_t CID_MUTEX;
00045 DLLEXPORT extern qore_classid_t CID_PROGRAM;
00046 DLLEXPORT extern qore_classid_t CID_QUEUE;
00047 DLLEXPORT extern qore_classid_t CID_RWLOCK;
00048 DLLEXPORT extern qore_classid_t CID_SSLCERTIFICATE;
00049 DLLEXPORT extern qore_classid_t CID_SSLPRIVATEKEY;
00050 DLLEXPORT extern qore_classid_t CID_SEQUENCE;
00051 DLLEXPORT extern qore_classid_t CID_SOCKET;
00052 DLLEXPORT extern qore_classid_t CID_XMLRPCCLIENT;
00053
00054 class BCList;
00055 class BCSMList;
00056 class QoreObject;
00057 class QoreClass;
00058 class BCEAList;
00059
00061
00064 class QoreMethod {
00065 friend class QoreObject;
00066 friend class StaticMethodCallNode;
00067
00068 private:
00070 struct qore_method_private *priv;
00071
00073 DLLLOCAL QoreMethod(const QoreMethod&);
00074
00076 DLLLOCAL QoreMethod& operator=(const QoreMethod&);
00077
00079 DLLLOCAL QoreMethod(const QoreClass *p_class, UserFunction *u, bool n_priv, bool n_static);
00080
00082
00088 DLLLOCAL AbstractQoreNode *eval(QoreObject *self, const QoreListNode *args, ExceptionSink *xsink) const;
00089
00090 public:
00092
00095 DLLEXPORT bool isSynchronized() const;
00096
00098
00101 DLLEXPORT bool isUser() const;
00102
00104
00107 DLLEXPORT bool isBuiltin() const;
00108
00110
00113 DLLEXPORT bool isPrivate() const;
00114
00116
00119 DLLEXPORT bool isStatic() const;
00120
00122
00125 DLLEXPORT const char *getName() const;
00126
00128
00131 DLLEXPORT bool newCallingConvention() const;
00132
00134 DLLEXPORT const QoreClass *getClass() const;
00135
00136 DLLLOCAL QoreMethod(UserFunction *u, bool n_priv, bool n_static);
00137 DLLLOCAL QoreMethod(const QoreClass *p_class, BuiltinMethod *b, bool n_priv = false, bool n_static = false);
00138 DLLLOCAL QoreMethod(const QoreClass *p_class, BuiltinMethod *b, bool n_priv, bool n_static, bool new_calling_convention);
00139 DLLLOCAL ~QoreMethod();
00140 DLLLOCAL int getType() const;
00141 DLLLOCAL bool inMethod(const QoreObject *self) const;
00142 DLLLOCAL void evalConstructor(QoreObject *self, const QoreListNode *args, BCList *bcl, BCEAList *bceal, ExceptionSink *xsink) const;
00143
00144 DLLLOCAL void evalDestructor(QoreObject *self, ExceptionSink *xsink) const;
00145 DLLLOCAL void evalSystemConstructor(QoreObject *self, int code, va_list args) const;
00146 DLLLOCAL void evalSystemDestructor(QoreObject *self, ExceptionSink *xsink) const;
00147 DLLLOCAL void evalCopy(QoreObject *self, QoreObject *old, ExceptionSink *xsink) const;
00148 DLLLOCAL bool evalDeleteBlocker(QoreObject *self) const;
00149 DLLLOCAL QoreMethod *copy(const class QoreClass *p_class) const;
00150 DLLLOCAL void parseInit();
00151 DLLLOCAL void parseInitConstructor(BCList *bcl);
00152 DLLLOCAL void assign_class(const QoreClass *p_class);
00153 DLLLOCAL const BuiltinFunction *getStaticBuiltinFunction() const;
00154 DLLLOCAL const UserFunction *getStaticUserFunction() const;
00155 DLLLOCAL bool existsUserParam(int i) const;
00156 };
00157
00159
00163 class QoreClass {
00164 friend class BCList;
00165 friend class BCSMList;
00166 friend class QoreObject;
00167
00168 private:
00170 DLLLOCAL QoreClass(const QoreClass&);
00171
00173 DLLLOCAL QoreClass& operator=(const QoreClass&);
00174
00176 struct qore_qc_private *priv;
00177
00178
00179 DLLLOCAL QoreClass(qore_classid_t id, const char *nme);
00180
00181
00182 DLLLOCAL const QoreMethod *parseFindMethod(const char *name);
00183
00184
00185 DLLLOCAL const QoreMethod *parseFindStaticMethod(const char *name);
00186
00187 DLLLOCAL void insertMethod(QoreMethod *o);
00188 DLLLOCAL void insertStaticMethod(QoreMethod *o);
00189 DLLLOCAL AbstractQoreNode *evalMethodGate(QoreObject *self, const char *nme, const QoreListNode *args, ExceptionSink *xsink) const;
00190 DLLLOCAL const QoreMethod *resolveSelfMethodIntern(const char *nme);
00191 DLLLOCAL BCAList *getBaseClassConstructorArgumentList() const;
00192
00194
00203 DLLLOCAL AbstractQoreNode *evalMethod(QoreObject *self, const char *method_name, const QoreListNode *args, ExceptionSink *xsink) const;
00204
00205 DLLLOCAL AbstractQoreNode *evalMemberGate(QoreObject *self, const QoreString *nme, ExceptionSink *xsink) const;
00206
00207 DLLLOCAL void execMemberNotification(QoreObject *self, const char *mem, ExceptionSink *xsink) const;
00208
00209 DLLLOCAL bool execDeleteBlocker(QoreObject *self, ExceptionSink *xsink) const;
00210
00211 DLLLOCAL void execSubclassConstructor(QoreObject *self, BCEAList *bceal, ExceptionSink *xsink) const;
00212
00213 DLLLOCAL void execDestructor(QoreObject *self, ExceptionSink *xsink) const;
00214
00215 DLLLOCAL void execSubclassDestructor(QoreObject *self, ExceptionSink *xsink) const;
00216
00217 DLLLOCAL void execSubclassSystemDestructor(QoreObject *self, ExceptionSink *xsink) const;
00218
00219 DLLLOCAL void execSubclassCopy(QoreObject *self, QoreObject *old, ExceptionSink *xsink) const;
00220
00221 public:
00223
00228 DLLEXPORT QoreClass(const char *n_name, int n_domain = QDOM_DEFAULT);
00229
00231 DLLEXPORT ~QoreClass();
00232
00234
00255 DLLEXPORT void addMethod(const char *n_name, q_method_t meth, bool priv = false);
00256
00258 DLLEXPORT void addMethod2(const char *n_name, q_method2_t meth, bool priv = false);
00259
00261
00266 DLLEXPORT void addStaticMethod(const char *n_name, q_func_t meth, bool priv = false);
00267
00269 DLLEXPORT void addStaticMethod2(const char *n_name, q_static_method2_t meth, bool priv = false);
00270
00272
00283 DLLEXPORT void setDestructor(q_destructor_t m);
00284
00286
00297 DLLEXPORT void setDestructor2(q_destructor2_t m);
00298
00300
00303 DLLEXPORT void setConstructor(q_constructor_t m);
00304
00306
00309 DLLEXPORT void setConstructor2(q_constructor2_t m);
00310
00312
00315 DLLEXPORT void setSystemConstructor(q_system_constructor_t m);
00316
00318
00321 DLLEXPORT void setSystemConstructor2(q_system_constructor2_t m);
00322
00324
00335 DLLEXPORT void setCopy(q_copy_t m);
00336
00338
00349 DLLEXPORT void setCopy2(q_copy2_t m);
00350
00352
00357 DLLEXPORT void setDeleteBlocker(q_delete_blocker_t m);
00358
00360
00363 DLLEXPORT void addPrivateMember(char *name);
00364
00366
00370 DLLEXPORT bool isPrivateMember(const char *str) const;
00371
00373
00378 DLLEXPORT QoreObject *execConstructor(const QoreListNode *args, ExceptionSink *xsink) const;
00379
00381
00385 DLLEXPORT QoreObject *execSystemConstructor(int code = 0, ...) const;
00386
00388
00392 DLLEXPORT QoreObject *execCopy(QoreObject *old, ExceptionSink *xsink) const;
00393
00395
00398 DLLEXPORT const QoreMethod *findLocalMethod(const char *name) const;
00399
00401
00404 DLLEXPORT const QoreMethod *findLocalStaticMethod(const char *name) const;
00405
00407
00410 DLLEXPORT QoreListNode *getMethodList() const;
00411
00413
00416 DLLEXPORT QoreListNode *getStaticMethodList() const;
00417
00419
00425 DLLEXPORT QoreClass *getClass(qore_classid_t cid) const;
00426
00428 DLLEXPORT int numMethods() const;
00429
00431 DLLEXPORT int numStaticMethods() const;
00432
00434 DLLEXPORT int numUserMethods() const;
00435
00437 DLLEXPORT int numStaticUserMethods() const;
00438
00440 DLLEXPORT bool hasCopy() const;
00441
00443 DLLEXPORT qore_classid_t getID() const;
00444
00446 DLLEXPORT bool isSystem() const;
00447
00449 DLLEXPORT bool hasMemberGate() const;
00450
00452 DLLEXPORT bool hasMemberNotification() const;
00453
00455 DLLEXPORT int getDomain() const;
00456
00458 DLLEXPORT const char *getName() const;
00459
00461
00462 DLLEXPORT const QoreMethod *findMethod(const char *nme) const;
00463
00465
00466 DLLEXPORT const QoreMethod *findStaticMethod(const char *nme) const;
00467
00469 DLLEXPORT const QoreMethod *findMethod(const char *nme, bool &priv) const;
00470
00472 DLLEXPORT const QoreMethod *findStaticMethod(const char *nme, bool &priv) const;
00473
00475
00482 DLLEXPORT void addBuiltinBaseClass(QoreClass *qc, class QoreListNode *xargs = 0);
00483
00485
00491 DLLEXPORT void addDefaultBuiltinBaseClass(QoreClass *qc, class QoreListNode *xargs = 0);
00492
00494
00500 DLLEXPORT void addBuiltinVirtualBaseClass(QoreClass *qc);
00501
00503
00505 DLLEXPORT void setSynchronousClass();
00506
00508
00511 DLLEXPORT const QoreMethod *getConstructor() const;
00512
00514
00517 DLLEXPORT const QoreMethod *getSystemConstructor() const;
00518
00520
00523 DLLEXPORT const QoreMethod *getDestructor() const;
00524
00526
00529 DLLEXPORT const QoreMethod *getCopyMethod() const;
00530
00532
00535 DLLEXPORT const QoreMethod *getMemberGateMethod() const;
00536
00538
00541 DLLEXPORT const QoreMethod *getMethodGate() const;
00542
00544
00547 DLLEXPORT const QoreMethod *getMemberNotificationMethod() const;
00548
00549 DLLLOCAL QoreClass();
00550 DLLLOCAL void addMethod(QoreMethod *f);
00551 DLLLOCAL const QoreMethod *resolveSelfMethod(const char *nme);
00552 DLLLOCAL const QoreMethod *resolveSelfMethod(class NamedScope *nme);
00553 DLLLOCAL void addDomain(int dom);
00554 DLLLOCAL QoreClass *copyAndDeref();
00555 DLLLOCAL void addBaseClassesToSubclass(QoreClass *sc, bool is_virtual);
00556
00557
00558 DLLLOCAL const QoreMethod *findParseMethod(const char *nme);
00559
00560
00561 DLLLOCAL const QoreMethod *findParseStaticMethod(const char *nme);
00562
00563
00564 DLLLOCAL int parseAddBaseClassArgumentList(class BCAList *bcal);
00565
00566 DLLLOCAL void setName(const char *n);
00567
00568 DLLLOCAL bool is_unique() const;
00569
00570 DLLLOCAL QoreClass *getReference();
00571
00572 DLLLOCAL void nderef();
00573 DLLLOCAL void parseInit();
00574 DLLLOCAL void parseCommit();
00575 DLLLOCAL void parseRollback();
00576 DLLLOCAL qore_classid_t getIDForMethod() const;
00577 DLLLOCAL void parseSetBaseClassList(BCList *bcl);
00578
00579 DLLLOCAL BCSMList *getBCSMList() const;
00580
00581 DLLLOCAL bool has_delete_blocker() const;
00582
00583 DLLLOCAL bool has_synchronous_in_hierarchy() const;
00584
00585 DLLLOCAL bool is_synchronous_class() const;
00586
00587 DLLLOCAL void initialize();
00588
00589 DLLLOCAL const QoreMethod *parseFindMethodTree(const char *name);
00590
00591 DLLLOCAL const QoreMethod *parseFindStaticMethodTree(const char *name);
00592
00593 DLLLOCAL bool parseCheckHierarchy(const QoreClass *cls) const;
00594 };
00595
00596 #endif // _QORE_QORECLASS_H