Replace boost::to_lower and boost::to_upper by strutils::lowercase and strutils::uppercase

This commit is contained in:
gallaert 2020-04-14 12:48:07 +01:00 committed by James Turner
parent 8626e0482d
commit 2ab0122124
8 changed files with 17 additions and 36 deletions

View File

@ -35,8 +35,6 @@
#include <stdexcept>
#include <mutex>
#include <boost/algorithm/string/case_conv.hpp>
#include <simgear/simgear_config.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") {
curl_easy_setopt(curlRequest, CURLOPT_HTTPGET, 1);
} else if (method == "put") {
@ -530,8 +528,8 @@ size_t Client::requestHeaderCallback(char *rawBuffer, size_t size, size_t nitems
return byteSize;
}
std::string key = strutils::simplify(h.substr(0, colonPos));
std::string lkey = boost::to_lower_copy(key);
const std::string key = strutils::simplify(h.substr(0, colonPos));
const std::string lkey = strutils::lowercase (key);
std::string value = strutils::strip(h.substr(colonPos + 1));
req->responseHeader(lkey, value);

View File

@ -7,8 +7,6 @@
#include <thread>
#include <atomic>
#include <boost/algorithm/string/case_conv.hpp>
#include <simgear/simgear_config.h>
#include "DNSClient.hxx"

View File

@ -5,8 +5,6 @@
#include <sstream>
#include <cerrno>
#include <boost/algorithm/string/case_conv.hpp>
#include <simgear/simgear_config.h>
#include "HTTPClient.hxx"

View File

@ -1,6 +1,7 @@
#ifndef SIMGEAR_IO_TEST_HTTP_HXX
#define SIMGEAR_IO_TEST_HTTP_HXX
#include <algorithm>
#include <sstream>
#include <vector>

View File

@ -5,8 +5,6 @@
#include <errno.h>
#include <fcntl.h>
#include <boost/algorithm/string/case_conv.hpp>
#include <simgear/simgear_config.h>
#include "test_HTTP.hxx"

View File

@ -5,8 +5,6 @@
#include <sstream>
#include <errno.h>
#include <boost/algorithm/string/case_conv.hpp>
#include <simgear/simgear_config.h>
#include "HTTPClient.hxx"

View File

@ -29,6 +29,7 @@
#include <simgear/misc/strutils.hxx>
#include <simgear/io/iostreams/sgstream.hxx>
#include <cstring>
#include <stdio.h>
#include <sys/stat.h>
#include <errno.h>
@ -47,8 +48,6 @@
#include "sg_path.hxx"
#include <boost/algorithm/string/case_conv.hpp>
using std::string;
using simgear::strutils::starts_with;
@ -398,7 +397,7 @@ string SGPath::extension() const {
}
string SGPath::lower_extension() const {
return boost::to_lower_copy(extension());
return simgear::strutils::lowercase (extension());
}
string SGPath::complete_lower_extension() const
@ -412,7 +411,7 @@ string SGPath::complete_lower_extension() const
string::size_type firstDot = path.find(".", index);
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 {
return "";
}

View File

@ -20,7 +20,6 @@
#include <simgear/package/Package.hxx>
#include <cassert>
#include <boost/algorithm/string/case_conv.hpp>
#include <simgear/debug/logstream.hxx>
#include <simgear/structure/exception.hxx>
@ -44,8 +43,7 @@ void Package::initWithProps(const SGPropertyNode* aProps)
m_props = const_cast<SGPropertyNode*>(aProps);
// cache tag values
for (auto c : aProps->getChildren("tag")) {
std::string t(c->getStringValue());
m_tags.insert(boost::to_lower_copy(t));
m_tags.insert (strutils::lowercase (c->getStringValue()));
}
m_id = m_props->getStringValue("id");
@ -97,8 +95,7 @@ bool Package::matches(const SGPropertyNode* aFilter) const
}
if (filter_name == "tag") {
std::string tag(aFilter->getStringValue());
boost::to_lower(tag);
const std::string tag = strutils::lowercase (aFilter->getStringValue());
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
if ((filter_name == "text") || (filter_name == "name")) {
handled = true;
std::string n(aFilter->getStringValue());
boost::to_lower(n);
const std::string n = strutils::lowercase (aFilter->getStringValue());
size_t pos = boost::to_lower_copy(name()).find(n);
const size_t pos = strutils::lowercase (name()).find(n);
if (pos != std::string::npos) {
return true;
}
for (auto var : m_props->getChildren("variant")) {
if (var->hasChild("name")) {
std::string variantName(var->getStringValue("name"));
boost::to_lower(variantName);
const std::string variantName = strutils::lowercase (var->getStringValue("name"));
size_t pos = variantName.find(n);
if (pos != std::string::npos) {
return true;
@ -146,12 +141,10 @@ bool Package::matches(const SGPropertyNode* aFilter) const
bool Package::matchesDescription(const std::string &search) const
{
std::string n(search);
boost::to_lower(n);
const std::string n = strutils::lowercase (search);
bool localized;
auto d = getLocalisedString(m_props, "description", &localized);
boost::to_lower(d);
const auto d = strutils::lowercase (getLocalisedString(m_props, "description", &localized));
if (d.find(n) != std::string::npos) {
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
if (localized) {
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) {
return true;
}
@ -167,9 +160,8 @@ bool Package::matchesDescription(const std::string &search) const
// try each variant's description
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()) {
boost::to_lower(vd);
if (vd.find(n) != std::string::npos) {
return true;
}
@ -177,8 +169,7 @@ bool Package::matchesDescription(const std::string &search) const
if (localized) {
// try non-localized variant description
std::string vd = var->getStringValue("description");
boost::to_lower(vd);
const std::string vd = strutils::lowercase (var->getStringValue("description"));
if (vd.find(n) != std::string::npos) {
return true;
}