本文整理汇总了C++中string::CharPointerType::findEndOfWhitespace方法的典型用法代码示例。如果您正苦于以下问题:C++ CharPointerType::findEndOfWhitespace方法的具体用法?C++ CharPointerType::findEndOfWhitespace怎么用?C++ CharPointerType::findEndOfWhitespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类string::CharPointerType
的用法示例。
在下文中一共展示了CharPointerType::findEndOfWhitespace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: skipComma
inline void skipComma (String::CharPointerType& s)
{
s = s.findEndOfWhitespace();
if (*s == ',')
++s;
}
示例2: findOriginalValueInCode
void LivePropertyEditorBase::findOriginalValueInCode()
{
CodeDocument::Position pos (document, value.sourceLine, 0);
String line (pos.getLineText());
String::CharPointerType p (line.getCharPointer());
p = CharacterFunctions::find (p, CharPointer_ASCII ("JUCE_LIVE_CONSTANT"));
if (p.isEmpty())
{
// Not sure how this would happen - some kind of mix-up between source code and line numbers..
jassertfalse;
return;
}
p += (int) (sizeof ("JUCE_LIVE_CONSTANT") - 1);
p = p.findEndOfWhitespace();
if (! CharacterFunctions::find (p, CharPointer_ASCII ("JUCE_LIVE_CONSTANT")).isEmpty())
{
// Aargh! You've added two JUCE_LIVE_CONSTANT macros on the same line!
// They're identified by their line number, so you must make sure each
// one goes on a separate line!
jassertfalse;
}
if (p.getAndAdvance() == '(')
{
String::CharPointerType start (p), end (p);
int depth = 1;
while (! end.isEmpty())
{
const juce_wchar c = end.getAndAdvance();
if (c == '(') ++depth;
if (c == ')') --depth;
if (depth == 0)
{
--end;
break;
}
}
if (end > start)
{
valueStart = CodeDocument::Position (document, value.sourceLine, (int) (start - line.getCharPointer()));
valueEnd = CodeDocument::Position (document, value.sourceLine, (int) (end - line.getCharPointer()));
valueStart.setPositionMaintained (true);
valueEnd.setPositionMaintained (true);
wasHex = String (start, end).containsIgnoreCase ("0x");
}
}
}
示例3: parseAny
static Result parseAny (String::CharPointerType& t, var& result)
{
t = t.findEndOfWhitespace();
auto t2 = t;
switch (t2.getAndAdvance())
{
case '{': t = t2; return parseObject (t, result);
case '[': t = t2; return parseArray (t, result);
case '"': t = t2; return parseString ('"', t, result);
case '\'': t = t2; return parseString ('\'', t, result);
case '-':
t2 = t2.findEndOfWhitespace();
if (! CharacterFunctions::isDigit (*t2))
break;
t = t2;
return parseNumber (t, result, true);
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
return parseNumber (t, result, false);
case 't': // "true"
if (t2.getAndAdvance() == 'r' && t2.getAndAdvance() == 'u' && t2.getAndAdvance() == 'e')
{
t = t2;
result = var (true);
return Result::ok();
}
break;
case 'f': // "false"
if (t2.getAndAdvance() == 'a' && t2.getAndAdvance() == 'l'
&& t2.getAndAdvance() == 's' && t2.getAndAdvance() == 'e')
{
t = t2;
result = var (false);
return Result::ok();
}
break;
case 'n': // "null"
if (t2.getAndAdvance() == 'u' && t2.getAndAdvance() == 'l' && t2.getAndAdvance() == 'l')
{
t = t2;
result = var();
return Result::ok();
}
break;
default:
break;
}
return createFail ("Syntax error", &t);
}
示例4: 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;
}
示例5: parseObjectOrArray
static Result parseObjectOrArray (String::CharPointerType t, var& result)
{
t = t.findEndOfWhitespace();
switch (t.getAndAdvance())
{
case 0: result = var::null; return Result::ok();
case '{': return parseObject (t, result);
case '[': return parseArray (t, result);
}
return createFail ("Expected '{' or '['", &t);
}
示例6: 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);
}
示例7: parsePathString
//==============================================================================
void parsePathString (Path& path, const String& pathString) const
{
String::CharPointerType d (pathString.getCharPointer().findEndOfWhitespace());
Point<float> subpathStart, last, last2, p1, p2, p3;
juce_wchar lastCommandChar = 0;
bool isRelative = true;
bool carryOn = true;
const CharPointer_ASCII validCommandChars ("MmLlHhVvCcSsQqTtAaZz");
while (! d.isEmpty())
{
if (validCommandChars.indexOf (*d) >= 0)
{
lastCommandChar = d.getAndAdvance();
isRelative = (lastCommandChar >= 'a' && lastCommandChar <= 'z');
}
switch (lastCommandChar)
{
case 'M':
case 'm':
case 'L':
case 'l':
if (parseCoordsOrSkip (d, p1, false))
{
if (isRelative)
p1 += last;
if (lastCommandChar == 'M' || lastCommandChar == 'm')
{
subpathStart = p1;
path.startNewSubPath (p1);
lastCommandChar = 'l';
}
else
path.lineTo (p1);
last2 = last;
last = p1;
}
break;
case 'H':
case 'h':
if (parseCoord (d, p1.x, false, true))
{
if (isRelative)
p1.x += last.x;
path.lineTo (p1.x, last.y);
last2.x = last.x;
last.x = p1.x;
}
else
{
++d;
}
break;
case 'V':
case 'v':
if (parseCoord (d, p1.y, false, false))
{
if (isRelative)
p1.y += last.y;
path.lineTo (last.x, p1.y);
last2.y = last.y;
last.y = p1.y;
}
else
{
++d;
}
break;
case 'C':
case 'c':
if (parseCoordsOrSkip (d, p1, false)
&& parseCoordsOrSkip (d, p2, false)
&& parseCoordsOrSkip (d, p3, false))
{
if (isRelative)
{
p1 += last;
p2 += last;
p3 += last;
}
path.cubicTo (p1, p2, p3);
last2 = p2;
last = p3;
}
break;
//.........这里部分代码省略.........