本文整理汇总了C++中JString::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ JString::IsEmpty方法的具体用法?C++ JString::IsEmpty怎么用?C++ JString::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JString
的用法示例。
在下文中一共展示了JString::IsEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
JBoolean
JDirInfo::BuildRegexFromWildcardFilter
(
const JCharacter* origFilterStr,
JString* regexStr
)
{
regexStr->Clear();
JString filterStr = origFilterStr;
filterStr.TrimWhitespace();
if (filterStr.IsEmpty())
{
return kJFalse;
}
JIndex index;
while (filterStr.LocateSubstring(" ", &index))
{
assert( index > 1 );
const JString str = filterStr.GetSubstring(1, index-1);
AppendRegex(str, regexStr);
filterStr.RemoveSubstring(1, index);
filterStr.TrimWhitespace();
}
assert( !filterStr.IsEmpty() );
AppendRegex(filterStr, regexStr);
return kJTrue;
}
示例2: if
JFontStyle
CBHTMLStyler::GetTagStyle
(
const JIndexRange& tokenRange,
const JIndex typeIndex
)
{
const JString& text = GetText();
JFontStyle style;
JArray<JIndexRange> matchList;
if (tagNamePattern.MatchWithin(text, tokenRange, &matchList))
{
itsLatestTagName = text.GetSubstring(matchList.GetElement(2));
itsLatestTagName.ToLower();
JString openTag;
if (itsLatestTagName.GetFirstCharacter() == '/' &&
itsLatestTagName.GetLength() > 1)
{
openTag = itsLatestTagName.GetSubstring(2, itsLatestTagName.GetLength());
}
JBoolean found = GetWordStyle(itsLatestTagName, &style);
if (!found && !openTag.IsEmpty())
{
found = GetWordStyle(openTag, &style);
}
if (!found)
{
found = GetXMLStyle(itsLatestTagName, &style);
}
if (!found && !openTag.IsEmpty())
{
found = GetXMLStyle(openTag, &style);
}
if (!found)
{
style = GetTypeStyle(typeIndex);
}
}
else if (text.GetCharacter(tokenRange.first) == '<')
{
itsLatestTagName.Clear();
style = GetTypeStyle(typeIndex);
}
else
{
style = GetStyle(typeIndex, itsLatestTagName);
}
return style;
}
示例3: if
JString
JXPathInput::GetTextForChoosePath()
const
{
JString text = GetText();
if (text.IsEmpty() && HasBasePath())
{
text = itsBasePath;
}
else if (!text.IsEmpty() && JIsRelativePath(text) && HasBasePath())
{
text = JCombinePathAndName(itsBasePath, text);
}
return text;
}
示例4: os
void
GMMIMEParser::WriteAttachment
(
const JString& data,
const GMIMEHeader& header
)
{
JString filename = header.GetFileName();
if (filename.IsEmpty())
{
const JError err = JCreateTempFile(itsAttachDir, NULL, &filename);
if (!err.OK())
{
err.ReportIfError();
return;
}
}
else
{
filename = JCombinePathAndName(itsAttachDir, filename);
}
AdjustAttachmentName(header, &filename);
std::ofstream os(filename);
if (header.GetEncoding() == kBase64Encoding)
{
std::istrstream is(data.GetCString(), data.GetLength());
JDecodeBase64(is, os);
}
else
{
data.Print(os);
}
}
示例5: GetTitleText
void
JXTextMenu::AdjustPopupChoiceTitle
(
const JIndex index
)
{
const JString& origTitle = GetTitleText();
if (origTitle.IsEmpty())
{
return;
}
JString newTitle;
JIndex colonIndex;
const JBoolean foundColon = origTitle.LocateSubstring(":", &colonIndex);
if (foundColon && colonIndex > 1)
{
newTitle = origTitle.GetSubstring(1, colonIndex-1);
}
// not empty but no colon => title was empty originally, so replace it
if (!newTitle.IsEmpty())
{
newTitle += ": ";
}
newTitle += GetItemText(index);
const JXImage* image = NULL;
GetItemImage(index, &image);
SetTitle(newTitle, const_cast<JXImage*>(image), kJFalse);
}
示例6: dataStream
JString
GPrefsMgr::GetSMTPUser()
{
if (IDValid(kSMTPUserID))
{
std::string data;
const JBoolean ok = GetData(kSMTPUserID, &data);
assert( ok );
std::istringstream dataStream(data);
JString user;
dataStream >> user;
if (!user.IsEmpty())
{
return user;
}
}
JCharacter* name = getenv("LOGNAME");
if (name == NULL)
{
return JString();
}
return JString(name);
}
示例7:
void
CBSymbolList::PrepareContextNamespace
(
const JString& contextNamespace,
const CBLanguage lang,
JString* ns1,
JString* ns2
)
const
{
if (!contextNamespace.IsEmpty() &&
(lang == kCBJavaLang ||
lang == kCBJavaScriptLang ||
lang == kCBEiffelLang ||
lang == kCBCSharpLang))
{
*ns1 = contextNamespace; // name.
*ns1 += ".";
*ns2 = *ns1; // .name.
ns2->Prepend(".");
}
else
{
ns1->Clear();
ns2->Clear();
}
}
示例8: os
JBoolean
GMApp::NewMailbox
(
const JCharacter* filename,
const JBoolean openFile
)
{
JString path;
JString name;
JSplitPathAndName(filename, &path, &name);
if (path.IsEmpty())
{
path = JGetCurrentDirectory();
}
if (!(JDirectoryExists(path) && JDirectoryReadable(path)))
{
JString notice = "You do not have write permissions in directory \"" + path + "\"";
JGetUserNotification()->ReportError(notice);
return kJFalse;
}
ofstream os(filename);
if (!os.good())
{
JString notice = "Unable to create file \"" + path + name + "\"";
JGetUserNotification()->ReportError(notice);
return kJFalse;
}
os.close();
if (openFile)
{
OpenMailbox(filename);
}
return kJTrue;
}
示例9: AdjustStylesBeforeRecalc
void
CBCommandPathInput::AdjustStylesBeforeRecalc
(
const JString& buffer,
JRunArray<JFont>* styles,
JIndexRange* recalcRange,
JIndexRange* redrawRange,
const JBoolean deletion
)
{
if (!buffer.IsEmpty() && buffer.GetFirstCharacter() == '@')
{
const JColormap* colormap = GetColormap();
const JSize totalLength = buffer.GetLength();
JFont f = styles->GetFirstElement();
styles->RemoveAll();
f.SetColor(colormap->GetBlackColor());
styles->AppendElements(f, totalLength);
*redrawRange += JIndexRange(1, totalLength);
}
else
{
return JXPathInput::AdjustStylesBeforeRecalc(buffer, styles, recalcRange,
redrawRange, deletion);
}
}
示例10: JGetString
void
CBCommand::ReportInfiniteLoop
(
const CBFunctionStack& fnStack,
const JIndex startIndex
)
{
const JSize cmdCount = fnStack.GetElementCount();
JString loop;
for (JIndex i=startIndex; i>=1; i--)
{
if (!loop.IsEmpty())
{
loop += " -> ";
}
loop += fnStack.Peek(i);
}
loop += " -> ";
loop += fnStack.Peek(startIndex);
const JCharacter* map[] =
{
"loop", loop.GetCString()
};
const JString msg = JGetString("InfiniteLoop::CBCommand", map, sizeof(map));
(JGetUserNotification())->ReportError(msg);
}
示例11: 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);
}
}
示例12: SymcirApp
int
main
(
int argc,
char* argv[]
)
{
ParseTextOptions(argc, argv);
SymcirApp* app = new SymcirApp(&argc, argv);
assert( app != NULL );
JString inputFileName;
ParseXOptions(argc, argv, &inputFileName);
if (!inputFileName.IsEmpty() ||
(JGetChooseSaveFile())->ChooseFile("Netlist to analyze:", NULL, &inputFileName))
{
SCCircuitDocument* mainDir = new SCCircuitDocument(app, inputFileName);
assert( mainDir != NULL );
mainDir->Activate();
app->Run();
}
return 0;
}
示例13: if
void
GLPolyFitDialog::Receive
(
JBroadcaster* sender,
const Message& message
)
{
if (sender == itsHelpButton && message.Is(JXButton::kPushed))
{
}
else if (message.Is(JXCheckbox::kPushed))
{
JString fStr;
JBoolean started = kJFalse;
const JSize count = 10;
for (JIndex i = 1; i <= count; i++)
{
if (itsCB[i-1]->IsChecked())
{
if (started)
{
fStr += " + ";
}
else
{
started = kJTrue;
}
JString parm = "a" + JString(i - 1, JString::kBase10);
JString xTerm = " * x";
if (i > 2)
{
xTerm += "^" + JString(i - 1, JString::kBase10);
}
fStr += parm;
if (i > 1)
{
fStr += xTerm;
}
}
}
if (fStr.IsEmpty())
{
itsFn->Hide();
}
else
{
itsFn->Show();
JFunction* f;
if (JParseFunction(fStr, itsVarList, &f))
{
itsFn->SetFunction(itsVarList, f);
}
}
}
else
{
JXDialogDirector::Receive(sender, message);
}
}
示例14:
JBoolean
GAddressBookMgr::NameIsAlias
(
const JCharacter* name,
JString& alias,
JString& fcc
)
{
GAddressBookEntry* entry;
if (!itsAddresses->GetElement(name, &entry))
{
return kJFalse;
}
alias = entry->address;
if (alias.IsEmpty())
{
return kJFalse;
}
if (alias.GetFirstCharacter() == '(' &&
alias.GetLastCharacter() == ')')
{
if (entry->address.GetLength() > 2)
{
alias = entry->address.GetSubstring(2, entry->address.GetLength() - 1);
}
}
fcc = entry->fcc;
if (!fcc.IsEmpty() &&
fcc.GetFirstCharacter() == '(' &&
fcc.GetLastCharacter() == ')')
{
if (entry->fcc.GetLength() > 2)
{
fcc = entry->fcc.GetSubstring(2, entry->fcc.GetLength() - 1);
}
}
return kJTrue;
}
示例15: 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;
}