本文整理汇总了C++中AutoStr2::append方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoStr2::append方法的具体用法?C++ AutoStr2::append怎么用?C++ AutoStr2::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoStr2
的用法示例。
在下文中一共展示了AutoStr2::append方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: appendModuleParam
void plainconf::appendModuleParam(XmlNode *pModuleNode, const char *param)
{
XmlNode *pParamNode = pModuleNode->getChild("param");
if (pParamNode == NULL)
{
pParamNode = new XmlNode;
const char *attr = NULL;
pParamNode->init("param", &attr);
pParamNode->setValue(param, strlen(param));
pModuleNode->addChild(pParamNode->getName(), pParamNode);
}
else
{
AutoStr2 totalValue = pParamNode->getValue();
totalValue.append("\n", 1);
totalValue.append(param, strlen(param));
pParamNode->setValue(totalValue.c_str(), totalValue.len());
}
logToMem(LOG_LEVEL_INFO, "[%s:%s] module [%s] add param [%s]",
pModuleNode->getParent()->getName(),
((pModuleNode->getParent()->getValue()) ?
pModuleNode->getParent()->getValue() : ""),
pModuleNode->getValue(), param);
}
示例2:
static inline LsShmHash *LsLuaShmOpen(const char *name)
{
AutoStr2 *pName;
LsShmHash *pRet;
LsShm *pShm = LsShm::open(name, 0, NULL);
if (pShm == NULL)
return NULL;
LsShmPool *pPool = pShm->getGlobalPool();
if (pPool == NULL)
return NULL;
pName = new AutoStr2(name);
pName->append("hash", 4);
pRet = pPool->getNamedHash(pName->c_str(), LSSHM_HASHINITSIZE,
LsShmHash::hashString, LsShmHash::compString,
LSSHM_FLAG_NONE);
delete pName;
return pRet;
}
示例3: checkInFile
//When checking we use lock for may need to update the conf file later
//If user RCS checkout a revision, a unlock should be used for next time checkin.
//Example: co -u1.1 httpd_config.conf
void plainconf::checkInFile(const char *path)
{
if (access(path, 0) == -1)
return ;
//Backup file abd checkin and out
char new_path[4096];
strcpy(new_path, path);
strcat(new_path, "0");
AutoStr2 buf;
buf.setStr("cp \"");
buf.append(path, strlen(path));
buf.append("\" \"", 3);
buf.append(new_path, strlen(new_path));
buf.append("\"", 1);
int ret = system(buf.c_str());
if (ret != 0)
{
logToMem(LOG_LEVEL_INFO, "Failed to backup the conf file %s, ret %d.",
path, ret);
return ;
}
buf.setStr("ci -l -q -t-\"");
buf.append(new_path, strlen(new_path));
buf.append("\" -mUpdate \"", 12);
buf.append(new_path, strlen(new_path));
buf.append("\" >/dev/null 2>&1", 17);
ret = system(buf.c_str());
if (ret == 0)
logToMem(LOG_LEVEL_INFO, "RCS checkin config file %s OK.", new_path);
else
logToMem(LOG_LEVEL_INFO,
"Failed to RCS checkin conf file %s, ret %d, error(%s). "
"Org command is %s.", new_path, ret, strerror(errno), buf.c_str());
unlink(new_path);
}
示例4: processHeaderLine
int HttpCgiTool::processHeaderLine(HttpExtConnector *pExtConn,
const char *pLineBegin,
const char *pLineEnd, int &status)
{
HttpRespHeaders::HEADERINDEX index;
int tmpIndex;
const char *pKeyEnd = NULL;
const char *pValue = pLineBegin;
char *p;
HttpResp *pResp = pExtConn->getHttpSession()->getResp();
HttpReq *pReq = pExtConn->getHttpSession()->getReq();
index = HttpRespHeaders::getRespHeaderIndex(pValue);
if (index < HttpRespHeaders::H_HEADER_END)
{
pValue += HttpRespHeaders::getHeaderStringLen(index);
while (isspace(*pValue))
++pValue;
pKeyEnd = pValue;
if (*pValue != ':')
index = HttpRespHeaders::H_HEADER_END;
else
{
do { ++pValue; }
while (isspace(*pValue));
}
}
if (index == HttpRespHeaders::H_HEADER_END)
{
pKeyEnd = (char *)memchr(pValue, ':', pLineEnd - pValue);
if (pKeyEnd != NULL)
{
pValue = pKeyEnd + 1;
while (isspace(*pValue))
++pValue;
}
else
{
if (!isspace(*pLineBegin))
return 0;
}
}
switch (index)
{
case HttpRespHeaders::H_CONTENT_TYPE:
if (pReq->getStatusCode() == SC_304)
return 0;
p = (char *)memchr(pValue, ';', pLineEnd - pValue);
if (pReq->gzipAcceptable() == GZIP_REQUIRED)
{
char ch = 0;
char *p1;
if (p)
p1 = (char *)p;
else
p1 = (char *)pLineEnd;
ch = *p1;
*p1 = 0;
if (!HttpMime::getMime()->compressible(pValue))
pReq->andGzip(~GZIP_ENABLED);
*p1 = ch;
}
if (pReq->isKeepAlive())
pReq->smartKeepAlive(pValue);
{
if (!HttpMime::needCharset(pValue))
break;
const AutoStr2 *pCharset = pReq->getDefaultCharset();
if (!pCharset)
break;
if (p)
{
while (isspace(*(++p)))
;
if (strncmp(p, "charset=", 8) == 0)
break;
}
HttpRespHeaders &buf = pResp->getRespHeaders();
AutoStr2 str = "";
str.append(pLineBegin, pLineEnd - pLineBegin);
str.append(pCharset->c_str(), pCharset->len());
str.append("\r\n", 2);
buf.parseAdd(str.c_str(), str.len(), LSI_HEADEROP_ADD);
}
return 0;
case HttpRespHeaders::H_CONTENT_ENCODING:
if (pReq->getStatusCode() == SC_304)
return 0;
if (strncasecmp(pValue, "gzip", 4) == 0)
pReq->orGzip(UPSTREAM_GZIP);
else if (strncasecmp(pValue, "deflate", 7) == 0)
pReq->orGzip(UPSTREAM_DEFLATE);
// if ( !(pReq->gzipAcceptable() & REQ_GZIP_ACCEPT) )
// return 0;
// }
// else //if ( strncasecmp( pValue, "deflate", 7 ) == 0 )
// {
// pReq->andGzip( ~GZIP_ENABLED );
// }
//.........这里部分代码省略.........