本文整理汇总了C++中JString::EndsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ JString::EndsWith方法的具体用法?C++ JString::EndsWith怎么用?C++ JString::EndsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JString
的用法示例。
在下文中一共展示了JString::EndsWith方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
JString
JVMVarNode::GetFullName
(
JBoolean* isPointer
)
const
{
JString str;
if (IsRoot())
{
return str;
}
const JVMVarNode* parent = dynamic_cast<const JVMVarNode*>(GetVarParent());
const JString& name = GetName();
if (parent->IsRoot())
{
str = "(" + name + ")";
}
else if (name.IsEmpty())
{
JIndex i;
const JBoolean found = parent->FindChild(this, &i);
assert( found );
str = parent->GetFullName(isPointer);
if (!str.BeginsWith("(") || !str.EndsWith(")"))
{
str.PrependCharacter('(');
str.AppendCharacter(')');
}
str += "[" + JString(i-1, JString::kBase10) + "]";
}
else if (name.BeginsWith("<"))
{
if (isPointer != NULL)
{
*isPointer = parent->IsPointer();
}
str = parent->GetFullName(isPointer);
}
else if (name.BeginsWith("["))
{
str = parent->GetFullName(isPointer) + name;
}
else if (name.BeginsWith("*"))
{
str = parent->GetPath() + "(" + name + ")";
}
else
{
str = name;
if (str.BeginsWith("static "))
{
str.RemoveSubstring(1,7);
}
str.Prepend(parent->GetPath());
}
return str;
}
示例2: 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);
}
}
示例3: if
JBoolean
JFSBinding::Match
(
const JString& fileName,
const JString& content
)
const
{
if (itsCmd.IsEmpty())
{
return kJFalse;
}
else if (itsContentRegex != NULL)
{
return JI2B(content.BeginsWith(itsLiteralPrefix) &&
itsContentRegex->Match(content));
}
else if (itsNameRegex != NULL)
{
return itsNameRegex->Match(fileName);
}
else
{
return JI2B(!itsPattern.IsEmpty() &&
fileName.EndsWith(itsPattern, kJFalse));
}
}
示例4: is
JBoolean
GMMIMEParser::GetTextSegment
(
const JIndex index,
JString* text,
TextFormat* format,
JString* charset
)
{
assert(itsTextInfo != NULL);
assert(index <= itsTextInfo->GetEntryCount());
JString name = itsTextInfo->GetEntry(index).GetFullName();
std::ifstream is(name);
if (is.good())
{
JReadAll(is, text);
if (name.EndsWith(kPlainType))
{
*format = kPlain;
}
else if (name.EndsWith(kHTMLType))
{
*format = kHTML;
}
JIndex findex;
JBoolean ok = name.LocateLastSubstring(".", &findex);
assert(ok);
name.RemoveSubstring(findex, name.GetLength());
ok = name.LocateLastSubstring(".", &findex);
if (findex < name.GetLength())
{
*charset = name.GetSubstring(findex + 1, name.GetLength());
}
}
else
{
itsIsSuccessful = kJFalse;
}
return itsIsSuccessful;
}
示例5:
inline JBoolean
JXFontManager::IsUseless
(
const JString& name
)
const
{
return JI2B(name.Contains("Dingbats") ||
name.Contains("Standard Symbols") ||
name.Contains("Cursor") ||
name.EndsWith(" Ti"));
}
示例6: GetText
JString
JXFileInput::GetTextForChooseFile()
const
{
JString text = GetText();
if (text.IsEmpty() && HasBasePath())
{
text = itsBasePath;
JAppendDirSeparator(&text);
}
if (text.EndsWith(ACE_DIRECTORY_SEPARATOR_STR))
{
text.AppendCharacter('*');
}
if (!text.IsEmpty() && JIsRelativePath(text) && HasBasePath())
{
text = JCombinePathAndName(itsBasePath, text);
}
return text;
}
示例7: if
JBoolean
JXPathInput::Complete
(
JXInputField* te,
const JCharacter* basePath, // can be NULL
JDirInfo* completer,
JXStringCompletionMenu** menu // constructed if NULL
)
{
// only complete if caret is at end of text
JIndex caretIndex;
if (!te->GetCaretLocation(&caretIndex) ||
caretIndex != te->GetTextLength()+1)
{
return kJFalse;
}
// catch empty path
if (te->IsEmpty())
{
const JString path = JGetRootDirectory();
te->Paste(path);
return kJTrue;
}
// convert to absolute path
JString fullName;
if (!JExpandHomeDirShortcut(te->GetText(), &fullName))
{
return kJFalse;
}
if (JIsRelativePath(fullName))
{
if (JStringEmpty(basePath))
{
return kJFalse;
}
fullName = JCombinePathAndName(basePath, fullName);
}
// if completing ~ rather than ~/
if (fullName.EndsWith(ACE_DIRECTORY_SEPARATOR_STR) &&
!(te->GetText()).EndsWith(ACE_DIRECTORY_SEPARATOR_STR))
{
JStripTrailingDirSeparator(&fullName);
}
// get path and wildcard filter
JString path, name;
if (fullName.EndsWith(ACE_DIRECTORY_SEPARATOR_STR))
{
path = fullName;
name = "*";
}
else
{
JSplitPathAndName(fullName, &path, &name);
name.AppendCharacter('*');
}
// build completion list
if (!(completer->GoTo(path)).OK())
{
return kJFalse;
}
completer->SetWildcardFilter(name, kJFalse, kJTrue);
if (completer->IsEmpty())
{
return kJFalse;
}
// check for characters common to all matches
JString maxPrefix = jGetFullName(completer, 1);
const JSize matchCount = completer->GetEntryCount();
JString entryName;
for (JIndex i=2; i<=matchCount; i++)
{
entryName = jGetFullName(completer, i);
const JSize matchLength = JCalcMatchLength(maxPrefix, entryName);
const JSize prefixLength = maxPrefix.GetLength();
if (matchLength < prefixLength)
{
maxPrefix.RemoveSubstring(matchLength+1, prefixLength);
}
}
// use the completion list
if (matchCount > 0 &&
maxPrefix.GetLength() > fullName.GetLength())
{
//.........这里部分代码省略.........
示例8: if
void
GetOptions
(
const JSize argc,
char* argv[],
JPtrArray<JString>* inputFileList,
JString* dataVarName,
JString* outputFileName,
JString* databaseFileName,
JBoolean* debug
)
{
inputFileList->CleanOut();
dataVarName->Clear();
outputFileName->Clear();
databaseFileName->Clear();
*debug = kJFalse;
JIndex index = 1;
while (index < argc)
{
if (JIsVersionRequest(argv[index]))
{
PrintVersion();
exit(0);
}
else if (JIsHelpRequest(argv[index]))
{
PrintHelp();
exit(0);
}
else if (strcmp(argv[index], "--code") == 0)
{
JCheckForValues(2, &index, argc, argv);
*dataVarName = argv[index];
*outputFileName = argv[index+1];
index++;
}
else if (strcmp(argv[index], "--db") == 0)
{
JCheckForValues(1, &index, argc, argv);
*databaseFileName = argv[index];
}
else if (strcmp(argv[index], "--debug") == 0)
{
*debug = kJTrue;
}
else if (argv[index][0] == '-')
{
cerr << argv[0] << ": unknown command line option: " << argv[index] << endl;
}
else
{
JString* inputFileName = new JString(argv[index]);
assert( inputFileName != NULL );
if (inputFileName->EndsWith("~") ||
inputFileName->BeginsWith("#"))
{
delete inputFileName;
}
else
{
inputFileList->Append(inputFileName);
}
}
index++;
}
if (inputFileList->IsEmpty())
{
cerr << argv[0] << ": no input files" << endl;
exit(1);
}
}