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
00060
00063 class QoreMethod {
00064 friend class QoreObject;
00065 friend class StaticMethodCallNode;
00066
00067 private:
00069 struct qore_method_private *priv;
00070
00072 DLLLOCAL QoreMethod(const QoreMethod&);
00073
00075 DLLLOCAL QoreMethod& operator=(const QoreMethod&);
00076
00078 DLLLOCAL QoreMethod(const QoreClass *p_class, UserFunction *u, bool n_priv, bool n_static);
00079
00081
00087 DLLLOCAL AbstractQoreNode *eval(QoreObject *self, const QoreListNode *args, ExceptionSink *xsink) const;
00088
00089 public:
00091
00094 DLLEXPORT bool isSynchronized() const;
00095
00097
00100 DLLEXPORT bool isUser() const;
00101
00103
00106 DLLEXPORT bool isBuiltin() const;
00107
00109
00112 DLLEXPORT bool isPrivate() const;
00113
00115
00118 DLLEXPORT bool isStatic() const;
00119
00121
00124 DLLEXPORT const char *getName() const;
00125
00126 DLLLOCAL QoreMethod(UserFunction *u, bool n_priv, bool n_static);
00127 DLLLOCAL QoreMethod(const QoreClass *p_class, BuiltinMethod *b, bool n_priv = false, bool n_static = false);
00128 DLLLOCAL ~QoreMethod();
00129 DLLLOCAL int getType() const;
00130 DLLLOCAL bool inMethod(const QoreObject *self) const;
00131 DLLLOCAL void evalConstructor(QoreObject *self, const QoreListNode *args, BCList *bcl, class BCEAList *bceal, ExceptionSink *xsink) const;
00132 DLLLOCAL void evalDestructor(QoreObject *self, ExceptionSink *xsink) const;
00133 DLLLOCAL void evalSystemConstructor(QoreObject *self, int code, va_list args) const;
00134 DLLLOCAL void evalSystemDestructor(QoreObject *self, ExceptionSink *xsink) const;
00135 DLLLOCAL void evalCopy(QoreObject *self, QoreObject *old, ExceptionSink *xsink) const;
00136 DLLLOCAL bool evalDeleteBlocker(QoreObject *self) const;
00137 DLLLOCAL QoreMethod *copy(const class QoreClass *p_class) const;
00138 DLLLOCAL void parseInit();
00139 DLLLOCAL void parseInitConstructor(BCList *bcl);
00140 DLLLOCAL const QoreClass *get_class() const;
00141 DLLLOCAL void assign_class(const QoreClass *p_class);
00142 DLLLOCAL const BuiltinFunction *getStaticBuiltinFunction() const;
00143 DLLLOCAL const UserFunction *getStaticUserFunction() const;
00144 DLLLOCAL bool existsUserParam(int i) const;
00145 };
00146
00148
00152 class QoreClass {
00153 friend class BCList;
00154 friend class BCSMList;
00155 friend class QoreObject;
00156
00157 private:
00159 DLLLOCAL QoreClass(const QoreClass&);
00160
00162 DLLLOCAL QoreClass& operator=(const QoreClass&);
00163
00165 struct qore_qc_private *priv;
00166
00167
00168 DLLLOCAL QoreClass(qore_classid_t id, const char *nme);
00169
00170
00171 DLLLOCAL const QoreMethod *parseFindMethod(const char *name);
00172
00173 DLLLOCAL void insertMethod(class QoreMethod *o);
00174 DLLLOCAL AbstractQoreNode *evalMethodGate(QoreObject *self, const char *nme, const QoreListNode *args, ExceptionSink *xsink) const;
00175 DLLLOCAL const QoreMethod *resolveSelfMethodIntern(const char *nme);
00176 DLLLOCAL BCAList *getBaseClassConstructorArgumentList() const;
00177
00179
00188 DLLLOCAL AbstractQoreNode *evalMethod(QoreObject *self, const char *method_name, const QoreListNode *args, ExceptionSink *xsink) const;
00189
00190 DLLLOCAL AbstractQoreNode *evalMemberGate(QoreObject *self, const QoreString *nme, ExceptionSink *xsink) const;
00191
00192 DLLLOCAL void execMemberNotification(QoreObject *self, const char *mem, ExceptionSink *xsink) const;
00193
00194 DLLLOCAL bool execDeleteBlocker(QoreObject *self, ExceptionSink *xsink) const;
00195
00196 DLLLOCAL void execSubclassConstructor(QoreObject *self, class BCEAList *bceal, ExceptionSink *xsink) const;
00197
00198 DLLLOCAL void execDestructor(QoreObject *self, ExceptionSink *xsink) const;
00199
00200 DLLLOCAL void execSubclassDestructor(QoreObject *self, ExceptionSink *xsink) const;
00201
00202 DLLLOCAL void execSubclassSystemDestructor(QoreObject *self, ExceptionSink *xsink) const;
00203
00204 DLLLOCAL void execSubclassCopy(QoreObject *self, QoreObject *old, ExceptionSink *xsink) const;
00205
00206 public:
00208
00213 DLLEXPORT QoreClass(const char *n_name, int n_domain = QDOM_DEFAULT);
00214
00216 DLLEXPORT ~QoreClass();
00217
00219
00240 DLLEXPORT void addMethod(const char *n_name, q_method_t meth, bool priv = false);
00241
00243
00248 DLLEXPORT void addStaticMethod(const char *n_name, q_func_t meth, bool priv = false);
00249
00251
00262 DLLEXPORT void setDestructor(q_destructor_t m);
00263
00265
00268 DLLEXPORT void setConstructor(q_constructor_t m);
00269
00271
00274 DLLEXPORT void setSystemConstructor(q_system_constructor_t m);
00275
00277
00288 DLLEXPORT void setCopy(q_copy_t m);
00289
00291
00296 DLLEXPORT void setDeleteBlocker(q_delete_blocker_t m);
00297
00299
00302 DLLEXPORT void addPrivateMember(char *name);
00303
00305
00309 DLLEXPORT bool isPrivateMember(const char *str) const;
00310
00312
00317 DLLEXPORT QoreObject *execConstructor(const QoreListNode *args, ExceptionSink *xsink) const;
00318
00320
00324 DLLEXPORT QoreObject *execSystemConstructor(int code = 0, ...) const;
00325
00327
00331 DLLEXPORT QoreObject *execCopy(QoreObject *old, ExceptionSink *xsink) const;
00332
00334
00337 DLLEXPORT const QoreMethod *findLocalMethod(const char *name) const;
00338
00340
00343 DLLEXPORT QoreListNode *getMethodList() const;
00344
00346
00352 DLLEXPORT QoreClass *getClass(qore_classid_t cid) const;
00353
00355 DLLEXPORT int numMethods() const;
00356
00358 DLLEXPORT bool hasCopy() const;
00359
00361 DLLEXPORT qore_classid_t getID() const;
00362
00364 DLLEXPORT bool isSystem() const;
00365
00367 DLLEXPORT bool hasMemberGate() const;
00368
00370 DLLEXPORT bool hasMemberNotification() const;
00371
00373 DLLEXPORT int getDomain() const;
00374
00376 DLLEXPORT const char *getName() const;
00377
00379
00380 DLLEXPORT const QoreMethod *findMethod(const char *nme) const;
00381
00383 DLLEXPORT const QoreMethod *findMethod(const char *nme, bool &priv) const;
00384
00386
00393 DLLEXPORT void addBuiltinBaseClass(QoreClass *qc, class QoreListNode *xargs = 0);
00394
00396
00402 DLLEXPORT void addDefaultBuiltinBaseClass(QoreClass *qc, class QoreListNode *xargs = 0);
00403
00405
00411 DLLEXPORT void addBuiltinVirtualBaseClass(QoreClass *qc);
00412
00414
00416 DLLEXPORT void setSynchronousClass();
00417
00418 DLLLOCAL QoreClass();
00419 DLLLOCAL void addMethod(QoreMethod *f);
00420 DLLLOCAL const QoreMethod *resolveSelfMethod(const char *nme);
00421 DLLLOCAL const QoreMethod *resolveSelfMethod(class NamedScope *nme);
00422 DLLLOCAL void addDomain(int dom);
00423 DLLLOCAL QoreClass *copyAndDeref();
00424 DLLLOCAL void addBaseClassesToSubclass(QoreClass *sc, bool is_virtual);
00425
00426
00427 DLLLOCAL const QoreMethod *findParseMethod(const char *nme);
00428
00429
00430 DLLLOCAL int parseAddBaseClassArgumentList(class BCAList *bcal);
00431
00432 DLLLOCAL void setName(const char *n);
00433
00434 DLLLOCAL bool is_unique() const;
00435
00436 DLLLOCAL QoreClass *getReference();
00437
00438 DLLLOCAL void nderef();
00439 DLLLOCAL void parseInit();
00440 DLLLOCAL void parseCommit();
00441 DLLLOCAL void parseRollback();
00442 DLLLOCAL qore_classid_t getIDForMethod() const;
00443 DLLLOCAL void parseSetBaseClassList(BCList *bcl);
00444
00445 DLLLOCAL BCSMList *getBCSMList() const;
00446
00447 DLLLOCAL bool has_delete_blocker() const;
00448
00449 DLLLOCAL bool has_synchronous_in_hierarchy() const;
00450
00451 DLLLOCAL bool is_synchronous_class() const;
00452
00453 DLLLOCAL void initialize();
00454
00455 DLLLOCAL const QoreMethod *parseFindMethodTree(const char *name);
00456
00457 DLLLOCAL bool parseCheckHierarchy(const QoreClass *cls) const;
00458 };
00459
00460 #endif // _QORE_QORECLASS_H