Qore Programming Language - C/C++ Library  0.8.13
QoreClass.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreClass.h
4 
5  Qore Programming Language
6 
7  Copyright (C) 2003 - 2017 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 <stdarg.h>
37 #include <string>
38 
39 // all qore class IDs
40 DLLEXPORT extern qore_classid_t CID_AUTOGATE;
41 DLLEXPORT extern qore_classid_t CID_AUTOLOCK;
42 DLLEXPORT extern qore_classid_t CID_AUTOREADLOCK;
43 DLLEXPORT extern qore_classid_t CID_AUTOWRITELOCK;
44 DLLEXPORT extern qore_classid_t CID_CONDITION;
45 DLLEXPORT extern qore_classid_t CID_COUNTER;
46 DLLEXPORT extern qore_classid_t CID_DATASOURCE;
47 DLLEXPORT extern qore_classid_t CID_DATASOURCEPOOL;
48 DLLEXPORT extern qore_classid_t CID_FILE;
49 DLLEXPORT extern qore_classid_t CID_FTPCLIENT;
50 DLLEXPORT extern qore_classid_t CID_GATE;
51 DLLEXPORT extern qore_classid_t CID_GETOPT;
52 DLLEXPORT extern qore_classid_t CID_HTTPCLIENT;
53 DLLEXPORT extern qore_classid_t CID_MUTEX;
54 DLLEXPORT extern qore_classid_t CID_PROGRAM;
55 DLLEXPORT extern qore_classid_t CID_PROGRAMDEBUG;
56 DLLEXPORT extern qore_classid_t CID_QUEUE;
57 DLLEXPORT extern qore_classid_t CID_RWLOCK;
58 DLLEXPORT extern qore_classid_t CID_SSLCERTIFICATE;
59 DLLEXPORT extern qore_classid_t CID_SSLPRIVATEKEY;
60 DLLEXPORT extern qore_classid_t CID_SEQUENCE;
61 DLLEXPORT extern qore_classid_t CID_SOCKET;
62 DLLEXPORT extern qore_classid_t CID_TERMIOS;
63 DLLEXPORT extern qore_classid_t CID_INPUTSTREAM;
64 DLLEXPORT extern qore_classid_t CID_OUTPUTSTREAM;
65 
66 DLLEXPORT extern QoreClass* QC_QUEUE;
67 DLLEXPORT extern QoreClass* QC_HTTPCLIENT;
68 
69 class BCList;
70 class BCSMList;
71 class BCAList;
72 class QoreObject;
73 class QoreClass;
74 class BCEAList;
75 class ParamList;
76 class QoreMemberInfo;
77 class BuiltinMethod;
78 class AbstractQoreFunctionVariant;
79 class AbstractFunctionSignature;
80 class UserMethod;
81 class BCANode;
82 class qore_method_private;
83 class MethodFunctionBase;
84 class QoreExternalMethodVariant;
85 class QoreExternalStaticMethodVariant;
86 class NamedScope;
87 class ConstantList;
88 class MethodVariantBase;
89 
91 
94 class QoreMethod {
95  friend class StaticMethodCallNode;
96  friend class QoreObject;
97  friend class qore_class_private;
98  friend class qore_method_private;
99  friend class BCList;
100 
101 private:
103  class qore_method_private* priv;
104 
106  DLLLOCAL QoreMethod(const QoreMethod&);
107 
109  DLLLOCAL QoreMethod& operator=(const QoreMethod&);
110 
111 public:
113 
118  DLLEXPORT bool isSynchronized() const;
119 
121 
126  DLLEXPORT bool newCallingConvention() const;
127 
129 
131  DLLEXPORT bool isUser() const;
132 
134 
136  DLLEXPORT bool isBuiltin() const;
137 
139 
141  DLLEXPORT bool isPrivate() const;
142 
144  DLLEXPORT ClassAccess getAccess() const;
145 
147 
150  DLLEXPORT bool isStatic() const;
151 
153 
156  DLLEXPORT const char* getName() const;
157 
159 
162  DLLEXPORT const std::string& getNameStr() const;
163 
165  DLLEXPORT const QoreClass* getClass() const;
166 
168  DLLEXPORT const char* getClassName() const;
169 
171  DLLEXPORT bool existsVariant(const type_vec_t& paramTypeInfo) const;
172 
173  /* returns the return type information for the method if it is available and if
174  there is only one return type (there can be more return types if the method is
175  overloaded)
176  */
177  DLLEXPORT const QoreTypeInfo* getUniqueReturnTypeInfo() const;
178 
180 
184  DLLEXPORT QoreValue execManaged(QoreObject* self, const QoreListNode* args, ExceptionSink* xsink) const;
185 
186  DLLLOCAL QoreMethod(const QoreClass* p_class, MethodFunctionBase* n_func, bool n_static = false);
187 
188  DLLLOCAL ~QoreMethod();
189  DLLLOCAL bool inMethod(const QoreObject* self) const;
190  DLLLOCAL QoreMethod* copy(const QoreClass* p_class) const;
191  DLLLOCAL void assign_class(const QoreClass* p_class);
192  DLLLOCAL MethodFunctionBase* getFunction() const;
193 };
194 
196 
199 public:
200  DLLEXPORT virtual ~AbstractQoreClassUserData();
201 
203  virtual AbstractQoreClassUserData* copy() const = 0;
204 
206  virtual void doDeref() = 0;
207 };
208 
210 
214 class QoreClass {
215  friend class BCList;
216  friend class BCNode;
217  friend class BCSMList;
218  friend class qore_object_private;
219  friend class qore_class_private;
220  friend class QoreObject;
221  friend class BCANode;
222  friend class qore_method_private;
223  friend class QoreMethodIterator;
224  friend class QoreStaticMethodIterator;
225  friend class ConstructorMethodFunction;
226 
227 public:
229 
237  DLLEXPORT QoreClass(const char* n_name, int64 n_domain = QDOM_DEFAULT);
238 
240 
247  DLLEXPORT explicit QoreClass(const char* n_name, int n_domain);
248 
250 
257  DLLEXPORT QoreClass(const char* n_name, int64 n_domain, const QoreTypeInfo* n_typeInfo);
258 
260 
262  DLLEXPORT QoreClass(const QoreClass &old);
263 
265 
294  DLLEXPORT void addMethod(const char* n_name, q_method_n_t meth, ClassAccess access = Public, int64 n_flags = QC_NO_FLAGS, int64 n_domain = QDOM_DEFAULT, const QoreTypeInfo* returnTypeInfo = 0, unsigned num_params = 0, ...);
295 
297 
331  DLLEXPORT void addMethodVariant(const void* ptr, const char* n_name, q_external_method_t meth, ClassAccess access = Public, 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(), const name_vec_t& n_names = name_vec_t());
332 
334  DLLEXPORT void addStaticMethod(const char* n_name, q_func_n_t meth, ClassAccess access = Public, int64 n_flags = QC_NO_FLAGS, int64 n_domain = QDOM_DEFAULT, const QoreTypeInfo* returnTypeInfo = 0, unsigned num_params = 0, ...);
335 
337 
339  DLLEXPORT void addStaticMethodVariant(const void* ptr, const char* n_name, q_external_static_method_t meth, ClassAccess access = Public, 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(), const name_vec_t& n_names = name_vec_t());
340 
342 
369  DLLEXPORT void addMethod(const char* n_name, q_method_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, ...);
370 
372 
374  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, ...);
375 
377 
400  DLLEXPORT void addMethod(const char* n_name, q_method_t meth, bool priv = false);
401 
403 
405  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, ...);
406 
408 
410  DLLEXPORT void addMethodExtended(const char* n_name, q_method_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, ...);
411 
413 
415  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());
416 
418 
420  DLLEXPORT void addMethod2(const char* n_name, q_method2_t meth, bool priv = false);
421 
423 
425  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, ...);
426 
428 
430  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());
431 
433 
445  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());
446 
448 
450  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, ...);
451 
453 
455  DLLEXPORT void addMethodExtended3(const char* n_name, q_method_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, ...);
456 
458 
460  DLLEXPORT void addMethodExtended3(const char* n_name, q_method_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, ...);
461 
463 
465  DLLEXPORT void addMethodExtended3(const char* n_name, q_method_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, ...);
466 
468  DLLEXPORT void addAbstractMethodVariant(const char* n_name, ClassAccess access = Public, int64 n_flags = QC_NO_FLAGS, const QoreTypeInfo* returnTypeInfo = 0, unsigned num_params = 0, ...);
469 
471  DLLEXPORT void addAbstractMethodVariant(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());
472 
474 
476  DLLEXPORT void addAbstractMethodVariantExtended3(const char* n_name, bool priv = false, int64 n_flags = QC_NO_FLAGS, const QoreTypeInfo* returnTypeInfo = 0, unsigned num_params = 0, ...);
477 
479 
486  DLLEXPORT void addStaticMethod(const char* n_name, q_func_t meth, bool priv = false);
487 
489 
491  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, ...);
492 
494 
496  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());
497 
499 
501  DLLEXPORT void addStaticMethod2(const char* n_name, q_static_method2_t meth, bool priv = false);
502 
504 
506  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, ...);
507 
509 
511  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());
512 
514 
526  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());
527 
529 
531  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, ...);
532 
534 
536  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, ...);
537 
539 
541  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, ...);
542 
544 
546  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, ...);
547 
549 
560  DLLEXPORT void setDestructor(q_destructor_t m);
561 
563 
574  DLLEXPORT void setDestructor2(q_destructor2_t m);
575 
577 
589  DLLEXPORT void setDestructor3(const void* ptr, q_destructor3_t m);
590 
592  DLLEXPORT void addConstructor(q_constructor_n_t meth, ClassAccess access = Public, int64 n_flags = QC_NO_FLAGS, int64 n_domain = QDOM_DEFAULT, unsigned num_params = 0, ...);
593 
595 
597  DLLEXPORT void addConstructorVariant(const void* ptr, q_external_constructor_t meth, ClassAccess access = Public, 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(), const name_vec_t& n_names = name_vec_t());
598 
600 
602  DLLEXPORT void addConstructor(q_constructor_n_t meth, bool priv = false, int64 n_flags = QC_NO_FLAGS, int64 n_domain = QDOM_DEFAULT, unsigned num_params = 0, ...);
603 
605 
610  DLLEXPORT void setConstructor(q_constructor_t m);
611 
613  /*
614  @deprecated use addConstructor(q_constructor_n_t, ClassAccess, int64, int64, unsigned, ...) instead
615  */
616  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, ...);
617 
619  /*
620  @deprecated use addConstructor(q_constructor_n_t, ClassAccess, int64, int64, unsigned, ...) instead
621  */
622  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());
623 
625 
630  DLLEXPORT void setConstructor2(q_constructor2_t m);
631 
633  /*
634  @deprecated use addConstructor(q_constructor_n_t, ClassAccess, int64, int64, unsigned, ...) instead
635  */
636  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, ...);
637 
639  /*
640  @deprecated use addConstructor(q_constructor_n_t, ClassAccess, int64, int64, unsigned, ...) instead
641  */
642  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());
643 
645 
655  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());
656 
658  /*
659  @deprecated use addConstructor(q_constructor_n_t, ClassAccess, int64, int64, unsigned, ...) instead
660  */
661  DLLEXPORT void setConstructorExtended3(q_constructor_t meth, bool priv = false, int64 n_flags = QC_NO_FLAGS, int64 n_domain = QDOM_DEFAULT, unsigned num_params = 0, ...);
662 
664 
667  DLLEXPORT void setSystemConstructor(q_system_constructor_t m);
668 
670 
673  DLLEXPORT void setSystemConstructor2(q_system_constructor2_t m);
674 
676 
687  DLLEXPORT void setCopy(q_copy_t m);
688 
690 
701  DLLEXPORT void setCopy2(q_copy2_t m);
702 
704 
716  DLLEXPORT void setCopy3(const void* ptr, q_copy3_t m);
717 
719 
727  DLLEXPORT void setDeleteBlocker(q_delete_blocker_t m);
728 
730  DLLEXPORT void setFinal();
731 
733 
737  DLLEXPORT bool isPrivateMember(const char* str) const;
738 
740 
745  DLLEXPORT bool isPublicOrPrivateMember(const char* str, bool& priv) const;
746 
748 
754  DLLEXPORT QoreObject* execConstructor(const QoreValueList* args, ExceptionSink* xsink) const;
755 
757 
765  DLLEXPORT QoreObject* execConstructor(const QoreListNode* args, ExceptionSink* xsink) const;
766 
768 
772  DLLEXPORT QoreObject* execSystemConstructor(int code = 0, ...) const;
773 
775 
779  DLLEXPORT QoreObject* execCopy(QoreObject* old, ExceptionSink* xsink) const;
780 
782 
787  DLLEXPORT const QoreMethod* findLocalMethod(const char* name) const;
788 
790 
795  DLLEXPORT const QoreMethod* findLocalStaticMethod(const char* name) const;
796 
798 
801  DLLEXPORT QoreListNode* getMethodList() const;
802 
804 
807  DLLEXPORT QoreListNode* getStaticMethodList() const;
808 
810 
818  DLLEXPORT QoreClass* getClass(qore_classid_t cid) const;
819 
821 
828  DLLEXPORT const QoreClass* getClass(qore_classid_t cid, bool& priv) const;
829 
831 
838  DLLEXPORT const QoreClass* getClass(const QoreClass& qc, bool& priv) const;
839 
841  DLLEXPORT int numMethods() const;
842 
844  DLLEXPORT int numStaticMethods() const;
845 
847  DLLEXPORT int numUserMethods() const;
848 
850  DLLEXPORT int numStaticUserMethods() const;
851 
853  DLLEXPORT bool hasCopy() const;
854 
856  DLLEXPORT qore_classid_t getID() const;
857 
859  DLLEXPORT bool isSystem() const;
860 
862  DLLEXPORT void setSystem();
863 
865  DLLEXPORT bool hasMemberGate() const;
866 
868  DLLEXPORT bool hasMethodGate() const;
869 
871  DLLEXPORT bool hasMemberNotification() const;
872 
874 
876  DLLEXPORT int getDomain() const;
877 
879 
881  DLLEXPORT int64 getDomain64() const;
882 
884  DLLEXPORT const char* getName() const;
885 
887  // used at run-time
888  DLLEXPORT const QoreMethod* findMethod(const char* nme) const;
889 
891  // used at run-time
892  DLLEXPORT const QoreMethod* findStaticMethod(const char* nme) const;
893 
895 
897  DLLEXPORT const QoreMethod* findMethod(const char* nme, bool& priv) const;
898 
900  DLLEXPORT const QoreMethod* findMethod(const char* nme, ClassAccess& access) const;
901 
903 
905  DLLEXPORT const QoreMethod* findStaticMethod(const char* nme, bool& priv) const;
906 
908  DLLEXPORT const QoreMethod* findStaticMethod(const char* nme, ClassAccess& access) const;
909 
911 
915  DLLEXPORT void addBuiltinBaseClass(QoreClass* qc, QoreListNode* xargs = 0);
916 
918 
924  DLLEXPORT void addDefaultBuiltinBaseClass(QoreClass* qc, QoreListNode* xargs = 0);
925 
927 
933  DLLEXPORT void addBuiltinVirtualBaseClass(QoreClass* qc);
934 
936 
938  DLLEXPORT void setSynchronousClass();
939 
941 
944  DLLEXPORT const QoreMethod* getConstructor() const;
945 
947 
950  DLLEXPORT const QoreMethod* getSystemConstructor() const;
951 
953 
956  DLLEXPORT const QoreMethod* getDestructor() const;
957 
959 
962  DLLEXPORT const QoreMethod* getCopyMethod() const;
963 
965 
968  DLLEXPORT const QoreMethod* getMemberGateMethod() const;
969 
971 
974  DLLEXPORT const QoreMethod* getMethodGate() const;
975 
977 
980  DLLEXPORT const QoreMethod* getMemberNotificationMethod() const;
981 
983  DLLEXPORT const QoreTypeInfo* getTypeInfo() const;
984 
986  DLLEXPORT const QoreTypeInfo* getOrNothingTypeInfo() const;
987 
989  DLLEXPORT void addMember(const char* mem, ClassAccess access, const QoreTypeInfo* n_typeInfo, AbstractQoreNode* initial_value = 0);
990 
992 
994  DLLEXPORT void addPublicMember(const char* mem, const QoreTypeInfo* n_typeInfo, AbstractQoreNode* initial_value = 0);
995 
997 
999  DLLEXPORT void addPrivateMember(const char* mem, const QoreTypeInfo* n_typeInfo, AbstractQoreNode* initial_value = 0);
1000 
1002 
1004  DLLEXPORT void setUserData(const void* ptr);
1005 
1007 
1009  DLLEXPORT const void* getUserData() const;
1010 
1012 
1014  DLLEXPORT void setManagedUserData(AbstractQoreClassUserData* cud);
1015 
1017 
1019  DLLEXPORT AbstractQoreClassUserData* getManagedUserData() const;
1020 
1022 
1024  template <typename T>
1025  DLLLOCAL T* getManagedUserData() const {
1026  return static_cast<T*>(getManagedUserData());
1027  }
1028 
1030  DLLEXPORT void recheckBuiltinMethodHierarchy();
1031 
1033 
1035  DLLEXPORT const QoreExternalMethodVariant* findUserMethodVariant(const char* name, const QoreMethod*& method, const type_vec_t& argTypeList) const;
1036 
1038 
1043  DLLEXPORT void addBuiltinConstant(const char* name, AbstractQoreNode* value, bool priv = false, const QoreTypeInfo* typeInfo = 0);
1044 
1046 
1051  DLLEXPORT void addBuiltinStaticVar(const char* name, AbstractQoreNode* value, bool priv = false, const QoreTypeInfo* typeInfo = 0);
1052 
1054 
1059  DLLEXPORT void addBuiltinConstant(const char* name, QoreValue value, ClassAccess access = Public, const QoreTypeInfo* typeInfo = 0);
1060 
1062 
1067  DLLEXPORT void addBuiltinStaticVar(const char* name, QoreValue value, ClassAccess access = Public, const QoreTypeInfo* typeInfo = 0);
1068 
1070 
1072  DLLEXPORT bool hasAbstract() const;
1073 
1075 
1081  DLLEXPORT void rescanParents();
1082 
1084 
1086  DLLEXPORT void setPublicMemberFlag();
1087 
1089 
1091  DLLEXPORT void setGateAccessFlag();
1092 
1094  DLLLOCAL QoreClass();
1095 
1096  // used when parsing, finds committed non-static methods within the entire class hierarchy (local class plus base classes)
1097  DLLLOCAL const QoreMethod* parseFindCommittedMethod(const char* nme);
1098 
1099  // returns 0 for success, -1 for error
1100  DLLLOCAL int parseAddBaseClassArgumentList(BCAList* bcal);
1101  // only called when parsing, sets the name of the class
1102  DLLLOCAL void setName(const char* n);
1103 
1104  DLLLOCAL qore_classid_t getIDForMethod() const;
1105  // get base class list to add virtual class indexes for private data
1106  DLLLOCAL BCSMList* getBCSMList() const;
1107  // returns true if the class has a delete_blocker function (somewhere in the hierarchy)
1108  DLLLOCAL bool has_delete_blocker() const;
1109 
1110  DLLLOCAL bool parseHasPublicMembersInHierarchy() const;
1111  DLLLOCAL bool runtimeHasPublicMembersInHierarchy() const;
1112 
1113  // returns true if the class has one or more parent classes
1114  DLLLOCAL bool hasParentClass() const;
1115  DLLLOCAL bool hasPrivateCopyMethod() const;
1116  // returns the status including the pending variant (if any)
1117  DLLLOCAL bool parseHasPrivateCopyMethod() const;
1118  DLLLOCAL const QoreMethod* parseGetConstructor() const;
1119  // returns true if the class implements a "methodGate" method, also in pending uncommitted methods
1120  DLLLOCAL bool parseHasMethodGate() const;
1121  // called when there is an empty public member declaration or a "no_public" declaration
1122  DLLLOCAL void parseSetEmptyPublicMemberDeclaration();
1123  // unsets the public member flag for builtin classes
1124  DLLLOCAL void unsetPublicMemberFlag();
1125 
1126 protected:
1128  DLLEXPORT ~QoreClass();
1129 
1130 private:
1132  QoreClass& operator=(const QoreClass&) = delete;
1133 
1135  class qore_class_private* priv;
1136 
1137  // private constructor only called when the class is copied
1138  DLLLOCAL QoreClass(qore_classid_t id, const char* nme);
1139 
1140  DLLLOCAL void insertMethod(QoreMethod* o);
1141  DLLLOCAL void insertStaticMethod(QoreMethod* o);
1142  DLLLOCAL QoreValue evalMethodGate(QoreObject* self, const char* nme, const QoreListNode* args, ExceptionSink* xsink) const;
1143  DLLLOCAL const QoreMethod* parseResolveSelfMethodIntern(const char* nme);
1144 
1146 
1155  DLLLOCAL QoreValue evalMethod(QoreObject* self, const char* method_name, const QoreListNode* args, ExceptionSink* xsink) const;
1156 
1157  // This function must only be called from QoreObject
1158  DLLLOCAL QoreValue evalMemberGate(QoreObject* self, const QoreString *nme, ExceptionSink* xsink) const;
1159  // This function must only be called from QoreObject
1160  DLLLOCAL void execMemberNotification(QoreObject* self, const char* mem, ExceptionSink* xsink) const;
1161  // This function must only be called from QoreObject and BCList
1162  DLLLOCAL bool execDeleteBlocker(QoreObject* self, ExceptionSink* xsink) const;
1163  // This function must only be called from QoreObject
1164  DLLLOCAL void execDestructor(QoreObject* self, ExceptionSink* xsink) const;
1165 };
1166 
1169 private:
1170  void* priv;
1171 
1172 public:
1173  DLLEXPORT QoreMethodIterator(const QoreClass* qc);
1174  DLLEXPORT ~QoreMethodIterator();
1175  DLLEXPORT bool next();
1176  DLLEXPORT const QoreMethod* getMethod() const;
1177 };
1178 
1181 private:
1182  void* priv;
1183 
1184 public:
1185  DLLEXPORT QoreStaticMethodIterator(const QoreClass* qc);
1186  DLLEXPORT ~QoreStaticMethodIterator();
1187  DLLEXPORT bool next();
1188  DLLEXPORT const QoreMethod* getMethod() const;
1189 };
1190 
1192 
1195 public:
1197  DLLLOCAL QoreClassHolder(QoreClass* c) : c(c) {
1198  }
1199 
1201  DLLEXPORT ~QoreClassHolder();
1202 
1204  DLLLOCAL operator QoreClass*() const {
1205  return c;
1206  }
1207 
1209  DLLLOCAL QoreClass* release() {
1210  auto rv = c;
1211  c = 0;
1212  return rv;
1213  }
1214 
1215 private:
1217  QoreClass* c;
1218 };
1219 
1221 class QoreBuiltinClass : public QoreClass {
1222 public:
1224  DLLEXPORT QoreBuiltinClass(const char* name, int64 n_domain = QDOM_DEFAULT);
1225 
1227  DLLEXPORT QoreBuiltinClass(const QoreBuiltinClass& old);
1228 };
1229 
1230 #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
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:306
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:316
DLLEXPORT bool newCallingConvention() const
DEPRECATED: always returns false, do not use.
To be used to iterate through a class&#39;s normal (non-static) methods.
Definition: QoreClass.h:1168
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:476
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:514
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:370
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:281
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:411
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:458
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:468
an abstract class for class-specific external user data
Definition: QoreClass.h:198
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:485
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreValueList.h:45
allows for temporary storage of a QoreClass pointer
Definition: QoreClass.h:1194
DLLEXPORT const char * getName() const
returns the method&#39;s name
int64(* q_func_int64_t)(const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin function signatures returning an integer value
Definition: common.h:264
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:54
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:448
QoreValue(* q_external_static_method_t)(const QoreMethod &method, const void *ptr, const QoreValueList *args, q_rt_flags_t flags, ExceptionSink *xsink)
the type used for external static methods
Definition: common.h:383
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:403
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:1180
void(* q_constructor_t)(QoreObject *self, const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin QoreClass constructor method signatures
Definition: common.h:430
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:82
DLLEXPORT const QoreClass * getClass() const
returns a pointer to the parent class
DLLEXPORT bool existsVariant(const type_vec_t &paramTypeInfo) const
returns true if a variant with the given parameter signature already exists in the method ...
std::vector< AbstractQoreNode * > arg_vec_t
vector of value information for default argument lists
Definition: common.h:235
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
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:253
defines a Qore-language class
Definition: QoreClass.h:214
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:533
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:525
DLLEXPORT const char * getClassName() const
returns the class name for the method
creates a builtin class
Definition: QoreClass.h:1221
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:112
the implementation of Qore&#39;s object data type, reference counted, dynamically-allocated only ...
Definition: QoreObject.h:62
unsigned qore_classid_t
used for the unique class ID for QoreClass objects
Definition: common.h:80
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:336
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:47
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:346
std::vector< std::string > name_vec_t
vector of parameter names for parameter lists
Definition: common.h:238
DLLEXPORT ClassAccess getAccess() const
returns the lowest access code of all variants in the method
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:392
void(* q_external_constructor_t)(const QoreMethod &method, const void *ptr, QoreObject *self, const QoreValueList *args, q_rt_flags_t rtflags, ExceptionSink *xsink)
the type used for builtin QoreClass constructor method signatures
Definition: common.h:423
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:241
AbstractQoreNode *(* q_func_t)(const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin function signatures
Definition: common.h:261
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:357
double(* q_func_double_t)(const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin function signatures returning an double value
Definition: common.h:270
void(* q_copy_t)(QoreObject *self, QoreObject *old, AbstractPrivateData *private_data, ExceptionSink *xsink)
the type used for builtin QoreClass copy signatures
Definition: common.h:504
std::vector< const QoreTypeInfo * > type_vec_t
vector of type information for parameter lists
Definition: common.h:232
a method in a QoreClass
Definition: QoreClass.h:94
DLLEXPORT bool isSynchronized() const
DEPRECATED: always returns false, do not use.
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:495
QoreValue(* q_external_method_t)(const QoreMethod &method, const void *ptr, 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:296
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:438
bool(* q_func_bool_t)(const QoreListNode *args, ExceptionSink *xsink)
the type used for builtin function signatures returning a boolean value
Definition: common.h:267
#define QDOM_DEFAULT
the default domain (no domain)
Definition: Restrictions.h:146