本文整理汇总了C++中StringW::getLength方法的典型用法代码示例。如果您正苦于以下问题:C++ StringW::getLength方法的具体用法?C++ StringW::getLength怎么用?C++ StringW::getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringW
的用法示例。
在下文中一共展示了StringW::getLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Object_validatePropertyName
// Object name can contain characters [A-Z], [a-z], '-', '_', [0-9]. Numbers
// are not allowed for the first character.
static err_t Object_validatePropertyName(const StringW& name)
{
const CharW* data = name.getData();
size_t length = name.getLength();
if (length == 0)
return ERR_PROPERTY_INVALID;
CharW c = data[0];
if (!(c.isAsciiLetter() || c == CharW('_') || c == CharW('-')))
return ERR_PROPERTY_INVALID;
for (size_t i = 1; i < length; i++)
{
if (!(c.isAsciiNumlet() || c == CharW('_') || c == CharW('-')))
return ERR_PROPERTY_INVALID;
}
return ERR_OK;
}
示例2: Application_parseWinCmdLine
static void Application_parseWinCmdLine(const StringW& cmdLine, List<StringW>& dst)
{
const CharW* cur = cmdLine.getData();
const CharW* end = cur + cmdLine.getLength();
const CharW* mark;
CharW quote;
bool isEscaped;
size_t len;
for (;;)
{
// Skip spaces.
for (;;)
{
if (cur == end) goto end;
if (cur->isSpace()) cur++;
else break;
}
// Zero character means end.
if (cur->isNull())
goto end;
// Parse quote character (if it's here).
mark = cur;
quote = 0;
if (cur[0] == CharW('\"') ||
cur[0] == CharW('\'') )
{
quote = cur[0];
}
cur++;
// Parse argument
isEscaped = false;
for (;;)
{
if (cur == end) goto parsed;
CharW c = cur[0];
if (c.isNull()) goto parsed;
if (c.isSpace() && quote.isNull()) goto parsed;
// Quotes.
if (c == quote)
{
cur++;
goto parsed;
}
// Escape sequence.
if (c == CharW('\\'))
{
if (cur < end - 1 && (cur[1] == CharW('\"') ||
cur[1] == CharW('\'') ||
cur[1] == CharW(' ')) )
{
cur++;
isEscaped = true;
}
}
cur++;
}
parsed:
len = (size_t)(cur - mark);
if (quote.isNull())
{
mark++;
len--;
if (len && mark[len-1] == quote) len--;
}
{
StringW arg(mark, len);
if (isEscaped)
Application_unescapeArgument(arg);
dst.append(arg);
}
}
end:
return;
}