本文整理汇总了C++中Datum::ExportBitPairDirectParse方法的典型用法代码示例。如果您正苦于以下问题:C++ Datum::ExportBitPairDirectParse方法的具体用法?C++ Datum::ExportBitPairDirectParse怎么用?C++ Datum::ExportBitPairDirectParse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datum
的用法示例。
在下文中一共展示了Datum::ExportBitPairDirectParse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExportDefaultToken
void MemberClass::ExportDefaultToken(FILE *outfile, char *recordName)
{
PointerList<Datum>::Walker walk(&m_datumList);
Datum *dat = walk.GetObj();
if(dat->m_maxSize == k_MAX_SIZE_VARIABLE) {
switch(dat->m_type) {
case DATUM_INT:
fprintf(outfile, " Assert(false)\n");
fprintf(outfile, " if(!CTPRecord::ParseIntInArray(lex, &m_%s, &m_num%s)) {\n", dat->m_name, dat->m_name);
break;
case DATUM_STRINGID:
fprintf(outfile, " Assert(false)\n");
fprintf(outfile, " if(!CTPRecord::ParseStringIdInArray(lex, m_%s, &m_num%s)) {\n", dat->m_name, dat->m_name);
break;
case DATUM_FLOAT:
fprintf(outfile, " Assert(false)\n");
fprintf(outfile, " if(!CTPRecord::ParseFloatInArray(lex, &m_%s, &m_num%s)) {\n", dat->m_name, dat->m_name);
break;
case DATUM_STRING:
case DATUM_FILE:
fprintf(outfile, " Assert(false)\n");
fprintf(outfile, " if(!CTPRecord::ParseFileInArray(lex, &m_%s, &m_num%s)) {\n", dat->m_name, dat->m_name);
break;
case DATUM_RECORD:
fprintf(outfile, " Assert(false)\n");
fprintf(outfile, " if(!g_the%sDB->ParseRecordInArray(lex, &m_%s, &m_num%s)) {\n", dat->m_subType, dat->m_name, dat->m_name);
break;
case DATUM_STRUCT:
fprintf(outfile, " if(!%sRecord::%s::ParseInArraySequential(lex, &m_%s, &m_num%s)) {\n", recordName, dat->m_subType, dat->m_name, dat->m_name);
break;
default:
Assert(0);
break;
}
fprintf(outfile, " DBERROR((\"Unknown token\"));\n");
fprintf(outfile, " done = true; break;\n");
fprintf(outfile, " }\n");
} else if(dat->m_maxSize > 0) {
switch(dat->m_type) {
case DATUM_INT:
fprintf(outfile, " Assert(false)\n");
fprintf(outfile, " if(!CTPRecord::GetIntInArray(lex, &m_%s, &m_num%s, k_MAX_%s)) {\n",
dat->m_name, dat->m_name, dat->m_name);
break;
case DATUM_STRINGID:
fprintf(outfile, " Assert(false)\n");
fprintf(outfile, " if(!CTPRecord::GetStringIdInArray(lex, &m_%s, &m_num%s, k_MAX_%s)) {\n",
dat->m_name, dat->m_name, dat->m_name);
break;
case DATUM_FLOAT:
fprintf(outfile, " Assert(false)\n");
fprintf(outfile, " if(!CTPRecord::ParseFloatInArray(lex, &m_%s, &m_num%s, k_MAX_%s)) {\n",
dat->m_name, dat->m_name, dat->m_name);
break;
case DATUM_STRING:
case DATUM_FILE:
fprintf(outfile, " Assert(false)\n");
fprintf(outfile, " if(!CTPRecord::ParseFileInArray(lex, &m_%s, &m_num%s, k_MAX_%s)) {\n",
dat->m_name, dat->m_name, dat->m_name);
break;
case DATUM_RECORD:
fprintf(outfile, " Assert(false)\n");
fprintf(outfile, " if(!g_the%sDB->ParseRecordInArray(lex, &m_%s, &m_num%s, k_MAX_%s)) {\n",
dat->m_subType, dat->m_name, dat->m_name, dat->m_name);
break;
case DATUM_STRUCT:
fprintf(outfile, " if(!%sRecord::%s::ParseInArraySequential(lex, &m_%s, &m_num%s, k_MAX_%s)) {\n",
recordName, dat->m_subType, dat->m_name, dat->m_name, dat->m_name);
break;
default:
Assert(0);
break;
}
} else if(dat->m_maxSize < 0) {
switch(dat->m_type) {
case DATUM_INT:
fprintf(outfile, " if(!lex->GetInt(m_%s)) {\n", dat->m_name);
fprintf(outfile, " DBERROR((\"Unknown token\"));\n");
fprintf(outfile, " done = true; break;\n");
fprintf(outfile, " }\n");
break;
case DATUM_STRINGID:
fprintf(outfile, " if(!lex->GetStringId(m_%s)) {\n", dat->m_name);
fprintf(outfile, " DBERROR((\"Unknown token\"));\n");
fprintf(outfile, " done = true; break;\n");
fprintf(outfile, " }\n");
break;
case DATUM_BIT:
fprintf(outfile, " m_flags%d |= k_%s_%s_Bit;\n", dat->m_bitNum / 32,
m_name, dat->m_name);
break;
case DATUM_BIT_PAIR:
fprintf(outfile, " m_flags%d |= k_%s_%s_Bit;\n", dat->m_bitNum / 32,
m_name, dat->m_name);
dat->ExportBitPairDirectParse(outfile, m_name);
break;
case DATUM_FLOAT:
fprintf(outfile, " if(!lex->GetFloat(m_%s)) {\n", dat->m_name);
//.........这里部分代码省略.........
示例2: ExportTokenCases
void MemberClass::ExportTokenCases(FILE *outfile, char *recordName)
{
for
(
PointerList<Datum>::Walker walk(&m_datumList);
walk.IsValid();
walk.Next()
)
{
Datum *dat = walk.GetObj();
fprintf(outfile, " case k_Token_%s_%s_%s:\n", recordName, m_name, dat->m_name);
if(dat->m_akaName){
fprintf(outfile, " case k_Token_%s_%s_%s:\n", recordName, m_name, dat->m_akaName);
}
if(dat->m_maxSize == k_MAX_SIZE_VARIABLE) {
switch(dat->m_type) {
case DATUM_INT:
fprintf(outfile, " if(!CTPRecord::ParseIntInArray(lex, &m_%s, &m_num%s)) {\n", dat->m_name, dat->m_name);
break;
case DATUM_STRINGID:
fprintf(outfile, " if(!CTPRecord::ParseStringIdInArray(lex, m_%s, &m_num%s)) {\n", dat->m_name, dat->m_name);
break;
case DATUM_FLOAT:
fprintf(outfile, " if(!CTPRecord::ParseFloatInArray(lex, &m_%s, &m_num%s)) {\n", dat->m_name, dat->m_name);
break;
case DATUM_STRING:
case DATUM_FILE:
fprintf(outfile, " if(!CTPRecord::ParseFileInArray(lex, &m_%s, &m_num%s)) {\n", dat->m_name, dat->m_name);
break;
case DATUM_RECORD:
fprintf(outfile, " if(!g_the%sDB->ParseRecordInArray(lex, &m_%s, &m_num%s)) {\n", dat->m_subType, dat->m_name, dat->m_name);
break;
case DATUM_STRUCT:
fprintf(outfile, " if(!%sRecord::%s::ParseInArray(lex, &m_%s, &m_num%s)) {\n", recordName, dat->m_subType, dat->m_name, dat->m_name);
break;
default:
Assert(0);
break;
}
fprintf(outfile, " done = true; break;\n");
fprintf(outfile, " }\n");
} else if(dat->m_maxSize > 0) {
switch(dat->m_type) {
case DATUM_INT:
fprintf(outfile, " if(!CTPRecord::GetIntInArray(lex, &m_%s, &m_num%s, k_MAX_%s)) {\n",
dat->m_name, dat->m_name, dat->m_name);
break;
case DATUM_STRINGID:
fprintf(outfile, " if(!CTPRecord::GetStringIdInArray(lex, &m_%s, &m_num%s, k_MAX_%s)) {\n",
dat->m_name, dat->m_name, dat->m_name);
break;
case DATUM_FLOAT:
fprintf(outfile, " if(!CTPRecord::ParseFloatInArray(lex, &m_%s, &m_num%s, k_MAX_%s)) {\n",
dat->m_name, dat->m_name, dat->m_name);
break;
case DATUM_STRING:
case DATUM_FILE:
fprintf(outfile, " if(!CTPRecord::ParseFileInArray(lex, &m_%s, &m_num%s, k_MAX_%s)) {\n",
dat->m_name, dat->m_name, dat->m_name);
break;
case DATUM_RECORD:
fprintf(outfile, " if (!g_the%sDB->ParseRecordInArray(lex, &m_%s, &m_num%s, k_MAX_%s)) {\n",
dat->m_subType, dat->m_name, dat->m_name, dat->m_name);
break;
case DATUM_STRUCT:
fprintf(outfile, " if(!%sRecord::%s::ParseInArray(lex, &m_%s, &m_num%s, k_MAX_%s)) {\n",
recordName, dat->m_subType, dat->m_name, dat->m_name, dat->m_name);
break;
default:
Assert(0);
break;
}
} else if(dat->m_maxSize < 0) {
switch(dat->m_type) {
case DATUM_INT:
fprintf(outfile, " if(!lex->GetIntAssignment(m_%s)) {\n", dat->m_name);
fprintf(outfile, " done = true; break;\n");
fprintf(outfile, " }\n");
break;
case DATUM_STRINGID:
fprintf(outfile, " if(!lex->GetStringIdAssignment(m_%s)) {\n", dat->m_name);
fprintf(outfile, " done = true; break;\n");
fprintf(outfile, " }\n");
break;
case DATUM_BIT:
fprintf(outfile, " m_flags%d |= k_%s_%s_Bit;\n", dat->m_bitNum / 32,
m_name, dat->m_name);
break;
case DATUM_BIT_PAIR:
fprintf(outfile, " m_flags%d |= k_%s_%s_Bit;\n", dat->m_bitNum / 32,
m_name, dat->m_name);
dat->ExportBitPairDirectParse(outfile, m_name);
break;
case DATUM_FLOAT:
fprintf(outfile, " if(!lex->GetFloatAssignment(m_%s)) {\n", dat->m_name);
fprintf(outfile, " done = true; break;\n");
fprintf(outfile, " }\n");
break;
//.........这里部分代码省略.........