本文整理汇总了C++中StringStorage::replaceChar方法的典型用法代码示例。如果您正苦于以下问题:C++ StringStorage::replaceChar方法的具体用法?C++ StringStorage::replaceChar怎么用?C++ StringStorage::replaceChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringStorage
的用法示例。
在下文中一共展示了StringStorage::replaceChar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processRequest
void HttpRequestHandler::processRequest()
{
HttpRequest httpRequest(m_dataInput);
httpRequest.readHeader();
StringStorage request;
request.fromAnsiString(httpRequest.getRequest());
if (!httpRequest.parseHeader()) {
Log::warning(_T("invalid http request from %s"), m_peerHost.getString());
return ;
}
request.replaceChar(_T('\n'), _T(' '));
request.replaceChar(_T('\t'), _T(' '));
Log::message(_T("\"%s\" from %s"), request.getString(), m_peerHost.getString());
HttpReply reply(m_dataOutput);
bool pageFound = false;
if (strcmp(httpRequest.getFilename(), "/") == 0) {
CharString paramsString("\n");
bool isAppletArgsValid = true;
bool paramsInUrlIsEnabled = Configurator::getInstance()->getServerConfig()->isAppletParamInUrlEnabled();
if (httpRequest.hasArguments() && paramsInUrlIsEnabled) {
ArgList *args = httpRequest.getArguments();
for (size_t i = 0; i < args->getCount(); i++) {
const char *key = args->getKey(i);
AppletParameter parameter(key, args->getValue(key));
if (!parameter.isValid()) {
isAppletArgsValid = false;
break;
}
paramsString.format("%s%s", paramsString.getString(),
parameter.getFormattedString());
}
}
reply.send200();
if (!isAppletArgsValid) {
m_dataOutput->writeFully(HTTP_MSG_BADPARAMS, strlen(HTTP_MSG_BADPARAMS));
} else {
CharString page;
StringStorage computerName(_T("TightVNC Server"));
Environment::getComputerName(&computerName);
size_t computerNameANSILength = computerName.getLength() + 1;
char *computerNameANSI = new char[computerNameANSILength];
computerName.toAnsiString(computerNameANSI, computerNameANSILength);
page.format(HTTP_INDEX_PAGE_FORMAT,
computerNameANSI,
Configurator::getInstance()->getServerConfig()->getRfbPort(),
paramsString.getString());
delete[] computerNameANSI;
m_dataOutput->writeFully(page.getString(), page.getLength());
}
pageFound = true;
} else if ((strcmp(httpRequest.getFilename(), "/VncViewer.jar") == 0)) {
reply.send200();
m_dataOutput->writeFully(VNC_VIEWER_JAR_BODY, sizeof(VNC_VIEWER_JAR_BODY));
pageFound = true;
}
if (!pageFound) {
reply.send404();
}
}