本文整理汇总了C++中StringBuffer::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuffer::isEmpty方法的具体用法?C++ StringBuffer::isEmpty怎么用?C++ StringBuffer::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuffer
的用法示例。
在下文中一共展示了StringBuffer::isEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTransactionID
bool CLoggingManager::getTransactionID(StringAttrMapping* transFields, StringBuffer& transactionID, StringBuffer& status)
{
if (!initialized)
throw MakeStringException(-1,"LoggingManager not initialized");
try
{
for (unsigned int x = 0; x < loggingAgentThreads.size(); x++)
{
IUpdateLogThread* loggingThread = loggingAgentThreads[x];
if (!loggingThread->hasService(LGSTGetTransactionID))
continue;
IEspLogAgent* loggingAgent = loggingThread->getLogAgent();
loggingAgent->getTransactionID(transFields, transactionID);
if (!transactionID.isEmpty())
ESPLOG(LogMax, "Got TransactionID '%s'", transactionID.str());
return true;
}
}
catch (IException* e)
{
e->errorMessage(status);
e->Release();
}
return false;
}
示例2: init
void CWSESPControlEx::init(IPropertyTree *cfg, const char *process, const char *service)
{
if(cfg == NULL)
throw MakeStringException(-1, "Can't initialize CWSESPControlEx, cfg is NULL");
espProcess.set(process);
VStringBuffer xpath("Software/EspProcess[@name=\"%s\"]", process);
IPropertyTree* espCFG = cfg->queryPropTree(xpath.str());
if (!espCFG)
throw MakeStringException(-1, "Can't find EspBinding for %s", process);
Owned<IPropertyTreeIterator> it = espCFG->getElements("AuthDomains/AuthDomain");
ForEach(*it)
{
IPropertyTree& authDomain = it->query();
StringBuffer name = authDomain.queryProp("@domainName");
if (name.isEmpty())
name.set("default");
sessionTimeoutMinutesMap.setValue(name.str(), authDomain.getPropInt("@sessionTimeoutMinutes", 0));
}
}
示例3: buf
*/
#include "catch/catch.hpp"
#include "../str.h"
#include "../strbuf.h"
using namespace herschel;
TEST_CASE("StringBuffer basic", "[string][string-buffer]")
{
StringBuffer buf("hello world");
REQUIRE(buf.toString() == String("hello world"));
REQUIRE(buf.length() == 11);
REQUIRE(!buf.isEmpty());
}
TEST_CASE("StringBuffer compare", "[string][string-buffer]")
{
StringBuffer buf2(String("hello world"));
REQUIRE(buf2.toString() == String("hello world"));
StringBuffer buf3(buf2);
REQUIRE(buf3.toString() == String("hello world"));
}
TEST_CASE("StringBuffer append string", "[string][string-buffer]")
{
示例4: createUpdateTask
void CEnvGen::createUpdateTask(const char* action, IPropertyTree * config, const char* param)
{
if (!param || !(*param)) return;
if (m_showInputOnly)
{
printf("Input as one line format: -%s %s\n", (m_actionAbbrMap.at(action)).c_str(), param);
}
StringArray items;
items.appendList(param, ":");
if (items.ordinality() < 2)
{
throw MakeStringException(CfgEnvErrorCode::InvalidParams,
"Incorrect input format. At least two item expected: category:component.\n See usage for deail.");
}
IPropertyTree * updateTree = createPTree("Task");
config->addPropTree("Task", updateTree);
updateTree->addProp("@operation", action);
updateTree->addProp("@category", (m_envCategoryMap.at(items.item(0))).c_str());
//have key and attributes
StringArray compAndAttrs;
compAndAttrs.appendList(items.item(1), "@");
StringArray compAndTarget;
compAndTarget.appendList(compAndAttrs[0], "%");
if (!stricmp(action, "remove") && compAndTarget.ordinality() > 1 )
{
if (*(compAndTarget.item(1))) updateTree->addProp("@target", compAndTarget.item(1));
}
StringArray compAndKey;
compAndKey.appendList(compAndTarget.item(0), "#");
updateTree->addProp("@component", compAndKey.item(0));
if (compAndKey.ordinality() > 1)
{
StringArray keyAndClone;
keyAndClone.appendList(compAndKey.item(1), ATTR_V_SEP);
updateTree->addProp("@key", keyAndClone.item(0));
if (keyAndClone.ordinality() > 1)
updateTree->addProp("@clone", keyAndClone.item(1));
}
if (compAndAttrs.ordinality() > 1)
{
addUpdateAttributesFromString(updateTree, compAndAttrs.item(1));
return;
}
if (items.ordinality() == 2)
return;
int index = 2;
// selector
StringArray selectorAndAttrs;
selectorAndAttrs.appendList(items.item(index), "@");
StringArray selectorParts;
selectorParts.appendList(selectorAndAttrs.item(0), "/");
StringBuffer sbSelector;
for ( unsigned i = 0; i < selectorParts.ordinality()-1 ; i++)
{
if (!sbSelector.isEmpty())
sbSelector.append("/");
sbSelector.append(selectorParts.item(i));
}
StringArray selectorAndKey;
selectorAndKey.appendList(selectorParts.item(selectorParts.ordinality()-1), "#");
if (!sbSelector.isEmpty())
sbSelector.append("/");
sbSelector.append(selectorAndKey.item(0));
sbSelector.replace('#', '@');
updateTree->addProp("@selector", sbSelector.str());
if (selectorAndKey.ordinality() > 1)
updateTree->addProp("@selector-key", selectorAndKey.item(1));
if (selectorAndAttrs.ordinality() > 1)
{
addUpdateAttributesFromString(updateTree, selectorAndAttrs.item(1));
}
index++;
if (items.ordinality() == index) return;
// children nodes
IPropertyTree *children = updateTree->addPropTree("Children", createPTree("Children"));
for ( unsigned i = index; i < items.ordinality() ; i++)
{
IPropertyTree *child = children->addPropTree("Child", createPTree("Child"));
StringArray nameAndAttrs;
nameAndAttrs.appendList(items.item(i), "@");
//.........这里部分代码省略.........