~ubuntu-branches/ubuntu/wily/csstidy/wily

« back to all changes in this revision

Viewing changes to csstidy.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Kevin Coyner
  • Date: 2008-02-24 20:52:52 UTC
  • mfrom: (2.1.1 hardy)
  • Revision ID: james.westby@ubuntu.com-20080224205252-i9t0wyrnjeedczz2
Tags: 1.4-3
* Add patch gcc43fix which contains an uncaught missing include in
  csstidy/misc.cpp. Closes: #455123.
* Bumped Standards-Version to 3.7.3. No changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This file is part of CSSTidy.
3
 
 *
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.
8
 
 *
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.
13
 
 *
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
17
 
 */
18
 
 
19
 
#ifndef HEADER_CSSTIDY
20
 
#define HEADER_CSSTIDY 
21
 
 
22
 
class csstidy 
23
 
24
 
        public: 
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;
30
 
        
31
 
        private:
32
 
                css_struct    css;
33
 
                vector<token> csstokens;
34
 
                string        tokens, cur_selector, cur_at, cur_property, cur_sub_value, cur_value;
35
 
                int           line;
36
 
                vector<int>   sel_separate;
37
 
 
38
 
                void add_token(const token_type ttype, const string data, const bool force = false);
39
 
                void _convert_raw_css();
40
 
                
41
 
                // Add a message to the message log
42
 
                void log(const string msg, const message_type type, int iline = 0);
43
 
                
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();
48
 
                
49
 
                // Parses unicode notations
50
 
                string unicode(string& istring,int& i);
51
 
                
52
 
                // Checks if the chat in istring at i is a token
53
 
                bool is_token(string& istring,const int i);
54
 
                                                
55
 
        public:
56
 
            csstidy();
57
 
                
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);
61
 
        
62
 
                // Prints CSS code
63
 
                void print_css(string filename = "");
64
 
                
65
 
                // Parse a piece of CSS code
66
 
                void parse_css(string css_input);
67
 
                
68
 
                /* Merges properties like margin */
69
 
                void merge_4value_shorthands(string media, string selector);
70
 
                
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);
73
 
};
74
 
            
75
 
#endif // HEADER_CSSTIDY