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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/* GTK - The GIMP Toolkit
* Copyright (C) 2011 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_CSS_PARSER_PRIVATE_H__
#define __GTK_CSS_PARSER_PRIVATE_H__
#include "gtk/gtkcsstypesprivate.h"
#include <gtk/gtksymboliccolor.h>
G_BEGIN_DECLS
typedef enum /*< skip >*/ {
GTK_CSS_POSITIVE_ONLY = (1 << 0),
GTK_CSS_PARSE_PERCENT = (1 << 1),
GTK_CSS_PARSE_NUMBER = (1 << 2),
GTK_CSS_NUMBER_AS_PIXELS = (1 << 3),
GTK_CSS_PARSE_LENGTH = (1 << 4),
GTK_CSS_PARSE_ANGLE = (1 << 5)
} GtkCssNumberParseFlags;
typedef struct _GtkCssParser GtkCssParser;
typedef void (* GtkCssParserErrorFunc) (GtkCssParser *parser,
const GError *error,
gpointer user_data);
GtkCssParser * _gtk_css_parser_new (const char *data,
GtkCssParserErrorFunc error_func,
gpointer user_data);
void _gtk_css_parser_free (GtkCssParser *parser);
void _gtk_css_parser_take_error (GtkCssParser *parser,
GError *error);
void _gtk_css_parser_error (GtkCssParser *parser,
const char *format,
...) G_GNUC_PRINTF (2, 3);
guint _gtk_css_parser_get_line (GtkCssParser *parser);
guint _gtk_css_parser_get_position (GtkCssParser *parser);
gboolean _gtk_css_parser_is_eof (GtkCssParser *parser);
gboolean _gtk_css_parser_begins_with (GtkCssParser *parser,
char c);
gboolean _gtk_css_parser_has_prefix (GtkCssParser *parser,
const char *prefix);
gboolean _gtk_css_parser_is_string (GtkCssParser *parser);
/* IMPORTANT:
* _try_foo() functions do not modify the data pointer if they fail, nor do they
* signal an error. _read_foo() will modify the data pointer and position it at
* the first token that is broken and emit an error about the failure.
* So only call _read_foo() when you know that you are reading a foo. _try_foo()
* however is fine to call if you don't know yet if the token is a foo or a bar,
* you can _try_bar() if try_foo() failed.
*/
gboolean _gtk_css_parser_try (GtkCssParser *parser,
const char *string,
gboolean skip_whitespace);
char * _gtk_css_parser_try_ident (GtkCssParser *parser,
gboolean skip_whitespace);
char * _gtk_css_parser_try_name (GtkCssParser *parser,
gboolean skip_whitespace);
gboolean _gtk_css_parser_try_int (GtkCssParser *parser,
int *value);
gboolean _gtk_css_parser_try_uint (GtkCssParser *parser,
guint *value);
gboolean _gtk_css_parser_try_double (GtkCssParser *parser,
gdouble *value);
gboolean _gtk_css_parser_try_length (GtkCssParser *parser,
int *value);
gboolean _gtk_css_parser_try_enum (GtkCssParser *parser,
GType enum_type,
int *value);
gboolean _gtk_css_parser_has_number (GtkCssParser *parser);
gboolean _gtk_css_parser_read_number (GtkCssParser *parser,
GtkCssNumber *number,
GtkCssNumberParseFlags flags);
char * _gtk_css_parser_read_string (GtkCssParser *parser);
char * _gtk_css_parser_read_value (GtkCssParser *parser);
GtkSymbolicColor *_gtk_css_parser_read_symbolic_color
(GtkCssParser *parser);
GFile * _gtk_css_parser_read_url (GtkCssParser *parser,
GFile *base);
void _gtk_css_parser_skip_whitespace (GtkCssParser *parser);
void _gtk_css_parser_resync (GtkCssParser *parser,
gboolean sync_at_semicolon,
char terminator);
G_END_DECLS
#endif /* __GTK_CSS_PARSER_PRIVATE_H__ */
|