~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to src/dom/cssreader.h

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Ted Gould, Kees Cook
  • Date: 2009-06-24 14:00:43 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090624140043-07stp20mry48hqup
Tags: 0.47~pre0-0ubuntu1
* New upstream release

[ Ted Gould ]
* debian/control: Adding libgsl0 and removing version specifics on boost

[ Kees Cook ]
* debian/watch: updated to run uupdate and mangle pre-release versions.
* Dropped patches that have been taken upstream:
  - 01_mips
  - 02-poppler-0.8.3
  - 03-chinese-inkscape
  - 05_fix_latex_patch
  - 06_gcc-4.4
  - 07_cdr2svg
  - 08_skip-bad-utf-on-pdf-import
  - 09_gtk-clist
  - 10_belarussian
  - 11_libpng
  - 12_desktop
  - 13_slider
  - 100_svg_import_improvements
  - 102_sp_pattern_painter_free
  - 103_bitmap_type_print

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __CSSREADER_H__
 
2
#define __CSSREADER_H__
 
3
/**
 
4
 * Phoebe DOM Implementation.
 
5
 *
 
6
 * This is a C++ approximation of the W3C DOM model, which follows
 
7
 * fairly closely the specifications in the various .idl files, copies of
 
8
 * which are provided for reference.  Most important is this one:
 
9
 *
 
10
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
 
11
 *
 
12
 * Authors:
 
13
 *   Bob Jamison
 
14
 *
 
15
 * Copyright (C) 2005-2008 Bob Jamison
 
16
 *
 
17
 *  This library is free software; you can redistribute it and/or
 
18
 *  modify it under the terms of the GNU Lesser General Public
 
19
 *  License as published by the Free Software Foundation; either
 
20
 *  version 2.1 of the License, or (at your option) any later version.
 
21
 *
 
22
 *  This library is distributed in the hope that it will be useful,
 
23
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
24
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
25
 *  Lesser General Public License for more details.
 
26
 *
 
27
 *  You should have received a copy of the GNU Lesser General Public
 
28
 *  License along with this library; if not, write to the Free Software
 
29
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
30
 */
 
31
 
 
32
 
 
33
#include "dom.h"
 
34
 
 
35
#include "css.h"
 
36
 
 
37
namespace org
 
38
{
 
39
namespace w3c
 
40
{
 
41
namespace dom
 
42
{
 
43
namespace css
 
44
{
 
45
 
 
46
class CssReader
 
47
{
 
48
 
 
49
public:
 
50
 
 
51
    /**
 
52
     *
 
53
     */
 
54
    CssReader()
 
55
        {}
 
56
 
 
57
    /**
 
58
     *
 
59
     */
 
60
    virtual ~CssReader()
 
61
        {}
 
62
 
 
63
    /**
 
64
     *
 
65
     */
 
66
    virtual bool parse(const DOMString &str);
 
67
 
 
68
    /**
 
69
     *
 
70
     */
 
71
    virtual bool parseFile(const DOMString &str);
 
72
 
 
73
 
 
74
private:
 
75
 
 
76
    DOMString parsebuf;
 
77
    long parselen;
 
78
    CSSStyleSheet stylesheet;
 
79
 
 
80
 
 
81
    /**
 
82
     *
 
83
     */
 
84
    void error(char const *fmt, ...)
 
85
    #ifdef G_GNUC_PRINTF
 
86
    G_GNUC_PRINTF(2, 3)
 
87
    #endif
 
88
    ;
 
89
 
 
90
    /**
 
91
     * Get the character at the given location in the buffer.
 
92
     *  Return 0 if out-of-bounds
 
93
     */
 
94
    XMLCh get(int index);
 
95
 
 
96
 
 
97
    /**
 
98
     *  Test if the given substring exists at the given position
 
99
     *  in parsebuf.  Use get() in case of out-of-bounds
 
100
     */
 
101
    bool match(int pos, const char *str);
 
102
 
 
103
    /**
 
104
     * Skip over whitespace
 
105
     * Return new position
 
106
     */
 
107
    int skipwhite(int index);
 
108
 
 
109
    /**
 
110
     * Get the word at the current position.  Return the new
 
111
     * position if successful, the current position if no word,
 
112
     * -1 if error.
 
113
     */
 
114
    int getWord(int index, DOMString &str);
 
115
 
 
116
 
 
117
    /**
 
118
     * Get a number at the current position
 
119
     * Return the new position if a proper number, else the original pos
 
120
     */
 
121
    int getNumber(int index, double &result);
 
122
 
 
123
    /**
 
124
     * Assume that we are starting on a quote.  Ends on the char
 
125
     * after the final '"'
 
126
     */
 
127
    int getQuoted(int p0, DOMString &result);
 
128
 
 
129
/**
 
130
 * Not in api.  replaces URI return by lexer
 
131
 */
 
132
int getUri(int p0, DOMString &str);
 
133
 
 
134
 
 
135
/**
 
136
 * Skip to the next rule
 
137
 */
 
138
int skipBlock(int p0);
 
139
 
 
140
//#########################################################################
 
141
//# P R O D U C T I O N S
 
142
//#########################################################################
 
143
 
 
144
/**
 
145
 * stylesheet
 
146
 *   : [ CHARSET_SYM S* STRING S* ';' ]?
 
147
 *     [S|CDO|CDC]* [ import [S|CDO|CDC]* ]*
 
148
 *     [ [ ruleset | media | page ] [S|CDO|CDC]* ]*
 
149
 *   ;
 
150
 */
 
151
int getStyleSheet(int p0);
 
152
 
 
153
/**
 
154
 * import
 
155
 *   : IMPORT_SYM S*
 
156
 *     [STRING|URI] S* [ medium [ COMMA S* medium]* ]? ';' S*
 
157
 *   ;
 
158
 */
 
159
int getImport(int p0);
 
160
 
 
161
/**
 
162
 * media
 
163
 *   : MEDIA_SYM S* medium [ COMMA S* medium ]* LBRACE S* ruleset* '}' S*
 
164
 *   ;
 
165
 */
 
166
int getMedia(int p0);
 
167
 
 
168
/**
 
169
 * medium
 
170
 *   : IDENT S*
 
171
 *   ;
 
172
 */
 
173
int getMedium(int p0);
 
174
 
 
175
/**
 
176
 * page
 
177
 *   : PAGE_SYM S* pseudo_page? S*
 
178
 *     LBRACE S* declaration [ ';' S* declaration ]* '}' S*
 
179
 *   ;
 
180
 */
 
181
int getPage(int p0);
 
182
 
 
183
/**
 
184
 * pseudo_page
 
185
 *   : ':' IDENT
 
186
 *   ;
 
187
 */
 
188
int getPseudoPage(int p0);
 
189
 
 
190
/**
 
191
 * ruleset
 
192
 *   : selector [ COMMA S* selector ]*
 
193
 *     LBRACE S* declaration [ ';' S* declaration ]* '}' S*
 
194
 *   ;
 
195
 */
 
196
int getRuleSet(int p0);
 
197
 
 
198
/**
 
199
 * selector
 
200
 *   : simple_selector [ combinator simple_selector ]*
 
201
 *   ;
 
202
 */
 
203
int getSelector(int p0);
 
204
 
 
205
/**
 
206
 * simple_selector
 
207
 *   : element_name [ HASH | class | attrib | pseudo ]*
 
208
 *   | [ HASH | class | attrib | pseudo ]+
 
209
 *   ;
 
210
 */
 
211
int getSimpleSelector(int p0);
 
212
 
 
213
/**
 
214
 * declaration
 
215
 *   : property ':' S* expr prio?
 
216
 *   | {empty}
 
217
 *   ;
 
218
 */
 
219
int getDeclaration(int p0, CSSStyleDeclaration &declarationList);
 
220
 
 
221
/**
 
222
 * prio
 
223
 *   : IMPORTANT_SYM S*
 
224
 *   ;
 
225
 */
 
226
int getPrio(int p0, DOMString &val);
 
227
 
 
228
/**
 
229
 * expr
 
230
 *   : term [ operator term ]*
 
231
 *   ;
 
232
 */
 
233
int getExpr(int p0);
 
234
 
 
235
/**
 
236
 * term
 
237
 *   : unary_operator?
 
238
 *     [ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* | ANGLE S* |
 
239
 *       TIME S* | FREQ S* | function ]
 
240
 *   | STRING S* | IDENT S* | URI S* | hexcolor
 
241
 *   ;
 
242
 */
 
243
int getTerm(int p0);
 
244
 
 
245
/**
 
246
 * function
 
247
 *   : FUNCTION S* expr ')' S*
 
248
 *   ;
 
249
 */
 
250
int getFunction(int p0);
 
251
 
 
252
/**
 
253
 * There is a constraint on the color that it must
 
254
 * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F])
 
255
 * after the "#"; e.g., "#000" is OK, but "#abcd" is not.
 
256
 *
 
257
 * hexcolor
 
258
 *   : HASH S*
 
259
 *   ;
 
260
 */
 
261
int getHexColor(int p0);
 
262
 
 
263
 
 
264
int lastPosition;
 
265
 
 
266
/**
 
267
 * Get the column and row number of the given character position.
 
268
 * Also gets the last-occuring newline before the position
 
269
 */
 
270
void getColumnAndRow(int p, int &col, int &row, int &lastNL);
 
271
 
 
272
};
 
273
 
 
274
 
 
275
} // namespace css
 
276
} // namespace dom
 
277
} // namespace w3c
 
278
} // namespace org
 
279
 
 
280
 
 
281
 
 
282
 
 
283
 
 
284
 
 
285
 
 
286
#endif /* __CSSREADER_H__ */
 
287
//#########################################################################
 
288
//# E N D    O F    F I L E
 
289
//#########################################################################
 
290