本文整理汇总了C++中icompare函数的典型用法代码示例。如果您正苦于以下问题:C++ icompare函数的具体用法?C++ icompare怎么用?C++ icompare使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了icompare函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setTransferEncoding
void HTTPMessage::setTransferEncoding(const std::string& transferEncoding)
{
if (icompare(transferEncoding, IDENTITY_TRANSFER_ENCODING) == 0)
erase(TRANSFER_ENCODING);
else
set(TRANSFER_ENCODING, transferEncoding);
}
开发者ID:macchina-io,项目名称:macchina.io,代码行数:7,代码来源:HTTPMessage.cpp
示例2: icompare
int icompare(const std::string& str1, std::string::size_type pos1, std::string::size_type n, const std::string& str2, std::string::size_type pos2)
{
std::string::size_type sz2 = str2.size();
if (pos2 > sz2) pos2 = sz2;
if (pos2 + n > sz2) n = sz2 - pos2;
return icompare(str1, pos1, n, str2.begin() + pos2, str2.begin() + pos2 + n);
}
开发者ID:carvalhomb,项目名称:tsmells,代码行数:7,代码来源:String.cpp
示例3: icompare
int UTF8::icompare(const std::string& str1, std::string::size_type pos1, std::string::size_type n1, const std::string& str2, std::string::size_type pos2, std::string::size_type n2)
{
std::string::size_type sz2 = str2.size();
if (pos2 > sz2) pos2 = sz2;
if (pos2 + n2 > sz2) n2 = sz2 - pos2;
return icompare(str1, pos1, n1, str2.begin() + pos2, str2.begin() + pos2 + n2);
}
开发者ID:beneon,项目名称:MITK,代码行数:7,代码来源:UTF8String.cpp
示例4: while
void IniFileConfigurationNew::removeRaw(const std::string& key)
{
std::string prefix = key;
if (!prefix.empty()) prefix += '.';
std::string::size_type psize = prefix.size();
IStringMap::iterator it = _map.begin();
IStringMap::iterator itCur;
while (it != _map.end())
{
itCur = it++;
if ((icompare(itCur->first, key) == 0) || (icompare(itCur->first, psize, prefix) == 0))
{
_map.erase(itCur);
}
}
}
开发者ID:lx317190991,项目名称:linux-cloud,代码行数:16,代码来源:IniFileConfigurationNew.cpp
示例5: get
bool HTTPMessage::getKeepAlive() const
{
const std::string& connection = get(CONNECTION, EMPTY);
if (!connection.empty())
return icompare(connection, CONNECTION_CLOSE) != 0;
else
return getVersion() == HTTP_1_1;
}
开发者ID:12307,项目名称:poco,代码行数:8,代码来源:HTTPMessage.cpp
示例6: iEndsWith
bool iEndsWith(const std::string &str, const std::string &suffix) {
if (str.size() < suffix.size()) {
return false;
}
auto tstr = str.substr(str.size() - suffix.size());
return icompare(tstr, suffix) == 0;
}
开发者ID:davijo,项目名称:PotreeConverter,代码行数:10,代码来源:stuff.cpp
示例7: _version
HTTPCookie::HTTPCookie(const NameValueCollection& nvc):
_version(0),
_secure(false),
_maxAge(-1),
_httpOnly(false)
{
for (NameValueCollection::ConstIterator it = nvc.begin(); it != nvc.end(); ++it)
{
const std::string& name = it->first;
const std::string& value = it->second;
if (icompare(name, "comment") == 0)
{
setComment(value);
}
else if (icompare(name, "domain") == 0)
{
setDomain(value);
}
else if (icompare(name, "path") == 0)
{
setPath(value);
}
else if (icompare(name, "max-age") == 0)
{
setMaxAge(NumberParser::parse(value));
}
else if (icompare(name, "secure") == 0)
{
setSecure(true);
}
else if (icompare(name, "expires") == 0)
{
int tzd;
DateTime exp = DateTimeParser::parse(value, tzd);
Timestamp now;
setMaxAge((int) ((exp.timestamp() - now) / Timestamp::resolution()));
}
else if (icompare(name, "version") == 0)
{
setVersion(NumberParser::parse(value));
}
else if (icompare(name, "HttpOnly") == 0)
{
setHttpOnly(true);
}
else
{
setName(name);
setValue(value);
}
}
}
开发者ID:Chingliu,项目名称:poco,代码行数:52,代码来源:HTTPCookie.cpp
示例8: setNoPurge
bool FileChannel::setNoPurge(const std::string& value)
{
if (value.empty() || 0 == icompare(value, "none"))
{
delete _pPurgeStrategy;
_pPurgeStrategy = 0;
_purgeAge = "none";
return true;
}
else return false;
}
开发者ID:Kampbell,项目名称:poco,代码行数:11,代码来源:FileChannel.cpp
示例9: icompare
WebSocketImpl* WebSocket::accept(HTTPServerRequest& request, HTTPServerResponse& response)
{
if (icompare(request.get("Connection", ""), "Upgrade") == 0 &&
icompare(request.get("Upgrade", ""), "websocket") == 0)
{
std::string version = request.get("Sec-WebSocket-Version", "");
if (version.empty()) throw WebSocketException("Missing Sec-WebSocket-Version in handshake request", WS_ERR_HANDSHAKE_NO_VERSION);
if (version != WEBSOCKET_VERSION) throw WebSocketException("Unsupported WebSocket version requested", version, WS_ERR_HANDSHAKE_UNSUPPORTED_VERSION);
std::string key = request.get("Sec-WebSocket-Key", "");
Poco::trimInPlace(key);
if (key.empty()) throw WebSocketException("Missing Sec-WebSocket-Key in handshake request", WS_ERR_HANDSHAKE_NO_KEY);
response.setStatusAndReason(HTTPResponse::HTTP_SWITCHING_PROTOCOLS);
response.set("Upgrade", "websocket");
response.set("Connection", "Upgrade");
response.set("Sec-WebSocket-Accept", computeAccept(key));
response.setContentLength(0);
response.send().flush();
return new WebSocketImpl(static_cast<StreamSocketImpl*>(static_cast<HTTPServerRequestImpl&>(request).detachSocket().impl()), false);
}
else throw WebSocketException("No WebSocket handshake", WS_ERR_NO_HANDSHAKE);
}
开发者ID:Fangang,项目名称:poco,代码行数:22,代码来源:WebSocket.cpp
示例10: _version
HTTPCookie::HTTPCookie(const NameValueCollection& nvc):
_version(0),
_secure(false),
_maxAge(-1),
_httpOnly(false)
{
for (NameValueCollection::ConstIterator it = nvc.begin(); it != nvc.end(); ++it) {
const std::string& name = it->first;
const std::string& value = it->second;
if (icompare(name, "comment") == 0) {
setComment(value);
}
else if (icompare(name, "domain") == 0) {
setDomain(value);
}
else if (icompare(name, "path") == 0) {
setPath(value);
}
else if (icompare(name, "priority") == 0) {
setPriority(value);
}
else if (icompare(name, "max-age") == 0) {
throw NotImplementedException("HTTPCookie::HTTPCookie max-age");
}
else if (icompare(name, "secure") == 0) {
setSecure(true);
}
else if (icompare(name, "expires") == 0) {
throw NotImplementedException("HTTPCookie::HTTPCookie expires");
}
else if (icompare(name, "version") == 0) {
throw NotImplementedException("HTTPCookie::HTTPCookie version");
}
else if (icompare(name, "HttpOnly") == 0) {
setHttpOnly(true);
}
else {
setName(name);
setValue(value);
}
}
}
开发者ID:liyustar,项目名称:liblyx,代码行数:43,代码来源:lyxHTTPCookie.cpp
示例11: NotAuthenticatedException
void OAuth20Credentials::extractBearerToken(const HTTPRequest& request)
{
if (request.hasCredentials())
{
std::string authScheme;
std::string authInfo;
request.getCredentials(authScheme, authInfo);
if (icompare(authScheme, _scheme) == 0)
{
_bearerToken = authInfo;
}
else throw NotAuthenticatedException("No bearer token in Authorization header", authScheme);
}
else throw NotAuthenticatedException("No Authorization header found");
}
开发者ID:ConfusedReality,项目名称:pkg_network_poco,代码行数:15,代码来源:OAuth20Credentials.cpp
示例12: if
int Logger::parseLevel(const std::string& level)
{
if (icompare(level, "none") == 0)
return 0;
else if (icompare(level, "fatal") == 0)
return Message::PRIO_FATAL;
else if (icompare(level, "critical") == 0)
return Message::PRIO_CRITICAL;
else if (icompare(level, "error") == 0)
return Message::PRIO_ERROR;
else if (icompare(level, "warning") == 0)
return Message::PRIO_WARNING;
else if (icompare(level, "notice") == 0)
return Message::PRIO_NOTICE;
else if (icompare(level, "information") == 0)
return Message::PRIO_INFORMATION;
else if (icompare(level, "debug") == 0)
return Message::PRIO_DEBUG;
else if (icompare(level, "trace") == 0)
return Message::PRIO_TRACE;
else
throw InvalidArgumentException("Not a valid log level", level);
}
开发者ID:Denisss025,项目名称:poco,代码行数:23,代码来源:Logger.cpp
示例13: setPurgeAge
void FileChannel::setPurgeAge(const std::string& age)
{
delete _pPurgeStrategy;
_pPurgeStrategy = 0;
_purgeAge = "none";
if (age.empty() || 0 == icompare(age, "none"))
return;
std::string::const_iterator it = age.begin();
std::string::const_iterator end = age.end();
int n = 0;
while (it != end && Ascii::isSpace(*it))
++it;
while (it != end && Ascii::isDigit(*it))
{
n *= 10;
n += *it++ - '0';
}
while (it != end && Ascii::isSpace(*it))
++it;
std::string unit;
while (it != end && Ascii::isAlpha(*it))
unit += *it++;
Timespan::TimeDiff factor = Timespan::SECONDS;
if (unit == "minutes")
factor = Timespan::MINUTES;
else if (unit == "hours")
factor = Timespan::HOURS;
else if (unit == "days")
factor = Timespan::DAYS;
else if (unit == "weeks")
factor = 7*Timespan::DAYS;
else if (unit == "months")
factor = 30 * Timespan::DAYS;
else if (unit != "seconds")
throw InvalidArgumentException("purgeAge", age);
if (0 == n)
throw InvalidArgumentException("Zero is not valid purge age.");
_pPurgeStrategy = new PurgeByAgeStrategy(Timespan(factor * n));
_purgeAge = age;
}
开发者ID:RageStormers,项目名称:poco,代码行数:45,代码来源:FileChannel.cpp
示例14: icompare
void WindowsColorConsoleChannel::setProperty(const std::string& name, const std::string& value)
{
if (name == "enableColors")
{
_enableColors = icompare(value, "true") == 0;
}
else if (name == "traceColor")
{
_colors[Message::PRIO_TRACE] = parseColor(value);
}
else if (name == "debugColor")
{
_colors[Message::PRIO_DEBUG] = parseColor(value);
}
else if (name == "informationColor")
{
_colors[Message::PRIO_INFORMATION] = parseColor(value);
}
else if (name == "noticeColor")
{
_colors[Message::PRIO_NOTICE] = parseColor(value);
}
else if (name == "warningColor")
{
_colors[Message::PRIO_WARNING] = parseColor(value);
}
else if (name == "errorColor")
{
_colors[Message::PRIO_ERROR] = parseColor(value);
}
else if (name == "criticalColor")
{
_colors[Message::PRIO_CRITICAL] = parseColor(value);
}
else if (name == "fatalColor")
{
_colors[Message::PRIO_FATAL] = parseColor(value);
}
else
{
Channel::setProperty(name, value);
}
}
开发者ID:MSOpenTech,项目名称:graphics-dependencies,代码行数:43,代码来源:WindowsConsoleChannel.cpp
示例15: setLevel
void LevelFilterChannel::setLevel(const std::string& value)
{
if (icompare(value, "fatal") == 0)
setLevel(Message::PRIO_FATAL);
else if (icompare(value, "critical") == 0)
setLevel(Message::PRIO_CRITICAL);
else if (icompare(value, "error") == 0)
setLevel(Message::PRIO_ERROR);
else if (icompare(value, "warning") == 0)
setLevel(Message::PRIO_WARNING);
else if (icompare(value, "notice") == 0)
setLevel(Message::PRIO_NOTICE);
else if (icompare(value, "information") == 0)
setLevel(Message::PRIO_INFORMATION);
else if (icompare(value, "debug") == 0)
setLevel(Message::PRIO_DEBUG);
else if (icompare(value, "trace") == 0)
setLevel(Message::PRIO_TRACE);
else
throw InvalidArgumentException("Not a valid log value", value);
}
开发者ID:Aahart911,项目名称:ClickHouse,代码行数:21,代码来源:LevelFilterChannel.cpp
示例16: icompare
bool FileImpl::isDeviceImpl() const
{
return
_path.compare(0, 4, "\\\\.\\") == 0 ||
icompare(_path, "CON") == 0 ||
icompare(_path, "PRN") == 0 ||
icompare(_path, "AUX") == 0 ||
icompare(_path, "NUL") == 0 ||
( (icompare(_path, 0, 3, "LPT") == 0 || icompare(_path, 0, 3, "COM") == 0) &&
_path.size() == 4 &&
_path[3] > 0x30 &&
isdigit(_path[3])
);
}
开发者ID:9drops,项目名称:poco,代码行数:14,代码来源:File_WIN32.cpp
示例17: setPurgeCount
void FileChannel::setPurgeCount(const std::string& count)
{
delete _pPurgeStrategy;
_pPurgeStrategy = 0;
_purgeAge = "none";
if (count.empty() || 0 == icompare(count, "none"))
return;
std::string::const_iterator it = count.begin();
std::string::const_iterator end = count.end();
int n = 0;
while (it != end && Ascii::isSpace(*it)) ++it;
while (it != end && Ascii::isDigit(*it)) { n *= 10; n += *it++ - '0'; }
if (0 == n)
throw InvalidArgumentException("Zero is not valid purge count.");
while (it != end && Ascii::isSpace(*it)) ++it;
delete _pPurgeStrategy;
_pPurgeStrategy = new PurgeByCountStrategy(n);
_purgeCount = count;
}
开发者ID:babafall,项目名称:Sogeti-MasterThesis-CrossPlatformMobileDevelopment,代码行数:22,代码来源:FileChannel.cpp
示例18: digest
bool HTTPDigestCredentials::verifyAuthParams(const HTTPRequest& request, const HTTPAuthenticationParams& params) const
{
const std::string& nonce = params.get(NONCE_PARAM);
const std::string& realm = params.getRealm();
const std::string& qop = params.get(QOP_PARAM, DEFAULT_QOP);
std::string response;
MD5Engine engine;
if (qop.empty())
{
const std::string ha1 = digest(engine, _username, realm, _password);
const std::string ha2 = digest(engine, request.getMethod(), request.getURI());
response = digest(engine, ha1, nonce, ha2);
}
else if (icompare(qop, AUTH_PARAM) == 0)
{
const std::string& cnonce = params.get(CNONCE_PARAM);
const std::string& nc = params.get(NC_PARAM);
const std::string ha1 = digest(engine, _username, realm, _password);
const std::string ha2 = digest(engine, request.getMethod(), request.getURI());
response = digest(engine, ha1, nonce, nc, cnonce, qop, ha2);
}
return response == params.get(RESPONSE_PARAM);
}
开发者ID:9drops,项目名称:poco,代码行数:23,代码来源:HTTPDigestCredentials.cpp
示例19: process
void Option::process(const std::string& option, std::string& arg) const
{
std::string::size_type pos = option.find_first_of(":=");
std::string::size_type len = pos == std::string::npos ? option.length() : pos;
if (icompare(option, 0, len, _fullName, 0, len) == 0)
{
if (takesArgument())
{
if (argumentRequired() && pos == std::string::npos)
throw MissingArgumentException(_fullName + " requires " + argumentName());
if (pos != std::string::npos)
arg.assign(option, pos + 1, option.length() - pos - 1);
else
arg.clear();
}
else if (pos != std::string::npos)
{
throw UnexpectedArgumentException(option);
}
else arg.clear();
}
else if (!_shortName.empty() && option.compare(0, _shortName.length(), _shortName) == 0)
{
if (takesArgument())
{
if (argumentRequired() && option.length() == _shortName.length())
throw MissingArgumentException(_shortName + " requires " + argumentName());
arg.assign(option, _shortName.length(), option.length() - _shortName.length());
}
else if (option.length() != _shortName.length())
{
throw UnexpectedArgumentException(option);
}
else arg.clear();
}
else throw UnknownOptionException(option);
}
开发者ID:Alcibiades586,项目名称:roadrunner,代码行数:37,代码来源:Option.cpp
示例20: enumerate
void IniFileConfiguration::enumerate(const std::string& key, Keys& range) const
{
std::set<std::string> keys;
std::string prefix = key;
if (!prefix.empty()) prefix += '.';
std::string::size_type psize = prefix.size();
for (IStringMap::const_iterator it = _map.begin(); it != _map.end(); ++it)
{
if (icompare(it->first, psize, prefix) == 0)
{
std::string subKey;
std::string::size_type end = it->first.find('.', psize);
if (end == std::string::npos)
subKey = it->first.substr(psize);
else
subKey = it->first.substr(psize, end - psize);
if (keys.find(subKey) == keys.end())
{
range.push_back(subKey);
keys.insert(subKey);
}
}
}
}
开发者ID:6301158,项目名称:ofx-dev,代码行数:24,代码来源:IniFileConfiguration.cpp
注:本文中的icompare函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论