|
Qore Programming Language
0.9.16
|
34 #ifndef _QORE_QOREOBJECT_H
36 #define _QORE_QOREOBJECT_H
41 class BuiltinDeleteBlocker;
42 class BuiltinNormalMethodVariantBase;
43 class BuiltinCopyVariantBase;
62 friend class qore_object_private;
63 friend class ObjectRSetHelper;
64 friend class ObjectRSet;
65 friend class qore_object_dereference_helper;
69 class qore_object_private* priv;
393 DLLEXPORT
bool isValid()
const;
413 DLLEXPORT
void tRef()
const;
527 DLLLOCAL
int getStatus()
const;
529 DLLLOCAL
class KeyNode* getReferencedPrivateDataNode(
qore_classid_t key);
599 this->p->deref(this->xsink);
614 this->p->deref(this->xsink);
619 class QorePrivateObjectAccessHelper {
621 DLLLOCAL QorePrivateObjectAccessHelper(
ExceptionSink* xs) : xsink(xs), ptr(0) {
624 DLLLOCAL
operator bool()
const {
629 DLLLOCAL QorePrivateObjectAccessHelper(
const QorePrivateObjectAccessHelper&) =
delete;
630 DLLLOCAL QorePrivateObjectAccessHelper& operator=(
const QorePrivateObjectAccessHelper&) =
delete;
631 DLLLOCAL
void*
operator new(size_t) =
delete;
DLLEXPORT AbstractPrivateData * tryGetReferencedPrivateData(qore_classid_t key, ExceptionSink *xsink) const
returns the private data corresponding to the class ID passed with an incremented reference count if ...
DLLEXPORT void deleteBlockerRef() const
increment the reference count of the object, to be called only from within a delete blocker
DLLEXPORT bool compareSoft(const QoreObject *obj, ExceptionSink *xsink) const
tests for equality ("deep compare" including all contained values) with possible type conversion of c...
const qore_type_t NT_OBJECT
type value for QoreObject
Definition: node_types.h:52
DLLLOCAL bool hasMemberNotification() const
returns true if the class has a memberNotification method
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only
Definition: QoreProgram.h:126
external wrapper class for method variants
Definition: QoreReflection.h:90
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality ("deep compare" including all contained values) without type conversions (hard com...
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
virtual DLLEXPORT AbstractQoreNode * realCopy() const
performs a the same object with its reference count increased
DLLLOCAL void defaultSystemDestructor(qore_classid_t classID, ExceptionSink *xsink)
runs the destructor for system objects
DLLEXPORT bool validInstanceOf(qore_classid_t cid) const
returns true if this object is a valid instance of the classid passed
This is the hash or associative list container type in Qore, dynamically allocated only,...
Definition: QoreHashNode.h:50
DLLEXPORT void setPrivate(qore_classid_t key, AbstractPrivateData *pd)
sets private data for the object against the class ID passed, used in C++ functions implementing Qore...
DLLEXPORT bool isSystemObject() const
returns true if the object is a system object (created with the system constructor)
virtual DLLLOCAL void customDeref(ExceptionSink *xsink)
custom dereference handler - with delete
a templated class to manage a reference count of an object that can throw a Qore-language exception w...
Definition: ReferenceHolder.h:52
DLLEXPORT void realDeref(ExceptionSink *xsink)
decrements the standard reference count of the object for references that cannot be part of a recursi...
DLLLOCAL AbstractPrivateData * getAndClearPrivateData(qore_classid_t key, ExceptionSink *xsink)
retrieves the private data pointer and clears it from the object's private data store,...
defines a Qore-language class
Definition: QoreClass.h:239
DLLEXPORT bool hasMember(const char *mem, ExceptionSink *xsink) const
returns true if the object has the given member (note that the member may not have a value)
DLLLOCAL void evalCopyMethodWithPrivateData(const QoreClass &thisclass, const BuiltinCopyVariantBase *meth, QoreObject *self, ExceptionSink *xsink)
called on the old object (this) to acquire private data, copy method called with pointer to "self" (n...
DLLLOCAL void operator=(T *nv)
assigns a new pointer to the holder, dereferences the current pointer if any
Definition: QoreObject.h:612
virtual DLLLOCAL void customRef() const
custom reference handler
DLLLOCAL void execMemberNotification(const char *member, ExceptionSink *xsink)
executes the member notification on the object the given member
DLLEXPORT int size(ExceptionSink *xsink) const
returns the number of members of the object
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
convenience class for holding AbstractPrivateData references
Definition: QoreObject.h:606
DLLEXPORT QoreProgram * getProgram() const
returns the QoreProgram object associated with this object
DLLEXPORT void setValue(const char *key, QoreValue val, ExceptionSink *xsink)
sets the value of the given member to the given value
DLLLOCAL bool evalDeleteBlocker(qore_classid_t classid_for_method, BuiltinDeleteBlocker *meth)
evaluates the delete blocker function for the managed private data
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
DLLLOCAL QoreValue evalBuiltinMethodWithPrivateData(const QoreMethod &method, const BuiltinNormalMethodVariantBase *meth, const QoreListNode *args, ExceptionSink *xsink)
called to evaluate a builtin method when private data is available
static DLLEXPORT QoreValue evalStaticMethodVariant(const QoreMethod &method, const QoreExternalMethodVariant *variant, const QoreListNode *args, ExceptionSink *xsink)
executes a static method variant
DLLEXPORT QoreListNode * getMemberList(ExceptionSink *xsink) const
returns the list of members, caller owns the list returned
const DLLEXPORT char * getClassName() const
returns the name of the class
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:81
virtual DLLLOCAL QoreValue evalImpl(bool &needs_deref, ExceptionSink *xsink) const
should never be called, does nothing
DLLLOCAL void addPrivateDataToString(QoreString *str, ExceptionSink *xsink) const
concatenates info about private data to a string
DLLEXPORT bool isValid() const
returns true if the object is valid
DLLEXPORT QoreValue takeMember(const QoreString *key, ExceptionSink *xsink)
removes a member from the object without explicitly calling destructors and returns the value removed...
DLLLOCAL void operator=(T *nv)
assigns a new pointer to the holder, dereferences the current pointer if any
Definition: QoreObject.h:597
const DLLEXPORT QoreClass * getClass() const
returns a pointer to the QoreClass of this object
virtual DLLEXPORT bool derefImpl(ExceptionSink *xsink)
runs the destructor if necessary and dereferences all members
DLLEXPORT void doDelete(ExceptionSink *xsink)
runs the destructor on the object (if it hasn't already been deleted)
the implementation of Qore's object data type, reference counted, dynamically-allocated only
Definition: QoreObject.h:61
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
DLLEXPORT QoreValue evalMethodVariant(const QoreMethod &method, const QoreExternalMethodVariant *variant, const QoreListNode *args, ExceptionSink *xsink)
executes a normal object method variant
DLLEXPORT void realRef()
increments the standard reference count of the object for references that cannot be part of a recursi...
DLLEXPORT int64 getMemberAsBigInt(const char *mem, bool &found, ExceptionSink *xsink) const
returns the value of the given member as an int64
unsigned qore_classid_t
used for the unique class ID for QoreClass objects
Definition: common.h:79
DLLEXPORT bool compareHard(const QoreObject *obj, ExceptionSink *xsink) const
tests for equality ("deep compare" including all contained values) with possible type conversion of c...
DLLEXPORT QoreValue getReferencedMemberNoMethod(const char *mem, ExceptionSink *xsink) const
returns the value of the given member with the reference count incremented, the caller owns any refer...
virtual DLLLOCAL ~QoreObject()
destructor
virtual DLLEXPORT bool getAsBoolImpl() const
returns false unless perl-boolean-evaluation is enabled, in which case it returns false only when emp...
DLLEXPORT void externalDelete(qore_classid_t key, ExceptionSink *xsink)
call this function when an object's private data is deleted externally
DLLEXPORT QoreHashNode * copyData(ExceptionSink *xsink) const
retuns all member data of the object (or 0 if there's an exception), caller owns the QoreHashNode ref...
DLLEXPORT AbstractPrivateData * getReferencedPrivateData(qore_classid_t key, ExceptionSink *xsink) const
returns the private data corresponding to the class ID passed with an incremented reference count,...
static const DLLLOCAL char * getStaticTypeName()
returns the type name (useful in templates)
Definition: QoreObject.h:163
DLLEXPORT void tRef() const
increments the existence reference count
convenience class for holding AbstractPrivateData references
Definition: QoreObject.h:588
DLLEXPORT QoreValue getMemberValueNoMethod(const QoreString *key, AutoVLock *vl, ExceptionSink *xsink) const
returns the pointer to the value of the member
a method in a QoreClass
Definition: QoreClass.h:125
static DLLEXPORT QoreValue evalStaticMethod(const QoreMethod &method, const QoreListNode *args, ExceptionSink *xsink)
executes a static method
DLLEXPORT int setMemberValue(const char *key, const QoreClass *cls, const QoreValue val, ExceptionSink *xsink)
sets the value of the given member as accessed from the given class
DLLEXPORT ClassAccess getClassAccess(const QoreClass &cls) const
returns the accessibility of the class in the object's hierachy or Inaccessible the object does not i...
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreObject.h:168
the base class for all data to be used as private data of Qore objects
Definition: AbstractPrivateData.h:44
virtual DLLEXPORT int getAsString(QoreString &str, int foff, ExceptionSink *xsink) const
concatenate the verbose string representation of the list (including all contained values) to an exis...
DLLEXPORT void deleteMemberValue(const QoreString *key, ExceptionSink *xsink)
removes a member from the object, if the member's value is an object it is deleted as well (destructo...
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:54
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode)
Definition: common.h:70
DLLEXPORT QoreValue evalMethod(const QoreString *name, const QoreListNode *args, ExceptionSink *xsink)
evaluates the given method with the arguments passed and returns the return value,...
virtual const DLLEXPORT char * getTypeName() const
returns the type name as a c string
DLLLOCAL void obliterate(ExceptionSink *xsink)
destroys all members and dereferences all private data structures
DLLEXPORT QoreValue evalMember(const QoreString *member, ExceptionSink *xsink)
returns the value of the member with an incremented reference count, or executes the memberGate() met...
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality ("deep compare" including all contained values) with possible type conversion (sof...
DLLEXPORT void removeMember(const QoreString *key, ExceptionSink *xsink)
removes a member from the object without explicitly calling destructors; the value is only dereferenc...
DLLEXPORT void tDeref()
decrements the existence reference count, when it reaches 0 the C++ object ("this") will be deleted
AutoVLock is a container for safely managing global variable and object lock handovers,...
Definition: AutoVLock.h:80