1#ifndef LH_HTML_H
2#define LH_HTML_H
3
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"
23
24namespace litehtml
25{
26 void trim(string &s, const string& chars_to_trim = " \n\r\t");
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);
36
37 int t_strcasecmp(const char *s1, const char *s2);
38 int t_strncasecmp(const char *s1, const char *s2, size_t n);
39
40 bool is_number(const string& string, const bool allow_dot = 1);
41
42 inline int t_isdigit(int c)
43 {
44 return (c >= '0' && c <= '9');
45 }
46
47 inline int t_isalpha(int c)
48 {
49 return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
50 }
51
52 inline int t_tolower(int c)
53 {
54 return (c >= 'A' && c <= 'Z' ? c + 'a' - 'A' : c);
55 }
56
57 inline int round_f(float val)
58 {
59 int int_val = (int) val;
60 if(val - int_val >= 0.5)
61 {
62 int_val++;
63 }
64 return int_val;
65 }
66
67 inline int round_d(double val)
68 {
69 int int_val = (int) val;
70 if(val - int_val >= 0.5)
71 {
72 int_val++;
73 }
74 return int_val;
75 }
76
77 inline float t_strtof(const string& str, char** endPtr = nullptr)
78 {
79 return (float)t_strtod(string: str.c_str(), endPtr);
80 }
81
82 inline int baseline_align(int line_height, int line_base_line, int height, int baseline)
83 {
84 return (line_height - line_base_line) - (height - baseline);
85 }
86}
87
88#endif // LH_HTML_H
89

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qttools/src/assistant/qlitehtml/src/3rdparty/litehtml/include/litehtml/html.h