Reduces boost usage for strings

This commit is contained in:
Vladislav Belov 2025-10-16 09:17:05 +02:00
parent e8d9a8db67
commit 99bf50cd4e
No known key found for this signature in database
GPG key ID: 353545E45DB9CCB3
5 changed files with 11 additions and 18 deletions

View file

@ -35,7 +35,6 @@
#include "ps/Filesystem.h"
#include <algorithm>
#include <boost/algorithm/string/predicate.hpp>
#include <cstddef>
#include <string>
#include <vector>
@ -93,7 +92,7 @@ public:
Status ReloadChangedFile(const VfsPath& path)
{
// Ignore files that aren't in the right path
if (!boost::algorithm::starts_with(path.string(), L"art/skeletons/"))
if (!path.string().starts_with(L"art/skeletons/"))
return INFO::OK;
if (path.Extension() != L".xml")

View file

@ -39,7 +39,6 @@
#include "scriptinterface/ScriptInterface.h"
#include <algorithm>
#include <boost/algorithm/string/predicate.hpp>
#include <cstdint>
#include <cstring>
#include <exception>
@ -518,7 +517,7 @@ VfsPath L10n::LocalizePath(const VfsPath& sourcePath) const
Status L10n::ReloadChangedFile(const VfsPath& path)
{
if (!boost::algorithm::starts_with(path.string(), L"l10n/"))
if (!path.string().starts_with(L"l10n/"))
return INFO::OK;
if (path.Extension() != L".po")

View file

@ -32,7 +32,6 @@
#include "ps/XML/Xeromyces.h"
#include "renderer/backend/dummy/Device.h"
#include <boost/algorithm/string/predicate.hpp>
#include <string>
CArchiveBuilder::CArchiveBuilder(const OsPath& mod, const OsPath& tempdir) :
@ -98,13 +97,11 @@ void CArchiveBuilder::Build(const OsPath& archive, bool compress)
ENSURE(ret == INFO::OK);
// Compress textures and store the new cached version instead of the original
if ((boost::algorithm::starts_with(path.string(), L"art/textures/") ||
boost::algorithm::starts_with(path.string(), L"fonts/")
) &&
if ((path.string().starts_with(L"art/textures/") || path.string().starts_with(L"fonts/")) &&
tex_is_known_extension(path) &&
// Skip some subdirectories where the engine doesn't use CTextureManager yet:
!boost::algorithm::starts_with(path.string(), L"art/textures/cursors/") &&
!boost::algorithm::starts_with(path.string(), L"art/textures/terrain/alphamaps/")
!path.string().starts_with(L"art/textures/cursors/") &&
!path.string().starts_with(L"art/textures/terrain/alphamaps/")
)
{
VfsPath cachedPath;
@ -128,9 +125,9 @@ void CArchiveBuilder::Build(const OsPath& archive, bool compress)
{
CColladaManager::FileType type;
if (boost::algorithm::starts_with(path.string(), L"art/meshes/"))
if (path.string().starts_with(L"art/meshes/"))
type = CColladaManager::PMD;
else if (boost::algorithm::starts_with(path.string(), L"art/animation/"))
else if (path.string().starts_with(L"art/animation/"))
type = CColladaManager::PSA;
else
{

View file

@ -33,7 +33,6 @@
#include "ps/Profiler2.h"
#include <algorithm>
#include <boost/algorithm/string/predicate.hpp>
#include <cstddef>
#include <mutex>
#include <unordered_set>
@ -239,11 +238,11 @@ std::map<CStr, CConfigValueSet> CConfigDB::GetValuesWithPrefix(EConfigNamespace
// values in earlier namespaces
for (int search_ns = 0; search_ns <= ns; ++search_ns)
for (const std::pair<const CStr, CConfigValueSet>& p : m_Map[search_ns])
if (boost::algorithm::starts_with(p.first, prefix))
if (p.first.starts_with(prefix))
ret[p.first] = p.second;
for (const std::pair<const CStr, CConfigValueSet>& p : m_Map[CFG_COMMAND])
if (boost::algorithm::starts_with(p.first, prefix))
if (p.first.starts_with(prefix))
ret[p.first] = p.second;
return ret;

View file

@ -46,7 +46,6 @@
#include <algorithm>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/split.hpp>
#include <cstdio>
#include <cstring>
@ -826,9 +825,9 @@ bool ModIo::ParseSignature(const std::vector<std::string>& minisigs, SigStruct&
// because that is easy.
const std::string untrusted_comment_prefix = "untrusted comment: ";
const std::string trusted_comment_prefix = "trusted comment: ";
if (!boost::algorithm::starts_with(sig_lines[0], untrusted_comment_prefix))
if (!sig_lines[0].starts_with(untrusted_comment_prefix))
FAIL("Malformed untrusted comment.");
if (!boost::algorithm::starts_with(sig_lines[2], trusted_comment_prefix))
if (!sig_lines[2].starts_with(trusted_comment_prefix))
FAIL("Malformed trusted comment.");
// We only _really_ care about the second line which is the signature of the file (b64-encoded)