summaryrefslogtreecommitdiff
path: root/libs/litehtml/src/html.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/litehtml/src/html.cpp')
-rw-r--r--libs/litehtml/src/html.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/libs/litehtml/src/html.cpp b/libs/litehtml/src/html.cpp
index a4632f8602..a7ea9f9032 100644
--- a/libs/litehtml/src/html.cpp
+++ b/libs/litehtml/src/html.cpp
@@ -1,8 +1,10 @@
#include "html.h"
#include "types.h"
-#include "utf8_strings.h"
-void litehtml::trim(string &s, const string& chars_to_trim)
+namespace litehtml
+{
+
+string& trim(string &s, const string& chars_to_trim)
{
string::size_type pos = s.find_first_not_of(chars_to_trim);
if(pos != string::npos)
@@ -12,24 +14,25 @@ void litehtml::trim(string &s, const string& chars_to_trim)
else
{
s = "";
- return;
+ return s;
}
pos = s.find_last_not_of(chars_to_trim);
if(pos != string::npos)
{
s.erase(s.begin() + pos + 1, s.end());
}
+ return s;
}
-void litehtml::lcase(string &s)
+void lcase(string &s)
{
for(char & i : s)
{
- i = t_tolower(i);
+ i = (char)t_tolower(i);
}
}
-litehtml::string::size_type litehtml::find_close_bracket(const string &s, string::size_type off, char open_b, char close_b)
+string::size_type find_close_bracket(const string &s, string::size_type off, char open_b, char close_b)
{
int cnt = 0;
for(string::size_type i = off; i < s.length(); i++)
@@ -49,7 +52,7 @@ litehtml::string::size_type litehtml::find_close_bracket(const string &s, string
return string::npos;
}
-litehtml::string litehtml::index_value(int index, const string& strings, char delim)
+string index_value(int index, const string& strings, char delim)
{
std::vector<string> vals;
string delims;
@@ -62,7 +65,7 @@ litehtml::string litehtml::index_value(int index, const string& strings, char de
return std::to_string(index);
}
-int litehtml::value_index( const string& val, const string& strings, int defValue, char delim )
+int value_index( const string& val, const string& strings, int defValue, char delim )
{
if(val.empty() || strings.empty() || !delim)
{
@@ -99,7 +102,7 @@ int litehtml::value_index( const string& val, const string& strings, int defValu
return defValue;
}
-bool litehtml::value_in_list( const string& val, const string& strings, char delim )
+bool value_in_list( const string& val, const string& strings, char delim )
{
int idx = value_index(val, strings, -1, delim);
if(idx >= 0)
@@ -109,7 +112,7 @@ bool litehtml::value_in_list( const string& val, const string& strings, char del
return false;
}
-void litehtml::split_string(const string& str, string_vector& tokens, const string& delims, const string& delims_preserve, const string& quote)
+void split_string(const string& str, string_vector& tokens, const string& delims, const string& delims_preserve, const string& quote)
{
if(str.empty() || (delims.empty() && delims_preserve.empty()))
{
@@ -171,7 +174,7 @@ void litehtml::split_string(const string& str, string_vector& tokens, const stri
}
}
-void litehtml::join_string(string& str, const string_vector& tokens, const string& delims)
+void join_string(string& str, const string_vector& tokens, const string& delims)
{
str = "";
for (size_t i = 0; i < tokens.size(); i++)
@@ -184,7 +187,7 @@ void litehtml::join_string(string& str, const string_vector& tokens, const strin
}
}
-int litehtml::t_strcasecmp(const char *s1, const char *s2)
+int t_strcasecmp(const char *s1, const char *s2)
{
int i, d, c;
@@ -201,7 +204,7 @@ int litehtml::t_strcasecmp(const char *s1, const char *s2)
}
}
-int litehtml::t_strncasecmp(const char *s1, const char *s2, size_t n)
+int t_strncasecmp(const char *s1, const char *s2, size_t n)
{
int i, d, c;
@@ -220,7 +223,7 @@ int litehtml::t_strncasecmp(const char *s1, const char *s2, size_t n)
return 0;
}
-litehtml::string litehtml::get_escaped_string(const string& in_str)
+string get_escaped_string(const string& in_str)
{
string ret;
for (auto ch : in_str)
@@ -278,7 +281,7 @@ litehtml::string litehtml::get_escaped_string(const string& in_str)
return ret;
}
-bool litehtml::is_number(const string& string, const bool allow_dot) {
+bool is_number(const string& string, const bool allow_dot) {
for (auto ch : string)
{
if (!(t_isdigit(ch) || (allow_dot && ch == '.')))
@@ -288,3 +291,5 @@ bool litehtml::is_number(const string& string, const bool allow_dot) {
}
return true;
}
+
+} // namespace litehtml \ No newline at end of file