Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cStructElem Class Reference

#include <cStructElem.h>

Public Member Functions

void * GetValPtr (const void *pBaseInst) const noexcept
 
size_t get_TypeLength () const
 
size_t GetDataLength (const void *pBaseInst) const
 
COMPARE_t CompareVal (const void *pBase1, const void *pBase2) const
 
COMPARE_t CompareVar (void *pBaseInst, const cVariant &vVal) const
 
int GetValInt (const void *pBaseInst) const
 
cString GetValStr (const void *pBaseInst) const
 
bool GetValVar (const void *pBaseInst, cVariant &vVal) const
 
bool SetValInt (void *pBaseInst, int iVal) const
 
bool SetValStr (void *pBaseInst, cString sVal) const
 
bool SetValVar (void *pBaseInst, const cVariant &vVal) const
 
HRESULT SetValCheck (void *pBaseInst, const cVariant &vVal) const
 
HRESULT SerializeInput (cStreamInput &file, void *pBaseInst) const
 
HRESULT SerializeOutput (cStreamOutput &file, const void *pBaseInst) const
 
HRESULT Serialize (cStream &file, bool bModeWrite, void *pBaseInst) const
 
HRESULT Serialize (cArchive &a, void *pBaseInst) const
 
HRESULT ScriptWrite (IScriptableSetter *pScript, const void *pBaseInst, const ATOMCHAR_t *pszPropName) const
 
HRESULT ScriptRead (IScriptableGetter *pScript, void *pBaseInst, const ATOMCHAR_t *pszPropName) const
 
 UNITTEST_FRIEND (cStructElem)
 

Public Attributes

VARTYPE_TYPE m_eVarType
 effective type of the data in the mapped structure. More...
 
size_t m_offset
 The offset into the struct/class instance for this item. More...
 
UINT m_extra
 m_extra for VARTYPE_StringConst = max size. More...
 

Detailed Description

Describe an element of a structure/class. a field. define/map a single element/field of a structure. For convert to/from cVariant

Member Function Documentation

◆ CompareVal()

COMPARE_t GrayLib::cStructElem::CompareVal ( const void *  pBase1,
const void *  pBase2 
) const

Compare an element from 2 examples of this structure.

  • pBaseInst = the base of the structure/class described.

◆ CompareVar()

COMPARE_t GrayLib::cStructElem::CompareVar ( void *  pBaseInst,
const cVariant vVal 
) const

◆ get_TypeLength()

size_t GrayLib::cStructElem::get_TypeLength ( ) const

Get the base size of the type irrelevant of the instance data. I.E. Variable size stuff is not going to show up.

◆ GetDataLength()

size_t GrayLib::cStructElem::GetDataLength ( const void *  pBaseInst) const

I.E. Variable size stuff IS going to show up.

Returns
Length in bytes to serialize this.

◆ GetValInt()

int GrayLib::cStructElem::GetValInt ( const void *  pBaseInst) const

◆ GetValPtr()

void* GrayLib::cStructElem::GetValPtr ( const void *  pBaseInst) const
inlinenoexcept

get a raw cVariantData pointer to the element.

◆ GetValStr()

cString GrayLib::cStructElem::GetValStr ( const void *  pBaseInst) const

◆ GetValVar()

bool GrayLib::cStructElem::GetValVar ( const void *  pBaseInst,
cVariant vVal 
) const

Get the element value as a cVariant.

  • pBaseInst = the base of the structure/class described.

◆ ScriptRead()

HRESULT GrayLib::cStructElem::ScriptRead ( IScriptableGetter pScript,
void *  pBaseInst,
const ATOMCHAR_t pszPropName 
) const

Find this key in IScriptableGetter and set it to the cStructElem

◆ ScriptWrite()

HRESULT GrayLib::cStructElem::ScriptWrite ( IScriptableSetter pScript,
const void *  pBaseInst,
const ATOMCHAR_t pszPropName 
) const

get the value from cStructElem and write out to IScriptableSetter

◆ Serialize() [1/2]

HRESULT GrayLib::cStructElem::Serialize ( cArchive a,
void *  pBaseInst 
) const
inline

◆ Serialize() [2/2]

HRESULT GrayLib::cStructElem::Serialize ( cStream file,
bool  bModeWrite,
void *  pBaseInst 
) const
inline

Move the element. Read or Write.

Note
serialized files/streams MUST be carefully versioned of course

◆ SerializeInput()

HRESULT GrayLib::cStructElem::SerializeInput ( cStreamInput file,
void *  pBaseInst 
) const

◆ SerializeOutput()

HRESULT GrayLib::cStructElem::SerializeOutput ( cStreamOutput file,
const void *  pBaseInst 
) const
  • pBaseInst = the base of the structure/class described.

◆ SetValCheck()

HRESULT GrayLib::cStructElem::SetValCheck ( void *  pBaseInst,
const cVariant vVal 
) const

Set the value if not already set. check for value not changing.

Returns
S_OK = 0 = success in change. S_FALSE = 1 = no change.

◆ SetValInt()

bool GrayLib::cStructElem::SetValInt ( void *  pBaseInst,
int  iVal 
) const

◆ SetValStr()

bool GrayLib::cStructElem::SetValStr ( void *  pBaseInst,
cString  sVal 
) const

◆ SetValVar()

bool GrayLib::cStructElem::SetValVar ( void *  pBaseInst,
const cVariant vVal 
) const

Set this element value (at pBaseInst) from a cVariant.

  • pBaseInst = the base of the structure/class described.
    Returns
    true = valid set, false = error.

◆ UNITTEST_FRIEND()

GrayLib::cStructElem::UNITTEST_FRIEND ( cStructElem  )

Member Data Documentation

◆ m_eVarType

VARTYPE_TYPE GrayLib::cStructElem::m_eVarType

effective type of the data in the mapped structure.

◆ m_extra

UINT GrayLib::cStructElem::m_extra

m_extra for VARTYPE_StringConst = max size.

◆ m_offset

size_t GrayLib::cStructElem::m_offset

The offset into the struct/class instance for this item.


The documentation for this class was generated from the following files: