#include "stdafx.h"
#include <adtf_base.h>
struct cPoint2D
{
cPoint2D()
{
m_x = 0;
m_y = 0;
}
public:
int32_t m_x;
int32_t m_y;
};
struct cConvertPoint2D
{
{
strToString.Append(adtf_util::cString::FromType(oFromValue.m_x));
strToString.Append(" ; ");
strToString.Append(adtf_util::cString::FromType(oFromValue.m_y));
}
{
adtf_util::cStringList vecStrings;
strFromString.Split(vecStrings, ";");
if (vecStrings.GetItemCount() == 2)
{
adtf_util::cStringUtil::ToType(vecStrings[0], oToValue.m_x);
adtf_util::cStringUtil::ToType(vecStrings[1], oToValue.m_y);
}
}
{
return oToMem.
Set(pData, szDataSize);
}
{
if (oFromMem.
GetSize() == szDataSize)
{
adtf_util::cMemoryBlock::MemCopy(pData, oFromMem.
Get(), szDataSize);
}
}
{
if (!strTypeOfValue.Compare("cString",0,7))
{
}
}
};
{
namespace base
{
namespace ant
{
template < >
struct property_type_definition<cPoint2D>
{
static constexpr
const tChar* TYPE_NAME =
"cPoint2D";
typedef cConvertPoint2D con_type;
};
}}}
int main(int , char * [])
{
cPoint2D oNewPoint2D;
oMyProps.SetProperty(propertyNewPoint2D);
{
oMyProps.GetProperty("TheNameOfTheProperty", oProperty);
std::cout << std::endl << "Old Point2D: x=" << oProperty.GetValueT().m_x << " / y=" << oProperty.GetValueT().m_y << std::endl;
}
{
oMyProps.GetProperty("TheNameOfTheProperty", oStringProperty);
std::cout << std::endl << "Point2D as cString: \"" << oStringProperty.GetValueT() <<"\"" << std::endl;
oStringProperty = " 23;42 ";
std::cout << std::endl << "Modified cString: \"" << oStringProperty.GetValueT() << "\"" << std::endl ;
oMyProps.SetProperty(oStringProperty);
}
{
oMyProps.GetProperty("TheNameOfTheProperty", oProperty);
std::cout << std::endl << "New Point2D: x=" << oProperty.GetValueT().m_x << " / y=" << oProperty.GetValueT().m_y << std::endl;
}
return 0;
}
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
A common result class usable as return value throughout.
The IPropertyValue interface provides methods for getting and setting property values.
virtual tResult ToString(IString &&strIToString) const =0
Implement to serialize the value to a textfile and/or to show it on a display.
virtual tResult GetType(IString &&strType) const =0
Retrieves the string for the property value type.
The IRawMemory interface provides methods for getting and setting memory values through abstract inte...
virtual tResult Set(const void *pValue, size_t szSize)=0
Sets the Raw pointer memory.
virtual size_t GetSize() const =0
Returns the size in bytes of the memory.
virtual const void * Get() const =0
Returns the raw memory pointer.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
#define adtf_string_intf(__string__)
The adtf_string_intf Macro helps to easily create a rvalue reference of a adtf::util::cString.