Disable stack execution on plugins
[claws.git] / src / plugins / litehtml_viewer / litehtml / html.h
blobb184ac30aba4bc913a8e5219ba915e7003ab264f
1 #ifndef LH_HTML_H
2 #define LH_HTML_H
4 #include <stdlib.h>
5 #include <string>
6 #include <ctype.h>
7 #include <vector>
8 #include <map>
9 #include <cstring>
10 #include <algorithm>
11 #include <functional>
12 #include "os_types.h"
13 #include "string_id.h"
14 #include "types.h"
15 #include "utf8_strings.h"
16 #include "background.h"
17 #include "borders.h"
18 #include "web_color.h"
19 #include "media_query.h"
20 #include "html_tag.h"
21 #include "document_container.h"
22 #include "document.h"
24 namespace litehtml
26 void trim(string &s);
27 void lcase(string &s);
28 int value_index(const string& val, const string& strings, int defValue = -1, char delim = ';');
29 string index_value(int index, const string& strings, char delim = ';');
30 bool value_in_list(const string& val, const string& strings, char delim = ';');
31 string::size_type find_close_bracket(const string &s, string::size_type off, char open_b = '(', char close_b = ')');
32 void split_string(const string& str, string_vector& tokens, const string& delims, const string& delims_preserve = "", const string& quote = "\"");
33 void join_string(string& str, const string_vector& tokens, const string& delims);
34 double t_strtod(const char* string, char** endPtr = nullptr);
35 string get_escaped_string(const string& in_str);
37 int t_strcasecmp(const char *s1, const char *s2);
38 int t_strncasecmp(const char *s1, const char *s2, size_t n);
40 inline int t_isdigit(int c)
42 return (c >= '0' && c <= '9');
45 inline int t_isalpha(int c)
47 return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
50 inline int t_tolower(int c)
52 return (c >= 'A' && c <= 'Z' ? c + 'a' - 'A' : c);
55 inline int round_f(float val)
57 int int_val = (int) val;
58 if(val - int_val >= 0.5)
60 int_val++;
62 return int_val;
65 inline int round_d(double val)
67 int int_val = (int) val;
68 if(val - int_val >= 0.5)
70 int_val++;
72 return int_val;
75 inline float t_strtof(const string& str, char** endPtr = nullptr)
77 return (float)t_strtod(str.c_str(), endPtr);
80 inline int baseline_align(int line_height, int line_base_line, int height, int baseline)
82 return (line_height - line_base_line) - (height - baseline);
86 #endif // LH_HTML_H