2
* This file is part of CSSTidy.
4
* CSSTidy is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* CSSTidy is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with CSSTidy; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
#ifndef HEADER_CSSTIDY
20
#define HEADER_CSSTIDY
25
int properties,selectors,input_size,output_size;
26
string charset,namesp, css_level;
27
vector<string> import, csstemplate;
28
map<int, vector<message> > logs;
29
map<string, int> settings;
33
vector<token> csstokens;
34
string tokens, cur_selector, cur_at, cur_property, cur_sub_value, cur_value;
36
vector<int> sel_separate;
38
void add_token(const token_type ttype, const string data, const bool force = false);
39
void _convert_raw_css();
41
// Add a message to the message log
42
void log(const string msg, const message_type type, int iline = 0);
44
int _seeknocomment(const int key, const int move);
45
string _htmlsp(const string istring, const bool plain);
46
string optimise_subvalue(string subvalue, const string property);
47
void explode_selectors();
49
// Parses unicode notations
50
string unicode(string& istring,int& i);
52
// Checks if the chat in istring at i is a token
53
bool is_token(string& istring,const int i);
58
// Adds a property-value pair to an existing CSS structure
59
void add(const string& media, const string& selector, const string& property, const string& value);
60
void copy(const string media, const string selector, const string media_new, const string selector_new);
63
void print_css(string filename = "");
65
// Parse a piece of CSS code
66
void parse_css(string css_input);
68
/* Merges properties like margin */
69
void merge_4value_shorthands(string media, string selector);
71
/* Dissolves properties like padding:10px 10px 10px to padding-top:10px;padding-bottom:10px;... */
72
map<string,string> dissolve_4value_shorthands(string property, string value);
75
#endif // HEADER_CSSTIDY