Qore Programming Language  0.9.4.6
QoreClass.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreClass.h
4 
5  Qore Programming Language
6 
7  Copyright (C) 2003 - 2020 Qore Technologies, s.r.o.
8 
9  Permission is hereby granted, free of charge, to any person obtaining a
10  copy of this software and associated documentation files (the "Software"),
11  to deal in the Software without restriction, including without limitation
12  the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  and/or sell copies of the Software, and to permit persons to whom the
14  Software is furnished to do so, subject to the following conditions:
15 
16  The above copyright notice and this permission notice shall be included in
17  all copies or substantial portions of the Software.
18 
19  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  DEALINGS IN THE SOFTWARE.
26 
27  Note that the Qore library is released under a choice of three open-source
28  licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
29  information.
30 */
31 
32 #ifndef _QORE_QORECLASS_H
33 
34 #define _QORE_QORECLASS_H
35 
36 #include <cstdarg>
37 #include <memory>
38 #include <string>
39 
40 // all qore class IDs
41 DLLEXPORT extern qore_classid_t CID_AUTOGATE;
42 DLLEXPORT extern qore_classid_t CID_AUTOLOCK;
43 DLLEXPORT extern qore_classid_t CID_AUTOREADLOCK;
44 DLLEXPORT extern qore_classid_t CID_AUTOWRITELOCK;
45 DLLEXPORT extern qore_classid_t CID_CONDITION;
46 DLLEXPORT extern qore_classid_t CID_COUNTER;
47 DLLEXPORT extern qore_classid_t CID_DATASOURCE;
48 DLLEXPORT extern qore_classid_t CID_DATASOURCEPOOL;
49 DLLEXPORT extern qore_classid_t CID_FILE;
50 DLLEXPORT extern qore_classid_t CID_FTPCLIENT;
51 DLLEXPORT extern qore_classid_t CID_GATE;
52 DLLEXPORT extern qore_classid_t CID_GETOPT;
53 DLLEXPORT extern qore_classid_t CID_HTTPCLIENT;
54 DLLEXPORT extern qore_classid_t CID_MUTEX;
55 DLLEXPORT extern qore_classid_t CID_PROGRAM;
56 DLLEXPORT extern qore_classid_t CID_PROGRAMDEBUG;
57 DLLEXPORT extern qore_classid_t CID_QUEUE;
58 DLLEXPORT extern qore_classid_t CID_RWLOCK;
59 DLLEXPORT extern qore_classid_t CID_SSLCERTIFICATE;
60 DLLEXPORT extern qore_classid_t CID_SSLPRIVATEKEY;
61 DLLEXPORT extern qore_classid_t CID_SEQUENCE;
62 DLLEXPORT extern qore_classid_t CID_SOCKET;
63 DLLEXPORT extern qore_classid_t CID_TERMIOS;
64 DLLEXPORT extern qore_classid_t CID_INPUTSTREAM;
65 DLLEXPORT extern qore_classid_t CID_OUTPUTSTREAM;
66 DLLEXPORT extern qore_classid_t CID_INPUTSTREAMBASE;
67 DLLEXPORT extern qore_classid_t CID_OUTPUTSTREAMBASE;
68 DLLEXPORT extern qore_classid_t CID_PROGRAM;
69 DLLEXPORT extern qore_classid_t CID_SERIALIZABLE;
70 
71 DLLEXPORT extern QoreClass* QC_QUEUE;
72 DLLEXPORT extern QoreClass* QC_HTTPCLIENT;
73 DLLEXPORT extern QoreClass* QC_SSLCERTIFICATE;
74 DLLEXPORT extern QoreClass* QC_SSLPRIVATEKEY;
75 DLLEXPORT extern QoreClass* QC_PROGRAM;
76 DLLEXPORT extern QoreClass* QC_SERIALIZABLE;
77 
78 class BCList;
79 class BCSMList;
80 class BCAList;
81 class QoreObject;
82 class QoreClass;
83 class BCEAList;
84 class ParamList;
85 class QoreMemberInfo;
86 class BuiltinMethod;
87 class AbstractQoreFunctionVariant;
88 class AbstractFunctionSignature;
89 class UserMethod;
90 class BCANode;
91 class qore_method_private;
92 class MethodFunctionBase;
93 class NamedScope;
94 class ConstantList;
95 class MethodVariantBase;
96 
102 class QoreExternalMethodFunction;
107 
109 
111 enum method_type_e {
112  MT_None = 0, // not a method function/variant
113  MT_Normal = 1,
114  MT_Static = 2,
115  MT_Constructor = 3,
116  MT_Destructor = 4,
117  MT_Copy = 5,
118  MT_Pseudo = 6,
119 };
120 
122 
125 class QoreMethod {
126  friend class StaticMethodCallNode;
127  friend class QoreObject;
128  friend class qore_class_private;
129  friend class qore_method_private;
130  friend class BCList;
131 
132 private:
134  class qore_method_private* priv;
135 
137  DLLLOCAL QoreMethod(const QoreMethod&);
138 
140  DLLLOCAL QoreMethod& operator=(const QoreMethod&);
141 
142 public:
144 
146  DLLEXPORT bool isUser() const;
147 
149 
151  DLLEXPORT bool isBuiltin() const;
152 
154 
156  DLLEXPORT bool isPrivate() const;
157 
159  DLLEXPORT ClassAccess getAccess() const;
160 
162 
165  DLLEXPORT bool isStatic() const;
166 
168 
171  DLLEXPORT const char* getName() const;
172 
174 
177  DLLEXPORT const std::string& getNameStr() const;
178 
180  DLLEXPORT const QoreClass* getClass() const;
181 
183  DLLEXPORT const char* getClassName() const;
184 
186  DLLEXPORT bool existsVariant(const type_vec_t& paramTypeInfo) const;
187 
188  /* returns the return type information for the method if it is available and if
189  there is only one return type (there can be more return types if the method is
190  overloaded)
191  */
192  DLLEXPORT const QoreTypeInfo* getUniqueReturnTypeInfo() const;
193 
195 
199  DLLEXPORT QoreValue execManaged(QoreObject* self, const QoreListNode* args, ExceptionSink* xsink) const;
200 
202 
204  DLLEXPORT method_type_e getMethodType() const;
205 
207 
209  DLLEXPORT const QoreExternalMethodFunction* getFunction() const;
210 
211  DLLLOCAL QoreMethod(const QoreClass* p_class, MethodFunctionBase* n_func, bool n_static = false);
212 
213  DLLLOCAL bool inMethod(const QoreObject* self) const;
214  DLLLOCAL QoreMethod* copy(const QoreClass* p_class) const;
215  DLLLOCAL void assign_class(const QoreClass* p_class);
216  // non-exported destructor
217  DLLLOCAL ~QoreMethod();
218 };
219 
221 
224 public:
225  DLLEXPORT virtual ~AbstractQoreClassUserData();
226 
228  virtual AbstractQoreClassUserData* copy() const = 0;
229 
231  virtual void doDeref() = 0;
232 };
233 
235 
239 class QoreClass {
240  friend class BCList;
241  friend class BCNode;
242  friend class BCSMList;
243  friend class qore_object_private;
244  friend class qore_class_private;
245  friend class QoreObject;
246  friend class BCANode;
247  friend class qore_method_private;
248  friend class QoreMethodIterator;
249  friend class QoreStaticMethodIterator;
250  friend class ConstructorMethodFunction;
251 
252 public:
254 
262  DLLEXPORT QoreClass(const char* n_name, int64 n_domain = QDOM_DEFAULT);
263 
265 
272  DLLEXPORT explicit QoreClass(const char* n_name, int n_domain);
273 
275 
282  DLLEXPORT QoreClass(const char* n_name, int64 n_domain, const QoreTypeInfo* n_typeInfo);
283 
285 
287  DLLEXPORT QoreClass(const QoreClass &old);
288 
290 
319  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, ...);
320 
322 
356  DLLEXPORT void addMethod(const void* ptr, const char* n_name, q_external_method_t meth, ClassAccess access = Public, int64 n_flags = QCF_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(), const name_vec_t& n_names = name_vec_t());
357 
359  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, ...);
360 
362 
364  DLLEXPORT void addStaticMethod(const void* ptr, const char* n_name, q_external_static_method_t meth, ClassAccess access = Public, int64 n_flags = QCF_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(), const name_vec_t& n_names = name_vec_t());
365 
367  DLLEXPORT void addAbstractMethod(const char* n_name, ClassAccess access = Public, int64 n_flags = QCF_NO_FLAGS, const QoreTypeInfo* returnTypeInfo = 0, unsigned num_params = 0, ...);
368 
370  DLLEXPORT void addAbstractMethod(const char* n_name, ClassAccess access, int64 n_flags, const QoreTypeInfo* returnTypeInfo, const type_vec_t& n_typeList, const arg_vec_t& defaultArgList = arg_vec_t(), const name_vec_t& n_names = name_vec_t());
371 
373 
384  DLLEXPORT void setDestructor(q_destructor_t m);
385 
387 
399  DLLEXPORT void setDestructor(const void* ptr, q_external_destructor_t m);
400 
402  DLLEXPORT void addConstructor(q_constructor_n_t meth, ClassAccess access = Public, int64 n_flags = QCF_NO_FLAGS, int64 n_domain = QDOM_DEFAULT, unsigned num_params = 0, ...);
403 
405 
407  DLLEXPORT void addConstructor(const void* ptr, q_external_constructor_t meth, ClassAccess access = Public, int64 n_flags = QCF_NO_FLAGS, int64 n_domain = QDOM_DEFAULT, const type_vec_t& n_typeList = type_vec_t(), const arg_vec_t& defaultArgList = arg_vec_t(), const name_vec_t& n_names = name_vec_t());
408 
410 
413  DLLEXPORT void setSystemConstructor(q_system_constructor_t m);
414 
416 
427  DLLEXPORT void setCopy(q_copy_t m);
428 
430 
442  DLLEXPORT void setCopy(const void* ptr, q_external_copy_t m);
443 
445 
453  DLLEXPORT void setDeleteBlocker(q_delete_blocker_t m);
454 
456 
460  DLLEXPORT void setSerializer(q_serializer_t m);
461 
463 
467  DLLEXPORT void setDeserializer(q_deserializer_t m);
468 
470 
472  DLLEXPORT q_serializer_t getSerializer() const;
473 
475 
477  DLLEXPORT q_deserializer_t getDeserializer() const;
478 
480  DLLEXPORT void setFinal();
481 
483 
487  DLLEXPORT bool isPrivateMember(const char* str) const;
488 
490 
495  DLLEXPORT bool isPublicOrPrivateMember(const char* str, bool& priv) const;
496 
498 
504  DLLEXPORT QoreObject* execConstructor(const QoreListNode* args, ExceptionSink* xsink) const;
505 
507 
514  DLLEXPORT QoreObject* execConstructorVariant(const QoreExternalMethodVariant* mv, const QoreListNode *args, ExceptionSink* xsink) const;
515 
517 
521  DLLEXPORT QoreObject* execSystemConstructor(int code = 0, ...) const;
522 
524 
528  DLLEXPORT QoreObject* execCopy(QoreObject* old, ExceptionSink* xsink) const;
529 
531 
534  DLLEXPORT QoreListNode* getMethodList() const;
535 
537 
540  DLLEXPORT QoreListNode* getStaticMethodList() const;
541 
543 
551  DLLEXPORT QoreClass* getClass(qore_classid_t cid) const;
552 
554 
561  DLLEXPORT const QoreClass* getClass(qore_classid_t cid, bool& priv) const;
562 
564 
571  DLLEXPORT const QoreClass* getClass(const QoreClass& qc, bool& priv) const;
572 
574  DLLEXPORT int numMethods() const;
575 
577  DLLEXPORT int numStaticMethods() const;
578 
580  DLLEXPORT int numUserMethods() const;
581 
583  DLLEXPORT int numStaticUserMethods() const;
584 
586  DLLEXPORT bool hasCopy() const;
587 
589  DLLEXPORT qore_classid_t getID() const;
590 
592  DLLEXPORT bool isSystem() const;
593 
595 
597  DLLEXPORT bool isModulePublic() const;
598 
600 
602  DLLEXPORT bool isAbstract() const;
603 
605 
607  DLLEXPORT bool isFinal() const;
608 
610 
612  DLLEXPORT bool isInjected() const;
613 
615 
617  DLLEXPORT bool isPseudoClass() const;
618 
620 
624  DLLEXPORT qore_type_t getPseudoClassType() const;
625 
627 
631  DLLEXPORT QoreValue evalPseudoMethod(const QoreValue n, const char* nme, const QoreListNode* args, ExceptionSink* xsink) const;
632 
634 
648  DLLEXPORT QoreValue evalPseudoMethod(const QoreMethod* m, const QoreExternalMethodVariant* variant, const QoreValue n, const QoreListNode* args, ExceptionSink* xsink) const;
649 
651  DLLEXPORT void setSystem();
652 
654  DLLEXPORT bool hasMemberGate() const;
655 
657  DLLEXPORT bool hasMethodGate() const;
658 
660  DLLEXPORT bool hasMemberNotification() const;
661 
663 
665  DLLEXPORT int64 getDomain() const;
666 
668  DLLEXPORT const char* getName() const;
669 
671 
675  DLLEXPORT const QoreMethod* findMethod(const char* nme) const;
676 
678 
682  DLLEXPORT const QoreMethod* findStaticMethod(const char* nme) const;
683 
685 
689  DLLEXPORT const QoreMethod* findMethod(const char* nme, ClassAccess& access) const;
690 
692 
696  DLLEXPORT const QoreMethod* findStaticMethod(const char* nme, ClassAccess& access) const;
697 
699 
703  DLLEXPORT const QoreMethod* findLocalMethod(const char* name) const;
704 
706 
710  DLLEXPORT const QoreMethod* findLocalStaticMethod(const char* name) const;
711 
713 
716  DLLEXPORT void addBuiltinBaseClass(QoreClass* qc);
717 
719 
724  DLLEXPORT void addDefaultBuiltinBaseClass(QoreClass* qc);
725 
727 
733  DLLEXPORT void addBuiltinVirtualBaseClass(QoreClass* qc);
734 
736 
738  DLLEXPORT void setSynchronousClass();
739 
741 
744  DLLEXPORT const QoreMethod* getConstructor() const;
745 
747 
750  DLLEXPORT const QoreMethod* getSystemConstructor() const;
751 
753 
756  DLLEXPORT const QoreMethod* getDestructor() const;
757 
759 
762  DLLEXPORT const QoreMethod* getCopyMethod() const;
763 
765 
768  DLLEXPORT const QoreMethod* getMemberGateMethod() const;
769 
771 
774  DLLEXPORT const QoreMethod* getMethodGate() const;
775 
777 
780  DLLEXPORT const QoreMethod* getMemberNotificationMethod() const;
781 
783  DLLEXPORT const QoreTypeInfo* getTypeInfo() const;
784 
786  DLLEXPORT const QoreTypeInfo* getOrNothingTypeInfo() const;
787 
789  DLLEXPORT void addMember(const char* mem, ClassAccess access, const QoreTypeInfo* n_typeInfo, QoreValue initial_value = QoreValue());
790 
792 
794  DLLEXPORT void setUserData(const void* ptr);
795 
797 
799  DLLEXPORT const void* getUserData() const;
800 
802 
804  DLLEXPORT void setManagedUserData(AbstractQoreClassUserData* cud);
805 
807 
809  DLLEXPORT AbstractQoreClassUserData* getManagedUserData() const;
810 
812 
814  template <typename T>
815  DLLLOCAL T* getManagedUserData() const {
816  return static_cast<T*>(getManagedUserData());
817  }
818 
820  DLLEXPORT void recheckBuiltinMethodHierarchy();
821 
823 
825  DLLEXPORT const QoreExternalMethodVariant* findUserMethodVariant(const char* name, const QoreMethod*& method, const type_vec_t& argTypeList) const;
826 
828 
833  DLLEXPORT void addBuiltinConstant(const char* name, QoreValue value, ClassAccess access = Public, const QoreTypeInfo* typeInfo = nullptr);
834 
836 
841  DLLEXPORT void addBuiltinStaticVar(const char* name, QoreValue value, ClassAccess access = Public, const QoreTypeInfo* typeInfo = nullptr);
842 
844 
850  DLLEXPORT void rescanParents();
851 
853 
855  DLLEXPORT void setPublicMemberFlag();
856 
858 
860  DLLEXPORT void setGateAccessFlag();
861 
863 
865  DLLEXPORT const QoreExternalNormalMember* findLocalMember(const char* name) const;
866 
868 
870  DLLEXPORT const QoreExternalStaticMember* findLocalStaticMember(const char* name) const;
871 
873 
877  DLLEXPORT std::string getNamespacePath(bool anchored = false) const;
878 
880 
882  DLLEXPORT bool isEqual(const QoreClass& cls) const;
883 
885 
887  DLLEXPORT BinaryNode* getBinaryHash() const;
888 
890 
892  DLLEXPORT int runtimeCheckInstantiateClass(ExceptionSink* xsink) const;
893 
895 
897  DLLEXPORT const QoreExternalConstant* findConstant(const char* name) const;
898 
900 
902  DLLEXPORT const QoreNamespace* getNamespace() const;
903 
905 
907  DLLEXPORT bool inHierarchy(const QoreClass& cls, ClassAccess& n_access) const;
908 
910 
912  DLLEXPORT bool hasTransientMember() const;
913 
915 
917  DLLEXPORT const char* getModuleName() const;
918 
920  DLLLOCAL QoreClass();
921 
922  // used when parsing, finds committed non-static methods within the entire class hierarchy (local class plus base classes)
923  DLLLOCAL const QoreMethod* parseFindCommittedMethod(const char* nme);
924 
925  // returns 0 for success, -1 for error
926  DLLLOCAL int parseAddBaseClassArgumentList(BCAList* bcal);
927  // only called when parsing, sets the name of the class
928  DLLLOCAL void setName(const char* n);
929 
930  DLLLOCAL qore_classid_t getIDForMethod() const;
931  // get base class list to add virtual class indexes for private data
932  DLLLOCAL BCSMList* getBCSMList() const;
933  // returns true if the class has a delete_blocker function (somewhere in the hierarchy)
934  DLLLOCAL bool has_delete_blocker() const;
935 
936  DLLLOCAL bool parseHasPublicMembersInHierarchy() const;
937  DLLLOCAL bool runtimeHasPublicMembersInHierarchy() const;
938 
939  // returns true if the class has one or more parent classes
940  DLLLOCAL bool hasParentClass() const;
941  DLLLOCAL bool hasPrivateCopyMethod() const;
942  // returns the status including the pending variant (if any)
943  DLLLOCAL bool parseHasPrivateCopyMethod() const;
944  DLLLOCAL const QoreMethod* parseGetConstructor() const;
945  // returns true if the class implements a "methodGate" method, also in pending uncommitted methods
946  DLLLOCAL bool parseHasMethodGate() const;
947  // called when there is an empty public member declaration or a "no_public" declaration
948  DLLLOCAL void parseSetEmptyPublicMemberDeclaration();
949  // unsets the public member flag for builtin classes
950  DLLLOCAL void unsetPublicMemberFlag();
951 
952 protected:
954  DLLEXPORT ~QoreClass();
955 
956 private:
958  QoreClass& operator=(const QoreClass&) = delete;
959 
961  class qore_class_private* priv;
962 
963  // private constructor only called when the class is copied
964  DLLLOCAL QoreClass(qore_class_private* priv);
965 
966  DLLLOCAL void insertMethod(QoreMethod* o);
967  DLLLOCAL void insertStaticMethod(QoreMethod* o);
968  DLLLOCAL QoreValue evalMethodGate(QoreObject* self, const char* nme, const QoreListNode* args, ExceptionSink* xsink) const;
969  DLLLOCAL const QoreMethod* parseResolveSelfMethodIntern(const char* nme);
970 
972 
981  DLLLOCAL QoreValue evalMethod(QoreObject* self, const char* method_name, const QoreListNode* args, ExceptionSink* xsink) const;
982 
983  // This function must only be called from QoreObject
984  DLLLOCAL QoreValue evalMemberGate(QoreObject* self, const QoreString *nme, ExceptionSink* xsink) const;
985  // This function must only be called from QoreObject
986  DLLLOCAL void execMemberNotification(QoreObject* self, const char* mem, ExceptionSink* xsink) const;
987  // This function must only be called from QoreObject and BCList
988  DLLLOCAL bool execDeleteBlocker(QoreObject* self, ExceptionSink* xsink) const;
989  // This function must only be called from QoreObject
990  DLLLOCAL void execDestructor(QoreObject* self, ExceptionSink* xsink) const;
991 };
992 
995 private:
996  void* priv;
997 
998 public:
999  DLLEXPORT QoreMethodIterator(const QoreClass& qc);
1000  DLLEXPORT ~QoreMethodIterator();
1001  DLLEXPORT bool next();
1002  DLLEXPORT const QoreMethod* getMethod() const;
1003 };
1004 
1007 private:
1008  void* priv;
1009 
1010 public:
1011  DLLEXPORT QoreStaticMethodIterator(const QoreClass& qc);
1012  DLLEXPORT ~QoreStaticMethodIterator();
1013  DLLEXPORT bool next();
1014  DLLEXPORT const QoreMethod* getMethod() const;
1015 };
1016 
1018 
1021 public:
1023  DLLLOCAL QoreClassHolder(QoreClass* c) : c(c) {
1024  }
1025 
1027  DLLEXPORT ~QoreClassHolder();
1028 
1030  DLLLOCAL operator QoreClass*() const {
1031  return c;
1032  }
1033 
1035  DLLLOCAL QoreClass* release() {
1036  auto rv = c;
1037  c = 0;
1038  return rv;
1039  }
1040 
1041 private:
1043  QoreClass* c;
1044 };
1045 
1047 class QoreBuiltinClass : public QoreClass {
1048 public:
1050  DLLEXPORT QoreBuiltinClass(const char* name, int64 n_domain = QDOM_DEFAULT);
1051 
1053  DLLEXPORT QoreBuiltinClass(const QoreBuiltinClass& old);
1054 };
1055 
1057 
1060 public:
1062  DLLEXPORT QoreParentClassIterator(const QoreClass& cls);
1063 
1065  DLLEXPORT ~QoreParentClassIterator();
1066 
1068  DLLEXPORT bool next();
1069 
1071  DLLEXPORT bool valid() const;
1072 
1074  DLLEXPORT const QoreClass& getParentClass() const;
1075 
1077  DLLEXPORT ClassAccess getAccess() const;
1078 
1079 private:
1080  std::unique_ptr<class qore_parent_class_iterator_private> priv;
1081 };
1082 
1084 
1087 public:
1089  DLLEXPORT QoreClassMemberIterator(const QoreClass& cls);
1090 
1092  DLLEXPORT ~QoreClassMemberIterator();
1093 
1095  DLLEXPORT bool next();
1096 
1098  DLLEXPORT bool valid() const;
1099 
1101  DLLEXPORT const QoreExternalNormalMember& getMember() const;
1102 
1104  DLLEXPORT const char* getName() const;
1105 
1106 private:
1107  std::unique_ptr<class qore_class_member_iterator_private> priv;
1108 };
1109 
1111 
1114 public:
1116  DLLEXPORT QoreClassStaticMemberIterator(const QoreClass& cls);
1117 
1119  DLLEXPORT ~QoreClassStaticMemberIterator();
1120 
1122  DLLEXPORT bool next();
1123 
1125  DLLEXPORT bool valid() const;
1126 
1128  DLLEXPORT const QoreExternalStaticMember& getMember() const;
1129 
1131  DLLEXPORT const char* getName() const;
1132 
1133 private:
1134  std::unique_ptr<class qore_class_static_member_iterator_private> priv;
1135 };
1136 
1138 
1141 public:
1143  DLLEXPORT QoreClassConstantIterator(const QoreClass& cls);
1144 
1146  DLLEXPORT ~QoreClassConstantIterator();
1147 
1149  DLLEXPORT bool next();
1150 
1152  DLLEXPORT bool valid() const;
1153 
1155  DLLEXPORT const QoreExternalConstant& get() const;
1156 
1157 private:
1158  std::unique_ptr<class qore_class_constant_iterator> priv;
1159 };
1160 
1162 
1167 public:
1169  DLLEXPORT QoreClassHierarchyIterator(const QoreClass& cls);
1170 
1172  DLLEXPORT ~QoreClassHierarchyIterator();
1173 
1175  DLLEXPORT bool next();
1176 
1178  DLLEXPORT bool valid() const;
1179 
1181  DLLEXPORT const QoreClass& get() const;
1182 
1184 
1186  DLLEXPORT bool isVirtual() const;
1187 
1188 private:
1189  std::unique_ptr<class qore_class_hierarchy_iterator> priv;
1190 };
1191 
1193 
1198 public:
1200  DLLEXPORT QoreClassDestructorHierarchyIterator(const QoreClass* cls);
1201 
1203  DLLEXPORT ~QoreClassDestructorHierarchyIterator();
1204 
1206  DLLEXPORT bool next();
1207 
1209  DLLEXPORT bool valid() const;
1210 
1212  DLLEXPORT const QoreClass* get() const;
1213 
1215 
1217  DLLEXPORT bool isVirtual() const;
1218 
1219 private:
1220  class qore_class_destructor_hierarchy_iterator* priv;
1221 };
1222 
1223 DLLEXPORT const char* get_access_string(ClassAccess access);
1224 
1225 #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&#39;s normal (non-static) methods.
Definition: QoreClass.h:994
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:223
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:1140
iterates the class hierarchy in the order of destructor execution
Definition: QoreClass.h:1197
allows for temporary storage of a QoreClass pointer
Definition: QoreClass.h:1020
DLLEXPORT const char * getName() const
returns the method&#39;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&#39;s static methods.
Definition: QoreClass.h:1006
Qore&#39;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:1166
DLLEXPORT bool existsVariant(const type_vec_t &paramTypeInfo) 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&#39;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:239
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:1047
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:1113
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&#39;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:1086
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:125
iterates parent classes for a class with inheritance access information
Definition: QoreClass.h:1059
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:155