本文整理汇总了C++中StringBuffer::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuffer::remove方法的具体用法?C++ StringBuffer::remove怎么用?C++ StringBuffer::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuffer
的用法示例。
在下文中一共展示了StringBuffer::remove方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: leadHQHandle
void leadHQHandle(void) {
int rsize;
unsigned short index[32]; // <10 keypairs in the incoming json
// only continue if new data to read
if (!Scout.wifi.client.available()) {
return;
}
// Read a block of data and look for packets
while ((rsize = hqIncoming.readClient(Scout.wifi.client, 128))) {
int nl;
while((nl = hqIncoming.indexOf('\n')) >= 0) {
// look for a packet
if (hqVerboseOutput) {
Serial.print(F("looking for packet in: "));
Serial.println(hqIncoming);
}
// Parse JSON up to the first newline
if (!js0n((const unsigned char*)hqIncoming.c_str(), nl, index, 32)) {
leadIncoming(hqIncoming.c_str(), nl, index);
} else {
if (hqVerboseOutput) {
Serial.println(F("JSON parse failed"));
}
}
// Remove up to and including the newline
hqIncoming.remove(0, nl + 1);
}
}
}
示例2: getInstallPath
//---------------------------------------------------------------------------
// getInstallPath
//---------------------------------------------------------------------------
bool CDaliDeploymentEngine::getInstallPath(const char *filename, StringBuffer& installPath)
{
//BUG: 9254 - Deploy Wizard's "compare" for Dali looks in wrong folder
//If filename is in deploy folder then compare file in folder above it.
//
StringBuffer machine;
StringBuffer path;
StringBuffer tail;
StringBuffer ext;
bool rc;
splitUNCFilename(filename, &machine, &path, &tail, &ext);
const char* pszPath = path.str();
const char* pattern = "deploy\\";
const unsigned int patternLen = sizeof("deploy\\") - 1;
const char* match = strstr(pszPath, pattern);
if (match && strlen(match)==patternLen)//path ends with "deploy\\"
{
path.remove(match-pszPath, patternLen);
installPath.append(machine).append(path).append(tail).append(ext);
rc = true;
}
else
{
installPath.append(filename);
rc = false;
}
return rc;
}
示例3: getPluginDirectory
//---------------------------------------------------------------------------
// getPluginDirectory
//
// returns absolute path where plugins are to be deployed
//---------------------------------------------------------------------------
void CPluginDeploymentEngine::getPluginDirectory(const char* destPath, StringBuffer& sPluginDest) const
{
sPluginDest.clear().append(destPath);
sPluginDest.replace('\\', '/');
StringBuffer sPluginsDir; //relative path (from ECL server installation directory) for plugins
m_process.getProp("@pluginsPath", sPluginsDir);
if (sPluginsDir.length())
{
sPluginsDir.replace('\\', '/');
sPluginsDir.replace('$', ':');
if (! ::PathIsRelative(sPluginsDir.str()))
throw MakeStringExceptionDirect(-1, "Plugins path for ECL server must be relative to its installation directory!");
if (!strncmp(sPluginsDir.str(), "./", 2))
sPluginsDir.remove(0, 2);
sPluginDest.append(sPluginsDir);
}
const char* pchLast = sPluginDest.str() + sPluginDest.length() - 1;
if (*pchLast != '/')
sPluginDest.append('/');
}
示例4: createFakePlugins
void CConfigGenEngine::createFakePlugins(StringBuffer& destFilePath) const
{
String destFilePathStr(destFilePath);
String* tmpstr = destFilePathStr.toLowerCase();
if (!tmpstr->endsWith("plugins.xml"))
{
int index = tmpstr->indexOf("plugins.xml");
destFilePath.remove(index + 11, destFilePath.length() - (index + 11));
}
delete tmpstr;
StringBuffer tmpoutbuf("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Plugins/>");
if (m_instances.ordinality() > 1 && strcmp(m_process.queryName(), XML_TAG_ESPPROCESS))
destFilePath.replaceString("@temp"PATHSEPSTR, m_cachePath);
else
{
char tempPath[_MAX_PATH];
getTempPath(tempPath, sizeof(tempPath), m_name);
ensurePath(tempPath);
destFilePath.replaceString("@temp"PATHSEPSTR, tempPath);
}
Owned<IFile> pTargetFile = createIFile(destFilePath.str());
if (pTargetFile->exists() && pTargetFile->isReadOnly())
pTargetFile->setReadOnly(false);
Owned<IFileIO> pTargetFileIO = pTargetFile->open(IFOcreate);
pTargetFileIO->write( 0, tmpoutbuf.length(), tmpoutbuf.str());
m_envDepEngine.addTempFile(destFilePath.str());
}
示例5: leadHQHandle
void leadHQHandle(void) {
int rsize = 0;
int nl;
unsigned short index[32]; // <10 keypairs in the incoming json
if(Scout.handler.isBridged)
{
rsize = (int)Scout.handler.bridge.length();
hqIncoming += Scout.handler.bridge;
Scout.handler.bridge = "";
} else if (WifiModule::instance.bp()) {
if (WifiModule::instance.bp()->client.available()) {
rsize = hqIncoming.readClient(WifiModule::instance.bp()->client, 128);
if(rsize > 0) Scout.handler.seen = SleepHandler::uptime().seconds;
}
}
// only continue if new data to process
if(rsize <= 0) return;
// Read a block of data and look for packets
while((nl = hqIncoming.indexOf('\n')) >= 0) {
// look for a packet
if(nl)
{
if (Scout.handler.isVerbose) {
Serial.print(F("looking for packet in: "));
Serial.println(hqIncoming);
}
// Parse JSON up to the first newline
if (!js0n((const unsigned char*)hqIncoming.c_str(), nl, index, 32)) {
leadIncoming(hqIncoming.c_str(), nl, index);
} else {
if (Scout.handler.isVerbose) {
Serial.println(F("JSON parse failed"));
}
}
}else{
if (Scout.handler.isVerbose) {
Serial.println(F("HQ ack'd"));
}
}
// Remove up to and including the newline
hqIncoming.remove(0, nl + 1);
}
}
示例6: readLogFilters
bool CLogContentFilter::readLogFilters(IPropertyTree* cfg, unsigned groupID)
{
Owned<CESPLogContentGroupFilters> espLogContentGroupFilters = new CESPLogContentGroupFilters((ESPLogContentGroup) groupID);
StringBuffer xpath;
if (groupID != ESPLCGAll)
xpath.appendf("Filters/Filter[@type='%s']", espLogContentGroupNames[groupID]);
else
xpath.append("Filters/Filter");
Owned<IPropertyTreeIterator> filters = cfg->getElements(xpath.str());
ForEach(*filters)
{
IPropertyTree &filter = filters->query();
StringBuffer value = filter.queryProp("@value");
if (!value.length())
continue;
//clean "//"
unsigned idx = value.length()-1;
while (idx)
{
if ((value.charAt(idx-1) == '/') && (value.charAt(idx) == '/'))
value.remove(idx, 1);
idx--;
}
//clean "/*" at the end
while ((value.length() > 1) && (value.charAt(value.length()-2) == '/') && (value.charAt(value.length()-1) == '*'))
value.setLength(value.length() - 2);
if (value.length() && !streq(value.str(), "*") && !streq(value.str(), "/") && !streq(value.str(), "*/"))
{
espLogContentGroupFilters->addFilter(value.str());
}
else
{
espLogContentGroupFilters->clearFilters();
break;
}
}
bool hasFilter = espLogContentGroupFilters->getFilterCount() > 0;
if (hasFilter)
groupFilters.append(*espLogContentGroupFilters.getClear());
return hasFilter;
}