本文整理汇总了C++中string::CharPointerType::isWhitespace方法的典型用法代码示例。如果您正苦于以下问题:C++ CharPointerType::isWhitespace方法的具体用法?C++ CharPointerType::isWhitespace怎么用?C++ CharPointerType::isWhitespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类string::CharPointerType
的用法示例。
在下文中一共展示了CharPointerType::isWhitespace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parsePreprocessorDefs
//==============================================================================
StringPairArray parsePreprocessorDefs (const String& text)
{
StringPairArray result;
String::CharPointerType s (text.getCharPointer());
while (! s.isEmpty())
{
String token, value;
s = s.findEndOfWhitespace();
while ((! s.isEmpty()) && *s != '=' && ! s.isWhitespace())
token << s.getAndAdvance();
s = s.findEndOfWhitespace();
if (*s == '=')
{
++s;
while ((! s.isEmpty()) && *s == ' ')
++s;
while ((! s.isEmpty()) && ! s.isWhitespace())
{
if (*s == ',')
{
++s;
break;
}
if (*s == '\\' && (s[1] == ' ' || s[1] == ','))
++s;
value << s.getAndAdvance();
}
}
if (token.isNotEmpty())
result.set (token, value);
}
return result;
}
示例2: nextToken
static String nextToken (String::CharPointerType& t)
{
t = t.findEndOfWhitespace();
String::CharPointerType start (t);
size_t numChars = 0;
while (! (t.isEmpty() || t.isWhitespace()))
{
++t;
++numChars;
}
return String (start, numChars);
}
示例3: findFirstNonWhitespaceChar
int findFirstNonWhitespaceChar (const String& line) noexcept
{
String::CharPointerType t (line.getCharPointer());
int i = 0;
while (! t.isEmpty())
{
if (! t.isWhitespace())
return i;
++t;
++i;
}
return 0;
}
示例4: addCurtailedLineOfText
void GlyphArrangement::addCurtailedLineOfText (const Font& font,
const String& text,
const float xOffset,
const float yOffset,
const float maxWidthPixels,
const bool useEllipsis)
{
if (text.isNotEmpty())
{
Array <int> newGlyphs;
Array <float> xOffsets;
font.getGlyphPositions (text, newGlyphs, xOffsets);
const int textLen = newGlyphs.size();
glyphs.ensureStorageAllocated (glyphs.size() + textLen);
String::CharPointerType t (text.getCharPointer());
for (int i = 0; i < textLen; ++i)
{
const float thisX = xOffsets.getUnchecked (i);
const float nextX = xOffsets.getUnchecked (i + 1);
if (nextX > maxWidthPixels + 1.0f)
{
// curtail the string if it's too wide..
if (useEllipsis && textLen > 3 && glyphs.size() >= 3)
insertEllipsis (font, xOffset + maxWidthPixels, 0, glyphs.size());
break;
}
else
{
const bool isWhitespace = t.isWhitespace();
glyphs.add (new PositionedGlyph (font, t.getAndAdvance(),
newGlyphs.getUnchecked(i),
xOffset + thisX, yOffset,
nextX - thisX, isWhitespace));
}
}
}
}