All Classes Functions Variables Typedefs Friends Pages
Public Member Functions | List of all members
Glympse::IPrimitive Struct Referenceabstract

The IPrimitive interface is designed to operate with free form data structures. More...

#include <IPrimitive.h>

Inheritance diagram for Glympse::IPrimitive:
Inheritance graph
[legend]

Public Member Functions

virtual int32 type ()=0
 Common properties.
 
virtual bool isArray ()=0
 
virtual bool isObject ()=0
 
virtual bool isDouble ()=0
 
virtual bool isLong ()=0
 
virtual bool isBool ()=0
 
virtual bool isString ()=0
 
virtual bool isNull ()=0
 
virtual int32 size ()=0
 
virtual GPrimitive clone ()=0
 
virtual bool merge (const GPrimitive &from, bool overrideTarget)=0
 merge provides a mechanism for combining two primitives within the following rules. More...
 
virtual double getDouble ()=0
 Value getters.
 
virtual int64 getLong ()=0
 
virtual bool getBool ()=0
 
virtual GString getString ()=0
 
virtual GPrimitive get (const GString &key)=0
 Object getters.
 
virtual double getDouble (const GString &key)=0
 
virtual int64 getLong (const GString &key)=0
 
virtual bool getBool (const GString &key)=0
 
virtual GString getString (const GString &key)=0
 
virtual GEnumeration< GString >
::ptr 
getKeys ()=0
 
virtual bool hasKey (const GString &key)=0
 
virtual GArray< GPrimitive >::ptr getArray ()=0
 Array getters.
 
virtual GPrimitive get (int32 index)=0
 
virtual double getDouble (int32 index)=0
 
virtual int64 getLong (int32 index)=0
 
virtual bool getBool (int32 index)=0
 
virtual GString getString (int32 index)=0
 
virtual void set (double value)=0
 Value modifiers.
 
virtual void set (int64 value)=0
 
virtual void set (bool value)=0
 
virtual void set (const GString &value)=0
 
virtual void setNull ()=0
 
virtual void setArray ()=0
 
virtual void setObject ()=0
 
virtual void put (const GString &key, const GPrimitive &value)=0
 Object modifiers.
 
virtual void put (const GString &key, double value)=0
 
virtual void put (const GString &key, int64 value)=0
 
virtual void put (const GString &key, bool value)=0
 
virtual void put (const GString &key, const GString &value)=0
 
virtual void putNull (const GString &key)=0
 
virtual void remove (const GString &key)=0
 
virtual void put (const GPrimitive &value)=0
 Array modifiers.
 
virtual void put (double value)=0
 
virtual void put (int64 value)=0
 
virtual void put (bool value)=0
 
virtual void put (const GString &value)=0
 
virtual void insert (int32 index, const GPrimitive &value)=0
 
virtual void put (int32 index, const GPrimitive &value)=0
 
virtual void put (int32 index, double value)=0
 
virtual void put (int32 index, int64 value)=0
 
virtual void put (int32 index, bool value)=0
 
virtual void put (int32 index, const GString &value)=0
 
virtual void putNull (int32 index)=0
 
virtual void remove (int32 index)=0
 
virtual void remove (const GPrimitive &value)=0
 
- Public Member Functions inherited from Glympse::IComparable
virtual bool isEqual (const GCommon &o)=0
 Compares this instance with the specified object and indicates if they are equal. More...
 
- Public Member Functions inherited from Glympse::ICommon
virtual int32 retain ()=0
 Add a reference to our object in a COM-like way.
 
virtual int32 release ()=0
 Release a reference to our object in a COM-like way.
 
virtual int32 hold ()=0
 Add a reference to our object in a COM-like way.
 
virtual int32 unhold ()=0
 Release a reference to our object in a COM-like way.
 
virtual int32 hashCode ()=0
 Returns an integer hash code for this object.
 
virtual bool equals (const GCommonObj &o)=0
 Compares this instance with the specified object and indicates if they are equal. More...
 
virtual GString toString ()=0
 Returns a string containing a concise, human-readable description of this object. More...
 
virtual void attachObject (const GCommon &obj)=0
 Asociates arbitrary object with the instance.
 
virtual GCommon extractObject ()=0
 Extracts associated object or NULL if no association is established.
 

Additional Inherited Members

- Protected Member Functions inherited from Glympse::ICommon
virtual ~ICommon ()
 Destructor is protected to deny explicit object deallocation. More...
 

Detailed Description

The IPrimitive interface is designed to operate with free form data structures.

The model behind IPrimitive conforms to JavaScript Object Notation (JSON) (see http://www.ietf.org/rfc/rfc4627 for details).

Supported primitive types are (see CC):

Member Function Documentation

virtual bool Glympse::IPrimitive::merge ( const GPrimitive from,
bool  overrideTarget 
)
pure virtual

merge provides a mechanism for combining two primitives within the following rules.

If the rules are not met, the merge fails unless the overrideTarget parameter is set to true and then the merge becomes a copy operation. 1) For boolean string, long, double and null types only the same type may be merged in by default. 2) For an array any primitive can be merged into an array and will be appended to the end of an array. Merging two arrays will append clones of each element of the "from" array. 3) For object(hashtable) primitives only another object may be merged with it by default. For each key in the "from" primitive merge attempts to insert it into the target primitive according to these rules if the key already exists. If it doesn't exist, it always inserts a copy.


The documentation for this struct was generated from the following file: