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


C++ TextFile::atEnd方法代码示例

本文整理汇总了C++中TextFile::atEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ TextFile::atEnd方法的具体用法?C++ TextFile::atEnd怎么用?C++ TextFile::atEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextFile的用法示例。


在下文中一共展示了TextFile::atEnd方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: load

bool EncodingTable::load(const std::wstring& fileName, TextFile::Encoding encoding)
{
	unsigned char hexBuffer[MAXHEXLENGTH];

	TextFile input;
	if (input.open(fileName,TextFile::Read,encoding) == false)
		return false;

	hexData.clear();
	valueData.clear();
	entries.clear();
	setTerminationEntry((unsigned char*)"\0",1);

	while (!input.atEnd())
	{
		std::wstring line = input.readLine();
		if (line.empty() || line[0] == '*') continue;
		
		if (line[0] == '/')
		{
			std::wstring hex = line.substr(1);
			if (hex.empty() || hex.length() > 2*MAXHEXLENGTH)
			{
				// error
				continue;
			}

			int length = parseHexString(hex,hexBuffer);
			if (length == -1)
			{
				// error
				continue;
			}

			setTerminationEntry(hexBuffer,length);
		} else {
			size_t pos = line.find(L'=');
			std::wstring hex = line.substr(0,pos);
			std::wstring value = line.substr(pos+1);

			if (hex.empty() || value.empty() || hex.length() > 2*MAXHEXLENGTH)
			{
				// error
				continue;
			}
			
			int length = parseHexString(hex,hexBuffer);
			if (length == -1)
			{
				// error
				continue;
			}

			addEntry(hexBuffer,length,value);
		}
	}

	return true;
}
开发者ID:StraDaMa,项目名称:armips,代码行数:59,代码来源:EncodingTable.cpp

示例2: LoadAssemblyFile

void LoadAssemblyFile(const std::wstring& fileName, TextFile::Encoding encoding)
{
	tTextData Text;
	int num = 0;

	AddFileName((char*)convertWStringToUtf8(fileName).c_str());
	Global.IncludeNestingLevel++;

	if (Global.IncludeNestingLevel == ASSEMBLER_INCLUDE_NESTING_LEVEL)
	{
		Logger::printError(Logger::Error,L"Maximum include nesting level reached");
		return;
	}

	TextFile input;
	if (input.open(fileName,TextFile::Read,encoding) == false)
	{
		Logger::printError(Logger::Error,L"Could not open file");
		return;
	}

	while (!input.atEnd())
	{
		Global.FileInfo.LineNumber++;
		Global.FileInfo.TotalLineCount++;

		if (GetLine(input,Text.buffer) == false) continue;
		if (Text.buffer.size() == 0) continue;
		
		Text.buffer = Global.symbolTable.insertEquations(Text.buffer,Global.FileInfo.FileNum,Global.Section);

		if (CheckEquLabel(Text.buffer) == false)
		{
			Text.buffer = checkLabel(Text.buffer,false);
			splitLine(Text.buffer,Text.name,Text.params);
			if (Text.name.empty()) continue;

			if (ParseMacro(input,Text.name,Text.params) == true) continue;
			if (Arch->AssembleDirective(Text.name,Text.params) == false)
			{
				Arch->AssembleOpcode(Text.name,Text.params);
			}
		}

		if (Logger::hasFatalError())
			return;
	}
	
	Logger::printQueue();
	Global.IncludeNestingLevel--;
	input.close();
}
开发者ID:kabochi,项目名称:armips,代码行数:52,代码来源:Assembler.cpp

示例3: parseMacroDefinition

void parseMacroDefinition(TextFile& Input, std::wstring& Args)
{
	tTextData Text;
	ArgumentList Arguments;

	splitArguments(Arguments,Args);

	CMacro* Macro = new CMacro();
	Macro->loadArguments(Arguments);

	while (true)
	{
		if (Input.atEnd())
		{
			Logger::printError(Logger::Error,L"Unexpected end of line in macro definition");
			return;
		}
		Global.FileInfo.LineNumber++;
		if (GetLine(Input,Text.buffer) == false) continue;
		if (Text.buffer.empty()) continue;
		splitLine(Text.buffer,Text.name,Text.params);
		if (Text.name.compare(L".endmacro") == 0) break;
		Macro->addLine(Text.buffer);
	}

	for (size_t i = 0; i < Global.Macros.size(); i++)
	{
		if (Macro->getName().compare(Global.Macros[i]->getName()) == 0)
		{
			Logger::printError(Logger::Error,L"Macro \"%s\" already defined",Macro->getName());
			delete Macro;
			return;
		}
	}

	Global.Macros.push_back(Macro);
}
开发者ID:kabochi,项目名称:armips,代码行数:37,代码来源:Assembler.cpp


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