Cleanup string_tools.

1. Use boost::filesystem for already available operations.
2. Use boost::string for already available operations.
This commit is contained in:
0xFFFC0000 2024-03-15 11:24:12 +00:00
parent c8214782fb
commit c56ee140df
No known key found for this signature in database
GPG key ID: 650F7C2B7BDA3819
3 changed files with 41 additions and 64 deletions

View file

@ -31,6 +31,7 @@
#include "mlocker.h"
#include <boost/utility/string_ref.hpp>
#include <boost/algorithm/string.hpp>
#include <sstream>
#include <string>
#include <cstdint>
@ -69,23 +70,19 @@ namespace string_tools
#ifdef _WIN32
std::string get_current_module_path();
#endif
bool set_module_name_and_folder(const std::string& path_to_process_);
bool trim_left(std::string& str);
bool trim_right(std::string& str);
void set_module_name_and_folder(const std::string& path_to_process_);
void trim_left(std::string& str);
void trim_right(std::string& str);
//----------------------------------------------------------------------------
inline std::string& trim(std::string& str)
{
trim_left(str);
trim_right(str);
boost::trim(str);
return str;
}
//----------------------------------------------------------------------------
inline std::string trim(const std::string& str_)
inline std::string trim(const std::string& str)
{
std::string str = str_;
trim_left(str);
trim_right(str);
return str;
return boost::trim_copy(str);
}
std::string pad_string(std::string s, size_t n, char c = ' ', bool prepend = false);