Menu

[r29]: / trunk-cpp / css_manage.hpp  Maximize  Restore  History

Download this file

75 lines (60 with data), 2.9 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* This file is part of CSSTidy.
*
* CSSTidy is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* CSSTidy is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CSSTidy; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef HEADER_CSS_MANAGE
#define HEADER_CSS_MANAGE
extern map<string,bool> settings;
extern map< string, vector<string> > shorthands;
class css_manage
{
public:
css_struct css;
int properties,selectors,input_size,output_size;
string charset,namesp;
vector<string> import;
map<int, vector<message> > logs;
vector<token> csstokens;
private:
string tokens;
int line;
public:
css_manage();
// Various function to manage the CSS structure
void add(const string &media, const string &selector, const string property, const string value);
void set(string& media, string& selector, string& property, string& value) ;
void remove(const string media,const string selector,const string property);
void copy(const string media, const string selector, const string media_new, const string selector_new);
string get(string media, string selector, string property);
void remove(const string media,const string selector);
void add_token(const token_type ttype, const string data, const bool force = false);
// Adds a property-value pair to an existing property-block. ie=false forces deactivation of IE-Hacks
void css_add_property(const string& media, const string& selector, const string& property, const string& value);
// Add a message to the message log
void log(const string msg, const message_type type, int iline = 0);
// Parse a piece of CSS code
void parse_css(string css_input);
string optimise_subvalue(string subvalue, const string property);
// Checks if the chat in istring at i is a token
bool is_token(string& istring,const int i);
// Parses unicode notations
string unicode(string& istring,int& i);
/* Merges properties like margin */
void merge_4value_shorthands(string media, string selector);
/* Dissolves properties like padding:10px 10px 10px to padding-top:10px;padding-bottom:10px;... */
map<string,string> dissolve_4value_shorthands(string property, string value);
};
#endif // HEADER_CSS_MANAGE
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.