当前位置: 首页>>代码示例>>C++>>正文


C++ Datum::ExportBitPairDirectParse方法代码示例

本文整理汇总了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);
//.........这里部分代码省略.........
开发者ID:jleclanche,项目名称:darkdust-ctp2,代码行数:101,代码来源:MemberClass.cpp

示例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;
//.........这里部分代码省略.........
开发者ID:jleclanche,项目名称:darkdust-ctp2,代码行数:101,代码来源:MemberClass.cpp


注:本文中的Datum::ExportBitPairDirectParse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。