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) const
 
bool ContainsKey (const String &key) const
 
bool Add (const String &key, const CVariant &val)
 
void CopyKeysTo (CFastArray< String > &dest)
 
PROUDSRV_API CVariant GetField (const String &name)
 
virtual PROUDSRV_API void SetField (const String &name, const CVariant &value)
 
virtual PROUDSRV_API void RemoveField (const String &name)
 
virtual PROUDSRV_API void FromVariant (_variant_t from)
 
virtual PROUDSRV_API void FromByteArray (const ByteArray &from)
 
virtual PROUDSRV_API void FromByteArray (const uint8_t *data, int length)
 
virtual PROUDSRV_API void ToByteArray (ByteArray &output)
 
PROUDSRV_API CProperty ()
 
PROUDSRV_API CProperty (const CProperty &rhs)
 
 CProperty (_variant_t from)
 
PROUDSRV_API operator _variant_t () const
 
PROUDSRV_API operator ByteArrayPtr () const
 
CPropertyoperator= (const _variant_t &from)
 
CPropertyoperator= (ByteArray &from)
 
CPropertyoperator= (const CProperty &rhs)
 
PROUDSRV_API String GetDumpedText ()
 

Protected Member Functions

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

Protected Attributes

MapType m_map
 

Friends

PROUDSRV_API CMessageoperator<< (CMessage &packet, const CProperty &rhs)
 
PROUDSRV_API 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

PROUDSRV_API Proud::CProperty::CProperty ( )

Base constructor

Proud::CProperty::CProperty ( _variant_t  from)

Helper function that make compatibility with CVariant type

Member Function Documentation

virtual PROUDSRV_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
PROUDSRV_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
PROUDSRV_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
PROUDSRV_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 PROUDSRV_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 PROUDSRV_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

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

PropCollection's Message serialization helper functions

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

PropCollection's Message deserialization helper functions