本文整理汇总了C++中JString::Contains方法的典型用法代码示例。如果您正苦于以下问题:C++ JString::Contains方法的具体用法?C++ JString::Contains怎么用?C++ JString::Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JString
的用法示例。
在下文中一共展示了JString::Contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
JXButton::SetShortcuts
(
const JCharacter* list
)
{
JXWindow* w = GetWindow();
w->ClearShortcuts(this);
w->InstallShortcuts(this, list);
const JBoolean wasReturnButton = itsIsReturnButtonFlag;
itsIsReturnButtonFlag = kJFalse;
if (list != NULL)
{
JString shortcuts = list;
if (shortcuts.Contains("^M") || shortcuts.Contains("^m"))
{
itsIsReturnButtonFlag = kJTrue;
}
}
const JSize borderWidth = GetBorderWidth();
if (!wasReturnButton && itsIsReturnButtonFlag)
{
SetBorderWidth(borderWidth+1);
}
else if (wasReturnButton && !itsIsReturnButtonFlag && borderWidth > 0)
{
SetBorderWidth(borderWidth-1);
}
Refresh();
}
示例2:
inline JBoolean
JXFontManager::IsPostscript
(
const JString& name
)
const
{
#if ONLY_STD_PS_FONTS
return JI2B(name == "Arial" || // Helvetica sucks on OS X
name.BeginsWith("Courier") ||
name.BeginsWith("Helvetica") ||
name == "Symbol" ||
name == "Times" ||
name.Contains("Bookman") ||
name.Contains("Century Schoolbook") ||
name.Contains("Chancery") ||
name.Contains("Palatino"));
#else
return kJTrue;
#endif
}
示例3:
inline JBoolean
cbIsQualified
(
const JString& s
)
{
return JI2B(s.Contains(":") || s.Contains("."));
}
示例4: is
void
GPMProcessEntry::ReadStat()
{
const JSize uTime = itsUTime, sTime = itsSTime;
JString str = JCombinePathAndName(itsProcPath, "stat");
std::ifstream is(str);
if (is.good())
{
is >> itsPID;
is >> std::ws;
itsCommand = JReadUntilws(is);
if (itsCommand.GetLength() > 2)
{
itsCommand = itsCommand.GetSubstring(2, itsCommand.GetLength() - 1);
}
JString state = JReadUntilws(is);
if (state.Contains("S"))
{
itsState = kSleep;
}
else if (state.Contains("D"))
{
itsState = kUnIntSleep;
}
else if (state.Contains("Z"))
{
itsState = kZombie;
}
else if (state.Contains("T"))
{
itsState = kStopped;
}
else
{
itsState = kRun;
}
is >> itsPPID;
is >> std::ws;
int toss;
is >> toss;
is >> toss;
is >> toss;
is >> toss;
is >> toss;
is >> toss;
is >> toss;
is >> toss;
is >> toss;
is >> itsUTime;
is >> itsSTime;
is >> toss;
is >> toss;
is >> itsPriority;
is >> itsNice;
}
示例5: input
JBoolean
JSearchFile
(
const JCharacter* fileName,
const JCharacter* searchStr,
const JBoolean caseSensitive,
JIndex* lineIndex
)
{
ifstream input(fileName);
*lineIndex = 0;
while (!input.eof())
{
(*lineIndex)++;
const JString line = JReadLine(input);
if (input.fail())
{
break;
}
if (line.Contains(searchStr, caseSensitive))
{
return kJTrue;
}
}
return kJFalse;
}
示例6: sizeof
void
JWebBrowser::ShowFileLocation
(
const JCharacter* fileName
)
{
if (!JStringEmpty(itsShowFileLocationCmd))
{
JString fullName = fileName;
JStripTrailingDirSeparator(&fullName);
JString path, name;
JSplitPathAndName(fullName, &path, &name);
const JCharacter* map[] =
{
kFileVarName, fullName,
kPathVarName, path
};
JString s = itsShowFileLocationCmd;
if (!s.Contains("$"))
{
s += " '$";
s += kFileVarName;
s += "'";
}
(JGetStringManager())->Replace(&s, map, sizeof(map));
JSimpleProcess::Create(s, kJTrue);
}
}
示例7: output
void
JUpdateCVSIgnore
(
const JCharacter* ignoreFullName
)
{
JString path, name;
JSplitPathAndName(ignoreFullName, &path, &name);
const JString cvsFile = JCombinePathAndName(path, ".cvsignore");
if (!JFileExists(cvsFile) && JGetVCSType(path) != kJCVSType)
{
return;
}
JString cvsData;
JReadFile(cvsFile, &cvsData);
if (!cvsData.IsEmpty() && !cvsData.EndsWith("\n"))
{
cvsData += "\n";
}
name += "\n";
if (!cvsData.Contains(name))
{
JEditVCS(cvsFile);
cvsData += name;
ofstream output(cvsFile);
cvsData.Print(output);
}
}
示例8: indexStr
JString
CMLink::Build1DArrayExpressionForCFamilyLanguage
(
const JCharacter* origExpr,
const JInteger index
)
{
JString expr = origExpr;
const JString indexStr(index, 0); // must use floating point conversion
if (expr.Contains("$i"))
{
const JCharacter* map[] =
{
"i", indexStr.GetCString()
};
(JGetStringManager())->Replace(&expr, map, sizeof(map));
}
else
{
if (expr.GetFirstCharacter() != '(' ||
expr.GetLastCharacter() != ')')
{
expr.PrependCharacter('(');
expr.AppendCharacter(')');
}
expr.AppendCharacter('[');
expr += indexStr;
expr.AppendCharacter(']');
}
return expr;
}
示例9: JReadUntil
JBoolean
GAddressBookMgr::GetNextRecord
(
JString& line,
JString& record,
std::istream& is
)
{
if (line.IsEmpty())
{
return kJFalse;
}
JIndex index;
if (line.LocateSubstring("\t", &index))
{
if (index > 1)
{
record = line.GetSubstring(1, index - 1);
line.RemoveSubstring(1, index);
return kJTrue;
}
line.RemoveSubstring(1, 1);
return kJFalse;
}
record = line;
if (record.Contains("(") && !record.Contains(")"))
{
JString temp = JReadUntil(is, ')');
record += temp + ")";
line = JReadLine(is);
if (!line.IsEmpty() && (line.GetFirstCharacter() == '\t'))
{
line.RemoveSubstring(1, 1);
}
}
else
{
line.Clear();
}
return kJTrue;
}
示例10: iStr
JString
CMLink::Build2DArrayExpressionForCFamilyLanguage
(
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)
{
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;
}
示例11: JExecute
void
CBApp::GetSystemIncludeDirectories()
{
int pid, fd, inFD;
const JError err = JExecute("gcc -Wp,-v -x c++ -fsyntax-only -", &pid,
kJCreatePipe, &inFD,
kJCreatePipe, &fd,
kJAttachToFromFD);
if (!err.OK())
{
for (const JCharacter* s : kSysIncludeDir)
{
itsSystemIncludeDirs->Append(s);
}
return;
}
close(inFD);
JString s;
while (1)
{
s = JReadUntil(fd, '\n');
if (s.IsEmpty())
{
break;
}
if (s.GetFirstCharacter() == ' ')
{
s.RemoveSubstring(1,1);
if (!s.Contains(" "))
{
itsSystemIncludeDirs->Append(s);
}
}
}
}
示例12: 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;
}
示例13:
JBoolean
CBSymbolList::InContext
(
const JString& fullName,
const JPtrArray<JString>& contextNamespace,
const JBoolean caseSensitive
)
const
{
const JSize count = contextNamespace.GetElementCount();
for (JIndex i=1; i<=count; i+=2)
{
const JString* cns1 = contextNamespace.NthElement(i);
const JString* cns2 = contextNamespace.NthElement(i+1);
if (fullName.BeginsWith(*cns1, caseSensitive) ||
fullName.Contains(*cns2, caseSensitive))
{
return kJTrue;
}
}
return kJFalse;
}
示例14: 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;
}
示例15: is
void
GFGLink::ParseInterface
(
GFGMemberFunction* fn,
const JIndex line
)
{
std::ifstream is(itsCurrentFile);
if (!is.good())
{
return;
}
// skip to the function's line
JString str;
for (JIndex i = 1; i < line; i++)
{
str = JReadLine(is);
}
JSize p1 = JTellg(is);
is >> std::ws;
str = JReadUntilws(is);
if (str != "virtual")
{
return;
}
is >> std::ws;
// return type
str = JReadUntilws(is);
if (str == "const")
{
str += " " + JReadUntilws(is);
}
fn->SetReturnType(str);
is >> std::ws;
// this should be the function name
str = JReadUntil(is, '(');
str.TrimWhitespace();
if (str != fn->GetFnName())
{
return;
}
// get arguments
JCharacter delim = ',';
while (delim == ',')
{
JBoolean ok = JReadUntil(is, 2, ",)", &str, &delim);
if (!ok)
{
return;
}
JIndex findex;
if (str.LocateSubstring("//", &findex))
{
JIndex eindex;
if (str.LocateSubstring("\n", &eindex) &&
eindex >= findex)
{
str.RemoveSubstring(findex, eindex);
}
}
str.TrimWhitespace();
if (!str.IsEmpty())
{
fn->AddArg(str);
}
}
is >> std::ws;
// is it const;
str = JReadUntil(is, ';');
if (str.Contains("const"))
{
fn->ShouldBeConst(kJTrue);
}
JSize p2 = JTellg(is);
JSeekg(is, p1);
str = JRead(is, p2 - p1);
fn->SetInterface(str);
}