本文整理汇总了C++中TextFile::getErrorText方法的典型用法代码示例。如果您正苦于以下问题:C++ TextFile::getErrorText方法的具体用法?C++ TextFile::getErrorText怎么用?C++ TextFile::getErrorText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextFile
的用法示例。
在下文中一共展示了TextFile::getErrorText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLine
bool GetLine(TextFile& Input, std::wstring& dest)
{
std::wstring Buffer = Input.readLine();
dest = L"";
if (Input.hasError())
Logger::printError(Logger::Warning,Input.getErrorText());
int InputPos = 0;
while (InputPos < (int)Buffer.size() && (Buffer[InputPos] == '\t' || Buffer[InputPos] == ' ')) InputPos++;
while (InputPos < (int)Buffer.size() && CheckEndLine(Buffer,InputPos) == false)
{
switch (Buffer[InputPos])
{
case ' ':
case '\t':
while (InputPos < (int)Buffer.size() && (Buffer[InputPos] == '\t' || Buffer[InputPos] == ' ')) InputPos++;
if (CheckEndLine(Buffer,InputPos) == true)
{
return true;
}
dest += ' ';
break;
case '"': // string
dest += towlower(Buffer[InputPos++]);
while (InputPos < (int)Buffer.size() && Buffer[InputPos] != '"')
{
if (InputPos+1 < (int)Buffer.size() && Buffer[InputPos] == '\\' && Buffer[InputPos+1] == '"')
{
dest += '\\';
dest += '"';
InputPos += 2;
continue;
}
if (InputPos+1 < (int)Buffer.size() && Buffer[InputPos] == '\\' && Buffer[InputPos+1] == '\\')
{
dest += '\\';
dest += '\\';
InputPos += 2;
continue;
}
if (Buffer[InputPos] == '\n' || Buffer[InputPos] == 0)
{
Logger::printError(Logger::Error,L"Unexpected end of line in string constant");
return false;
}
dest += Buffer[InputPos++];
}
if (InputPos == (int)Buffer.size())
{
Logger::printError(Logger::Error,L"Unexpected end of line in string constant");
return false;
}
dest += towlower(Buffer[InputPos++]);
break;
case '\'':
if (Buffer[InputPos+2] == '\'')
{
dest += Buffer[InputPos++];
dest += Buffer[InputPos++];
dest += Buffer[InputPos++];
} else {
Logger::printError(Logger::Error,L"Invalid character constant");
return false;
}
break;
default:
dest += towlower(Buffer[InputPos++]);
break;
}
}
return true;
}