Proud::CProperty Class Reference

A collection object that has more than 0 unit of Named Property. More...

Inheritance diagram for Proud::CProperty:

Classes

class  const_iterator
 

Public Types

typedef CFastMap< String,
CVariant, StringTraits
MapType
 

Public Member Functions

const_iterator begin () const
 
const_iterator end () const
 
size_t GetCount () const
 
void Remove (const String &key)
 
void Clear ()
 
bool TryGetValue (const String &key, CVariant &ret)
 
bool ContainsKey (const String &key)
 
bool Add (const String &key, const CVariant &val)
 
void CopyKeysTo (CFastArray< String > &dest)
 
PROUD_API CVariant GetField (const String &name)
 
virtual PROUD_API void SetField (const String &name, const CVariant &value)
 
virtual PROUD_API void RemoveField (const String &name)
 
virtual PROUD_API void FromVariant (_variant_t from)
 
virtual void FromByteArray (const ByteArray &from)
 
virtual PROUD_API void FromByteArray (const uint8_t *data, int length)
 
virtual PROUD_API void ToByteArray (ByteArray &output)
 
PROUD_API CProperty ()
 
PROUD_API CProperty (const CProperty &rhs)
 
 CProperty (_variant_t from)
 
PROUD_API operator _variant_t () const
 
PROUD_API operator ByteArrayPtr () const
 
CPropertyoperator= (const _variant_t &from)
 
CPropertyoperator= (ByteArray &from)
 
CPropertyoperator= (const CProperty &rhs)
 
PROUD_API String GetDumpedText ()
 

Protected Member Functions

virtual void AssertThreadID (eAccessMode eMode) const
 
virtual void ClearThreadID () const
 

Protected Attributes

MapType m_map
 

Friends

CMessageoperator<< (CMessage &packet, const CProperty &rhs)
 
CMessageoperator>> (CMessage &packet, CProperty &rhs)
 

Detailed Description

A collection object that has more than 0 unit of Named Property.

Definition

  • Unique key container associated with one value. 즉, Set of (key as case insensitive string, value as variant). In other words, except the fact that a sting that does not distinguish capital/small letters as key value enters, this acts as Collection of Visual Basic. For an example,
    { ('name','baehj'), ('id',123), ('height',176) }

Function

  • Since its value type is _variant_t type, the considerations must be taken when using this variable apply directly. (For an example, long can be used but int cannot be compatible.)
  • PropCollection object itself can be casted to _variant_t object. And the opposite is also possible. At that time, the contents of PropCollection will serialize to _variant_t. This allows the contents of PropCollection can be stored at binary type field in OLE DB.

Usage example

PropCollection a;
a.Fields[L"name"]=L"baehj";
a.Fields[L"id"]=123L;
a.Fields[L"height"]=176L;

Now a has { ('name','baehj'), ('id',123), ('height',176) }.

_bstr_t name=a.GetField(L"name"); -- "baehj" enters to name variable.
_variant_t serialized=a; //-- binary type data that a is serialized will enter serialized.
PropCollection b;
b=serialized; //-- b becomes equal to a.

Member Typedef Documentation

Map object that corresponds to field name and value

  • Caution!! It is allowed to directly access to this data member for iteration, but only allowed to write as read only.

Constructor & Destructor Documentation

PROUD_API Proud::CProperty::CProperty ( )

Base constructor

Proud::CProperty::CProperty ( _variant_t  from)

Helper function that make compatibility with CVariant type

Member Function Documentation

virtual PROUD_API void Proud::CProperty::FromVariant ( _variant_t  from)
virtual

The contents of variant of serialized bytearray type are to be deserialized and to be filled to this object.

Parameters
from..oriinal to copy
PROUD_API String Proud::CProperty::GetDumpedText ( )

Used to read or write field value. Please refer db_adding_fields

Converts the contents of this collection object into text string then outputs

  • Useful when debugging
PROUD_API CVariant Proud::CProperty::GetField ( const String name)

Gets a specific (key, value) pair in this collection object

  • Direct handling of Fields[] is recommended since it is easier than using this method.
    Returns
    value of the pair. Returns empty type variant when there is no pair corresponds to key.
    Parameters
    namekey of pair whose value should be retrieved
PROUD_API Proud::CProperty::operator _variant_t ( ) const

Helper function that make compatibility with _variant_t type

CProperty& Proud::CProperty::operator= ( const _variant_t &  from)
inline

Copy creator

virtual PROUD_API void Proud::CProperty::RemoveField ( const String name)
virtual

Removes specific (key, value) pair from this collection object

Parameters
namekey value of pair to be removed

Reimplemented in Proud::CPropNode.

virtual PROUD_API void Proud::CProperty::SetField ( const String name,
const CVariant value 
)
virtual

Specific (key, value) pair to be entered to this collection object. If there is the pair that has same key than new comer replaces itself with old one.

  • Direct handling of Fields[] is recommended since it is easier than using this method.
    Parameters
    namekey of pair
    valuevalue of pair

Reimplemented in Proud::CPropNode.

Friends And Related Function Documentation

CMessage& operator<< ( CMessage packet,
const CProperty rhs 
)
friend

PropCollection's Message serialization helper functions

CMessage& operator>> ( CMessage packet,
CProperty rhs 
)
friend

PropCollection's Message deserialization helper functions