本文整理汇总了C++中Datum::SetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Datum::SetValue方法的具体用法?C++ Datum::SetValue怎么用?C++ Datum::SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datum
的用法示例。
在下文中一共展示了Datum::SetValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddDatum
void MemberClass::AddDatum(DATUM_TYPE type, struct namelist *nameInfo,
sint32 minSize, sint32 maxSize,
char *subType)
{
Datum *dat = new Datum(nameInfo->name, type);
dat->m_akaName = nameInfo->akaName;
dat->m_defaultName = nameInfo->defaultName;
dat->m_minSize = minSize;
dat->m_maxSize = maxSize;
dat->m_subType = subType;
//Added by Martin Gühmann to allow struct members to have default values
if(!(nameInfo->flags & k_NAMEVALUE_HAS_VALUE)
&& maxSize <= 0
){
switch(type)
{
default:
break;
case DATUM_INT:
case DATUM_FLOAT:
case DATUM_STRUCT:
case DATUM_STRING:
case DATUM_FILE:
case DATUM_STRINGID:
dat->m_required = true;
break;
}
}
else
{
dat->SetValue(nameInfo->v);
}
m_datumList.AddTail(dat);
if (dat->m_type == DATUM_BIT)
{
dat->m_bitNum = m_numBits;
m_numBits++;
}
}
示例2: AddBitPair
//Added by Martin Gühmann
void MemberClass::AddBitPair(struct namelist *nameInfo, sint32 minSize, sint32 maxSize, struct bitpairtype *pairtype)
{
Datum *dat = new Datum(nameInfo->name, DATUM_BIT_PAIR);
dat->m_minSize = minSize;
dat->m_maxSize = maxSize;
// Added by Martin Gühmann for adding default values
if((nameInfo->flags & k_NAMEVALUE_HAS_VALUE)
|| (maxSize > 0)
){
dat->SetValue(nameInfo->v);
}
dat->m_bitNum = m_numBits;
m_numBits++;
char * l_Name = (char *) malloc(strlen(nameInfo->name) + strlen("Value") + 1);
strcpy(l_Name, nameInfo->name);
strcat(l_Name, "Value");
Datum * pairDat = new Datum(l_Name, (DATUM_TYPE) pairtype->type);
pairDat->m_subType = (char *) pairtype->extraData;
dat->m_bitPairDatum = pairDat;
m_datumList.AddTail(dat);
}