本文整理汇总了C++中KeyType::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyType::isEmpty方法的具体用法?C++ KeyType::isEmpty怎么用?C++ KeyType::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyType
的用法示例。
在下文中一共展示了KeyType::isEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseLine
ConfigFile::LineType ConfigFile::parseLine(const char* fileName, const String& input, KeyType& key, String& value)
{
int inString = 0;
String::size_type valStart = 0;
String::size_type eol = String::npos;
bool hasSub = false;
const char* include = "include";
const unsigned incLen = strlen(include);
for (String::size_type n = 0; n < input.length(); ++n)
{
switch (input[n])
{
case '"':
if (key.isEmpty()) // quoted string to the left of = doesn't make sense
return LINE_BAD;
if (inString >= 2) // one more quote after quoted string doesn't make sense
return LINE_BAD;
inString++;
break;
case '=':
if (key.isEmpty())
{
key = input.substr(0, n).ToNoCaseString();
key.rtrim(" \t\r");
if (key.isEmpty()) // not good - no key
return LINE_BAD;
valStart = n + 1;
}
else if (inString >= 2) // Something after the end of line
return LINE_BAD;
break;
case '#':
if (inString != 1)
{
eol = n;
n = input.length(); // skip the rest of symbols
}
break;
case ' ':
case '\t':
if (n == incLen && key.isEmpty())
{
KeyType inc = input.substr(0, n).ToNoCaseString();
if (inc == include)
{
value = input.substr(n);
value.alltrim(" \t\r");
if (!macroParse(value, fileName))
{
return LINE_BAD;
}
return LINE_INCLUDE;
}
}
// fall down ...
case '\r':
break;
case '{':
case '}':
if (flags & HAS_SUB_CONF)
{
if (inString != 1)
{
if (input[n] == '}') // Subconf close mark not expected
{
return LINE_BAD;
}
hasSub = true;
inString = 2;
eol = n;
}
break;
}
// fall through ....
default:
if (inString >= 2) // Something after the end of line
return LINE_BAD;
break;
}
}
if (inString == 1) // If we are still inside a string, it's error
return LINE_BAD;
if (key.isEmpty())
{
key = input.substr(0, eol).ToNoCaseString();
key.rtrim(" \t\r");
value.erase();
}
else
{
//.........这里部分代码省略.........