HyperDbg Debugger
Loading...
Searching...
No Matches
inipp::detail Namespace Reference

Functions

template<class CharT >
void ltrim (std::basic_string< CharT > &s, const std::locale &loc)
 
template<class CharT >
void rtrim (std::basic_string< CharT > &s, const std::locale &loc)
 
template<class CharT , class UnaryPredicate >
void rtrim2 (std::basic_string< CharT > &s, UnaryPredicate pred)
 
template<class CharT >
bool replace (std::basic_string< CharT > &str, const std::basic_string< CharT > &from, const std::basic_string< CharT > &to)
 

Function Documentation

◆ ltrim()

template<class CharT >
void inipp::detail::ltrim ( std::basic_string< CharT > & s,
const std::locale & loc )
inline
49{
50 s.erase(s.begin(),
51 std::find_if(s.begin(), s.end(), [&loc](CharT ch) { return !std::isspace(ch, loc); }));
52}

◆ replace()

template<class CharT >
bool inipp::detail::replace ( std::basic_string< CharT > & str,
const std::basic_string< CharT > & from,
const std::basic_string< CharT > & to )
inline
74{
75 auto changed = false;
76 size_t start_pos = 0;
77 while ((start_pos = str.find(from, start_pos)) != std::basic_string<CharT>::npos)
78 {
79 str.replace(start_pos, from.length(), to);
80 start_pos += to.length();
81 changed = true;
82 }
83 return changed;
84}

◆ rtrim()

template<class CharT >
void inipp::detail::rtrim ( std::basic_string< CharT > & s,
const std::locale & loc )
inline
57{
58 s.erase(std::find_if(s.rbegin(), s.rend(), [&loc](CharT ch) { return !std::isspace(ch, loc); }).base(),
59 s.end());
60}

◆ rtrim2()

template<class CharT , class UnaryPredicate >
void inipp::detail::rtrim2 ( std::basic_string< CharT > & s,
UnaryPredicate pred )
inline
65{
66 s.erase(std::find_if(s.begin(), s.end(), pred), s.end());
67}