Replace boost::to_lower and boost::to_upper by strutils::lowercase and strutils::uppercase
This commit is contained in:
parent
8626e0482d
commit
2ab0122124
@ -35,8 +35,6 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
|
||||||
|
|
||||||
#include <simgear/simgear_config.h>
|
#include <simgear/simgear_config.h>
|
||||||
|
|
||||||
#include <curl/multi.h>
|
#include <curl/multi.h>
|
||||||
@ -297,7 +295,7 @@ void Client::makeRequest(const Request_ptr& r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string method = boost::to_lower_copy(r->method());
|
const std::string method = strutils::lowercase (r->method());
|
||||||
if (method == "get") {
|
if (method == "get") {
|
||||||
curl_easy_setopt(curlRequest, CURLOPT_HTTPGET, 1);
|
curl_easy_setopt(curlRequest, CURLOPT_HTTPGET, 1);
|
||||||
} else if (method == "put") {
|
} else if (method == "put") {
|
||||||
@ -530,8 +528,8 @@ size_t Client::requestHeaderCallback(char *rawBuffer, size_t size, size_t nitems
|
|||||||
return byteSize;
|
return byteSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string key = strutils::simplify(h.substr(0, colonPos));
|
const std::string key = strutils::simplify(h.substr(0, colonPos));
|
||||||
std::string lkey = boost::to_lower_copy(key);
|
const std::string lkey = strutils::lowercase (key);
|
||||||
std::string value = strutils::strip(h.substr(colonPos + 1));
|
std::string value = strutils::strip(h.substr(colonPos + 1));
|
||||||
|
|
||||||
req->responseHeader(lkey, value);
|
req->responseHeader(lkey, value);
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
|
||||||
|
|
||||||
#include <simgear/simgear_config.h>
|
#include <simgear/simgear_config.h>
|
||||||
|
|
||||||
#include "DNSClient.hxx"
|
#include "DNSClient.hxx"
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
|
||||||
|
|
||||||
#include <simgear/simgear_config.h>
|
#include <simgear/simgear_config.h>
|
||||||
|
|
||||||
#include "HTTPClient.hxx"
|
#include "HTTPClient.hxx"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef SIMGEAR_IO_TEST_HTTP_HXX
|
#ifndef SIMGEAR_IO_TEST_HTTP_HXX
|
||||||
#define SIMGEAR_IO_TEST_HTTP_HXX
|
#define SIMGEAR_IO_TEST_HTTP_HXX
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
|
||||||
|
|
||||||
#include <simgear/simgear_config.h>
|
#include <simgear/simgear_config.h>
|
||||||
|
|
||||||
#include "test_HTTP.hxx"
|
#include "test_HTTP.hxx"
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
|
||||||
|
|
||||||
#include <simgear/simgear_config.h>
|
#include <simgear/simgear_config.h>
|
||||||
|
|
||||||
#include "HTTPClient.hxx"
|
#include "HTTPClient.hxx"
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <simgear/misc/strutils.hxx>
|
#include <simgear/misc/strutils.hxx>
|
||||||
#include <simgear/io/iostreams/sgstream.hxx>
|
#include <simgear/io/iostreams/sgstream.hxx>
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -47,8 +48,6 @@
|
|||||||
|
|
||||||
#include "sg_path.hxx"
|
#include "sg_path.hxx"
|
||||||
|
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using simgear::strutils::starts_with;
|
using simgear::strutils::starts_with;
|
||||||
|
|
||||||
@ -398,7 +397,7 @@ string SGPath::extension() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string SGPath::lower_extension() const {
|
string SGPath::lower_extension() const {
|
||||||
return boost::to_lower_copy(extension());
|
return simgear::strutils::lowercase (extension());
|
||||||
}
|
}
|
||||||
|
|
||||||
string SGPath::complete_lower_extension() const
|
string SGPath::complete_lower_extension() const
|
||||||
@ -412,7 +411,7 @@ string SGPath::complete_lower_extension() const
|
|||||||
|
|
||||||
string::size_type firstDot = path.find(".", index);
|
string::size_type firstDot = path.find(".", index);
|
||||||
if ((firstDot != string::npos) && (path.find(sgDirPathSep, firstDot) == string::npos)) {
|
if ((firstDot != string::npos) && (path.find(sgDirPathSep, firstDot) == string::npos)) {
|
||||||
return boost::to_lower_copy(path.substr(firstDot + 1));
|
return simgear::strutils::lowercase (path.substr(firstDot + 1));
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include <simgear/package/Package.hxx>
|
#include <simgear/package/Package.hxx>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/structure/exception.hxx>
|
||||||
@ -44,8 +43,7 @@ void Package::initWithProps(const SGPropertyNode* aProps)
|
|||||||
m_props = const_cast<SGPropertyNode*>(aProps);
|
m_props = const_cast<SGPropertyNode*>(aProps);
|
||||||
// cache tag values
|
// cache tag values
|
||||||
for (auto c : aProps->getChildren("tag")) {
|
for (auto c : aProps->getChildren("tag")) {
|
||||||
std::string t(c->getStringValue());
|
m_tags.insert (strutils::lowercase (c->getStringValue()));
|
||||||
m_tags.insert(boost::to_lower_copy(t));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_id = m_props->getStringValue("id");
|
m_id = m_props->getStringValue("id");
|
||||||
@ -97,8 +95,7 @@ bool Package::matches(const SGPropertyNode* aFilter) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (filter_name == "tag") {
|
if (filter_name == "tag") {
|
||||||
std::string tag(aFilter->getStringValue());
|
const std::string tag = strutils::lowercase (aFilter->getStringValue());
|
||||||
boost::to_lower(tag);
|
|
||||||
return (m_tags.find(tag) != m_tags.end());
|
return (m_tags.find(tag) != m_tags.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,18 +107,16 @@ bool Package::matches(const SGPropertyNode* aFilter) const
|
|||||||
// substring search of name, description, across variants too
|
// substring search of name, description, across variants too
|
||||||
if ((filter_name == "text") || (filter_name == "name")) {
|
if ((filter_name == "text") || (filter_name == "name")) {
|
||||||
handled = true;
|
handled = true;
|
||||||
std::string n(aFilter->getStringValue());
|
const std::string n = strutils::lowercase (aFilter->getStringValue());
|
||||||
boost::to_lower(n);
|
|
||||||
|
|
||||||
size_t pos = boost::to_lower_copy(name()).find(n);
|
const size_t pos = strutils::lowercase (name()).find(n);
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto var : m_props->getChildren("variant")) {
|
for (auto var : m_props->getChildren("variant")) {
|
||||||
if (var->hasChild("name")) {
|
if (var->hasChild("name")) {
|
||||||
std::string variantName(var->getStringValue("name"));
|
const std::string variantName = strutils::lowercase (var->getStringValue("name"));
|
||||||
boost::to_lower(variantName);
|
|
||||||
size_t pos = variantName.find(n);
|
size_t pos = variantName.find(n);
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
return true;
|
return true;
|
||||||
@ -146,12 +141,10 @@ bool Package::matches(const SGPropertyNode* aFilter) const
|
|||||||
|
|
||||||
bool Package::matchesDescription(const std::string &search) const
|
bool Package::matchesDescription(const std::string &search) const
|
||||||
{
|
{
|
||||||
std::string n(search);
|
const std::string n = strutils::lowercase (search);
|
||||||
boost::to_lower(n);
|
|
||||||
|
|
||||||
bool localized;
|
bool localized;
|
||||||
auto d = getLocalisedString(m_props, "description", &localized);
|
const auto d = strutils::lowercase (getLocalisedString(m_props, "description", &localized));
|
||||||
boost::to_lower(d);
|
|
||||||
if (d.find(n) != std::string::npos) {
|
if (d.find(n) != std::string::npos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -159,7 +152,7 @@ bool Package::matchesDescription(const std::string &search) const
|
|||||||
// try non-localized description too, if the abovce was a localized one
|
// try non-localized description too, if the abovce was a localized one
|
||||||
if (localized) {
|
if (localized) {
|
||||||
const std::string baseDesc = m_props->getStringValue("description");
|
const std::string baseDesc = m_props->getStringValue("description");
|
||||||
auto pos = boost::to_lower_copy(baseDesc).find(n);
|
const auto pos = strutils::lowercase (baseDesc).find(n);
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -167,9 +160,8 @@ bool Package::matchesDescription(const std::string &search) const
|
|||||||
|
|
||||||
// try each variant's description
|
// try each variant's description
|
||||||
for (auto var : m_props->getChildren("variant")) {
|
for (auto var : m_props->getChildren("variant")) {
|
||||||
auto vd = getLocalisedString(var, "description", &localized);
|
const auto vd = strutils::lowercase (getLocalisedString(var, "description", &localized));
|
||||||
if (!vd.empty()) {
|
if (!vd.empty()) {
|
||||||
boost::to_lower(vd);
|
|
||||||
if (vd.find(n) != std::string::npos) {
|
if (vd.find(n) != std::string::npos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -177,8 +169,7 @@ bool Package::matchesDescription(const std::string &search) const
|
|||||||
|
|
||||||
if (localized) {
|
if (localized) {
|
||||||
// try non-localized variant description
|
// try non-localized variant description
|
||||||
std::string vd = var->getStringValue("description");
|
const std::string vd = strutils::lowercase (var->getStringValue("description"));
|
||||||
boost::to_lower(vd);
|
|
||||||
if (vd.find(n) != std::string::npos) {
|
if (vd.find(n) != std::string::npos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user