本文整理汇总了C++中JString::GetCharacter方法的典型用法代码示例。如果您正苦于以下问题:C++ JString::GetCharacter方法的具体用法?C++ JString::GetCharacter怎么用?C++ JString::GetCharacter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JString
的用法示例。
在下文中一共展示了JString::GetCharacter方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
JBoolean
CBTCLCompleter::IsWordCharacter
(
const JString& s,
const JIndex index,
const JBoolean includeNS
)
const
{
const JCharacter c = s.GetCharacter(index);
return JI2B(isalnum(c) || c == '_' || (includeNS && c == ':'));
}
示例2: indexStr
JString
XDLink::Build1DArrayExpression
(
const JCharacter* origExpr,
const JInteger index
)
{
JString expr = origExpr;
const JString indexStr(index, 0); // must use floating point conversion
if (expr.Contains("$i"))
{
// double literal $'s
for (JIndex i=expr.GetLength()-1; i>=1; i--)
{
if (expr.GetCharacter(i) == '$' &&
expr.GetCharacter(i+1) != 'i')
{
expr.InsertCharacter('$', i);
}
}
const JCharacter* map[] =
{
"i", indexStr.GetCString()
};
(JGetStringManager())->Replace(&expr, map, sizeof(map));
}
else
{
expr.AppendCharacter('[');
expr += indexStr;
expr.AppendCharacter(']');
}
return expr;
}
示例3:
void
CBCSharpScanner::Undo
(
const JIndexRange& range,
const JString& text
)
{
for (JIndex i=text.GetLength(); i>=1; i--)
{
yyunput(text.GetCharacter(i), yytext);
}
itsCurrentRange.first = itsCurrentRange.last = range.first - 1;
}
示例4:
JBoolean
GMessageHeader::RangeContainsNWS
(
const JString& text,
const JIndex index1,
const JIndex index2
)
{
for (JIndex i = index1; i <= index2; i++)
{
JCharacter c = text.GetCharacter(i);
if (!isspace(c) && (c != '\n'))
{
return kJTrue;
}
}
return kJFalse;
}
示例5: if
void
JDirInfo::AppendRegex
(
const JCharacter* origStr,
JString* regexStr
)
{
JIndex i;
JString str = origStr;
// Convert wildcard multiples (*) to regex multiples (.*)
// and wildcard singles (?) to regex singles (.)
for (i = str.GetLength(); i>=1; i--)
{
const JCharacter c = str.GetCharacter(i);
if (c == '*')
{
str.InsertSubstring(".", i);
}
else if (c == '?')
{
str.SetCharacter(i, '.');
}
else if (JRegex::NeedsBackslashToBeLiteral(c))
{
str.InsertSubstring("\\", i);
}
}
// Add instructions that it must match the entire file name.
str.PrependCharacter('^');
str.AppendCharacter('$');
// append to regexStr
if (!regexStr->IsEmpty())
{
regexStr->AppendCharacter('|');
}
*regexStr += str;
}
示例6: JPGetGreekCharPrefixString
void
JFunctionWithVar::DrawString
(
const JExprRenderer& renderer,
const JCoordinate left,
const JCoordinate midline,
const JSize fontSize,
const JString& str
)
const
{
JCoordinate x = left;
const JCharacter* greekPrefix = JPGetGreekCharPrefixString();
const JSize greekPrefixLength = JPGetGreekCharPrefixLength();
JString s = str;
JIndex greekIndex;
while (s.LocateSubstring(greekPrefix, &greekIndex) &&
greekIndex < s.GetLength() - greekPrefixLength + 1)
{
if (greekIndex > 1)
{
const JString s1 = s.GetSubstring(1, greekIndex-1);
renderer.DrawString(x, midline, fontSize, s1);
x += renderer.GetStringWidth(fontSize, s1);
}
const JCharacter c = s.GetCharacter(greekIndex + greekPrefixLength);
renderer.DrawGreekCharacter(x, midline, fontSize, c);
x += renderer.GetGreekCharWidth(fontSize, c);
s.RemoveSubstring(1, greekIndex + greekPrefixLength);
}
if (!s.IsEmpty())
{
renderer.DrawString(x, midline, fontSize, s);
}
}
示例7: if
void
GMMIMEParser::FindStringEnd
(
const JString& val,
JIndex* index
)
{
JSize length = val.GetLength();
*index = *index + 1;
while (*index <= length)
{
JCharacter c = val.GetCharacter(*index);
if (c == '\"')
{
return;
}
else if ((c == '\\') && (*index < length))
{
*index = *index + 1;
}
*index = *index + 1;
}
}
示例8: iStr
JString
XDLink::Build2DArrayExpression
(
const JCharacter* origExpr,
const JInteger rowIndex,
const JInteger colIndex
)
{
JString expr = origExpr;
const JBoolean usesI = expr.Contains("$i"); // row
const JBoolean usesJ = expr.Contains("$j"); // col
const JString iStr(rowIndex, 0); // must use floating point conversion
const JString jStr(colIndex, 0); // must use floating point conversion
// We have to do both at the same time because otherwise we lose a $.
if (usesI || usesJ)
{
// double literal $'s
for (JIndex i=expr.GetLength()-1; i>=1; i--)
{
if (expr.GetCharacter(i) == '$' &&
expr.GetCharacter(i+1) != 'i' &&
expr.GetCharacter(i+1) != 'j')
{
expr.InsertCharacter('$', i);
}
}
const JCharacter* map[] =
{
"i", iStr.GetCString(),
"j", jStr.GetCString()
};
(JGetStringManager())->Replace(&expr, map, sizeof(map));
}
if (!usesI || !usesJ)
{
if (expr.GetFirstCharacter() != '(' ||
expr.GetLastCharacter() != ')')
{
expr.PrependCharacter('(');
expr.AppendCharacter(')');
}
if (!usesI)
{
expr.AppendCharacter('[');
expr += iStr;
expr.AppendCharacter(']');
}
if (!usesJ)
{
expr.AppendCharacter('[');
expr += jStr;
expr.AppendCharacter(']');
}
}
return expr;
}
示例9: JCalcMatchLength
JString
JConvertToRelativePath
(
const JCharacter* origPath,
const JCharacter* origBase
)
{
// Check that they are both absolute paths.
assert( origPath != NULL && origPath[0] == '/' &&
origBase != NULL && origBase[0] == '/' );
// Remove extra directory separators
// and make sure that base ends with one.
JString path = origPath;
JCleanPath(&path);
JString base = origBase;
JCleanPath(&base);
JAppendDirSeparator(&base);
// Find and remove the matching directories at the beginning.
// The while loop backs us up so we only consider complete directory names.
JBoolean hadTDS = kJTrue;
if (path.GetLastCharacter() != '/')
{
path.AppendCharacter('/');
hadTDS = kJFalse;
}
JSize matchLength = JCalcMatchLength(path, base);
if (!hadTDS)
{
path.RemoveSubstring(path.GetLength(), path.GetLength());
}
while (base.GetCharacter(matchLength) != '/')
{
matchLength--;
}
assert( matchLength >= 1 );
if (matchLength == 1)
{
return path;
}
if (matchLength > path.GetLength())
{
base.RemoveSubstring(matchLength, matchLength);
matchLength--;
}
path.RemoveSubstring(1, matchLength);
base.RemoveSubstring(1, matchLength);
if (base.IsEmpty())
{
path.Prepend("./");
return path;
}
// The number of remaining directory separators in base
// is the number of levels to go up.
JSize upCount = 0;
const JSize baseLength = base.GetLength();
for (JIndex i=1; i<=baseLength; i++)
{
if (base.GetCharacter(i) == '/')
{
upCount++;
path.Prepend("../");
}
}
assert( upCount > 0 );
return path;
}
示例10: if
void
CBCompileDocument::AppendText
(
const JString& origText
)
{
const JString* text = &origText;
JBoolean deleteText = kJFalse;
if (strchr(*text, kMultibyteMarker) != NULL)
{
JString* s = jnew JString(origText);
assert( s != NULL );
text = s;
deleteText = kJTrue;
JSize length = s->GetLength();
for (JIndex i=1; i<=length; i++)
{
if (s->GetCharacter(i) == kMultibyteMarker && i <= length-2)
{
const unsigned char c1 = s->GetCharacter(i+1);
const unsigned char c2 = s->GetCharacter(i+2);
const JIndex u = (((unsigned int) (unsigned char) c1) << 8) |
((unsigned int) (unsigned char) c2);
if (u == 32920 || u == 32921)
{
s->ReplaceSubstring(i, i+2, "'");
}
else
{
std::cout << "jcc: AppendText: unicode: " << u << std::endl;
s->ReplaceSubstring(i, i+2, "\x80");
}
length -= 2;
}
}
}
const JBoolean isJavacError = javacOutputRegex.Match(*text);
JIndexRange gccPrevLineRange, gccRange;
const JBoolean isGCCError = JI2B(!isJavacError && gccErrorRegex.Match(*text, &gccRange));
JIndexRange flexRange;
const JBoolean isFlexError = flexErrorRegex.Match(*text, &flexRange);
JIndexRange bisonRange;
const JBoolean isBisonError = bisonErrorRegex.Match(*text, &bisonRange);
JIndexRange makeRange;
const JBoolean isMakeError = JI2B(
makeErrorRegex.Match(*text, &makeRange) && !text->EndsWith(makeIgnoreErrorStr) );
JArray<JIndexRange> absoftRangeList;
const JBoolean isAbsoftError = absoftErrorRegex.Match(*text, &absoftRangeList);
JArray<JIndexRange> maven2RangeList;
const JBoolean isMaven2Error = maven2ErrorRegex.Match(*text, &maven2RangeList);
JArray<JIndexRange> maven3RangeList;
const JBoolean isMaven3Error = maven3ErrorRegex.Match(*text, &maven3RangeList);
if (isGCCError &&
gccErrorRegex.Match(itsPrevLine, &gccPrevLineRange) &&
gccPrevLineRange == gccRange &&
JCompareMaxN(itsPrevLine, *text, gccRange.last, kJTrue))
{
JString s = *text;
s.RemoveSubstring(1, gccRange.last - 1);
s.Prepend(" /");
// in front of 1 or 2 trailing newlines
CBTextEditor* te = GetTextEditor();
te->SetCaretLocation(te->GetTextLength() - (theDoubleSpaceFlag ? 1 : 0));
te->Paste(s);
}
else if (!isJavacError && !isGCCError &&
gccErrorRegex.Match(itsPrevLine, &gccPrevLineRange) &&
text->BeginsWith(gccMultilinePrefix) &&
text->GetLength() > kGCCMultilinePrefixLength &&
!isspace(text->GetCharacter(kGCCMultilinePrefixLength+1)))
{
JString s = *text;
s.RemoveSubstring(1, strlen(gccMultilinePrefix));
CBTextEditor* te = GetTextEditor();
te->SetCaretLocation(te->GetTextLength() - (theDoubleSpaceFlag ? 1 : 0));
te->Paste(s);
}
else
{
CBTextEditor* te = GetTextEditor();
const JIndex startIndex = te->GetTextLength() + 1;
CBExecOutputDocument::AppendText(*text);
if (theDoubleSpaceFlag)
{
//.........这里部分代码省略.........
示例11: if
void
SMTPMessage::ReadReturnValue()
{
JString line;
JBoolean ok = itsLink->GetNextMessage(&line);
assert(ok);
if (itsCurrentMode != kDataHeader)
{
GMGetSMTPDebugDir()->AddText(line);
}
if ((itsCurrentMode != kStartUp) && (itsCurrentMode != kDataHeader))
{
JInteger value;
JIndex findex;
ok = line.LocateSubstring(" ", &findex);
if (ok && (findex > 1))
{
JString number = line.GetSubstring(1, findex - 1);
if (number.IsInteger())
{
number.ConvertToInteger(&value);
}
else
{
ok = kJFalse;
}
}
else
{
ok = kJFalse;
}
if (!ok)
{
const JIndex kDashIndex = 4;
if (line.GetCharacter(kDashIndex) == '-')
{
// this is a multiline response.
return;
}
}
if (!ok || (value != kOKValue))
{
if (!itsIsTryingToQuit)
{
const JCharacter* map[] =
{
"err", line
};
const JString msg = JGetString("SMTPERROR", map, sizeof(map));
JGetUserNotification()->ReportError(msg);
}
itsIsFinished = kJTrue;
Broadcast(SendFailure());
if (!itsIsTryingToQuit)
{
itsDeleteTask = new JXTimerTask(1000,kJTrue);
assert( itsDeleteTask != NULL );
itsDeleteTask->Start();
ListenTo(itsDeleteTask);
}
return;
}
}
if (itsCurrentMode < kTo)
{
itsCurrentMode++;
}
else if (itsCurrentMode == kTo)
{
if (itsCurrentIndex < itsToNames->GetElementCount())
{
itsCurrentIndex++;
}
else if (itsCcNames->GetElementCount() != 0)
{
itsCurrentMode = kCc;
itsCurrentIndex = 1;
}
else if (itsBccNames->GetElementCount() != 0)
{
itsCurrentMode = kBcc;
itsCurrentIndex = 1;
}
else
{
itsCurrentMode = kDataHeader;
}
}
else if (itsCurrentMode == kCc)
{
if (itsCurrentIndex < itsCcNames->GetElementCount())
{
itsCurrentIndex++;
}
//.........这里部分代码省略.........