2011-04-14 02:47:18 +00:00
|
|
|
|
/* 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
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2011-04-14 02:47:18 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __GTK_CSS_PARSER_PRIVATE_H__
|
|
|
|
|
#define __GTK_CSS_PARSER_PRIVATE_H__
|
|
|
|
|
|
2012-03-26 16:36:20 +00:00
|
|
|
|
#include <gtk/gtkcssprovider.h>
|
2011-04-14 02:47:18 +00:00
|
|
|
|
|
2019-03-22 03:20:17 +00:00
|
|
|
|
#include <gtk/css/gtkcss.h>
|
2019-03-23 17:21:59 +00:00
|
|
|
|
#include "gtk/css/gtkcsstokenizerprivate.h"
|
2019-03-22 03:20:17 +00:00
|
|
|
|
|
2011-04-14 02:47:18 +00:00
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
|
typedef struct _GtkCssParser GtkCssParser;
|
|
|
|
|
|
|
|
|
|
typedef void (* GtkCssParserErrorFunc) (GtkCssParser *parser,
|
|
|
|
|
const GError *error,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
2019-03-30 11:04:51 +00:00
|
|
|
|
typedef struct _GtkCssParseOption GtkCssParseOption;
|
|
|
|
|
|
|
|
|
|
struct _GtkCssParseOption
|
|
|
|
|
{
|
|
|
|
|
gboolean (* can_parse) (GtkCssParser *parser,
|
|
|
|
|
gpointer option_data,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
gboolean (* parse) (GtkCssParser *parser,
|
|
|
|
|
gpointer option_data,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
gpointer data;
|
|
|
|
|
};
|
|
|
|
|
|
2011-04-14 02:47:18 +00:00
|
|
|
|
GtkCssParser * _gtk_css_parser_new (const char *data,
|
2012-04-18 14:54:04 +00:00
|
|
|
|
GFile *file,
|
2011-04-14 02:47:18 +00:00
|
|
|
|
GtkCssParserErrorFunc error_func,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
void _gtk_css_parser_free (GtkCssParser *parser);
|
|
|
|
|
|
2011-05-18 16:32:22 +00:00
|
|
|
|
void _gtk_css_parser_take_error (GtkCssParser *parser,
|
|
|
|
|
GError *error);
|
2011-04-14 02:47:18 +00:00
|
|
|
|
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);
|
2012-04-18 17:43:24 +00:00
|
|
|
|
GFile * _gtk_css_parser_get_file (GtkCssParser *parser);
|
2019-04-09 00:15:12 +00:00
|
|
|
|
GFile * gtk_css_parser_resolve_url (GtkCssParser *parser,
|
|
|
|
|
const char *url);
|
2011-04-14 02:47:18 +00:00
|
|
|
|
|
2019-03-23 17:21:59 +00:00
|
|
|
|
gboolean gtk_css_parser_has_token (GtkCssParser *parser,
|
|
|
|
|
GtkCssTokenType token_type);
|
2019-04-01 09:47:53 +00:00
|
|
|
|
gboolean gtk_css_parser_has_ident (GtkCssParser *parser,
|
|
|
|
|
const char *name);
|
2019-04-05 11:41:08 +00:00
|
|
|
|
gboolean gtk_css_parser_has_integer (GtkCssParser *parser);
|
2019-03-24 13:03:52 +00:00
|
|
|
|
gboolean gtk_css_parser_has_function (GtkCssParser *parser,
|
|
|
|
|
const char *name);
|
2011-04-14 02:47:18 +00:00
|
|
|
|
|
|
|
|
|
/* 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()
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* however is fine to call if you don’t know yet if the token is a foo or a bar,
|
2011-04-14 02:47:18 +00:00
|
|
|
|
* you can _try_bar() if try_foo() failed.
|
|
|
|
|
*/
|
2019-03-24 13:03:52 +00:00
|
|
|
|
gboolean gtk_css_parser_try_ident (GtkCssParser *parser,
|
|
|
|
|
const char *ident);
|
2019-04-05 00:57:14 +00:00
|
|
|
|
gboolean gtk_css_parser_try_delim (GtkCssParser *parser,
|
|
|
|
|
gunichar delim);
|
2019-04-01 22:21:02 +00:00
|
|
|
|
gboolean gtk_css_parser_try_at_keyword (GtkCssParser *parser,
|
|
|
|
|
const char *keyword);
|
2019-03-24 13:36:55 +00:00
|
|
|
|
gboolean gtk_css_parser_try_token (GtkCssParser *parser,
|
|
|
|
|
GtkCssTokenType token_type);
|
2019-03-22 16:37:04 +00:00
|
|
|
|
gboolean _gtk_css_parser_try (GtkCssParser *parser,
|
2011-04-14 02:47:18 +00:00
|
|
|
|
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);
|
2012-04-05 19:09:35 +00:00
|
|
|
|
gboolean _gtk_css_parser_try_hash_color (GtkCssParser *parser,
|
|
|
|
|
GdkRGBA *rgba);
|
2011-04-14 02:47:18 +00:00
|
|
|
|
|
2019-03-31 10:40:53 +00:00
|
|
|
|
char * gtk_css_parser_consume_ident (GtkCssParser *self);
|
2019-04-04 21:37:38 +00:00
|
|
|
|
char * gtk_css_parser_consume_string (GtkCssParser *self);
|
2019-04-09 00:29:27 +00:00
|
|
|
|
GFile * gtk_css_parser_consume_url (GtkCssParser *self);
|
2019-03-24 20:11:53 +00:00
|
|
|
|
gboolean gtk_css_parser_consume_number (GtkCssParser *self,
|
|
|
|
|
double *number);
|
2019-04-05 11:41:08 +00:00
|
|
|
|
gboolean gtk_css_parser_consume_integer (GtkCssParser *parser,
|
|
|
|
|
int *value);
|
2019-03-24 20:11:53 +00:00
|
|
|
|
gboolean gtk_css_parser_consume_function (GtkCssParser *self,
|
|
|
|
|
guint min_args,
|
|
|
|
|
guint max_args,
|
|
|
|
|
guint (* parse_func) (GtkCssParser *, guint, gpointer),
|
|
|
|
|
gpointer data);
|
2019-03-30 11:04:51 +00:00
|
|
|
|
gsize gtk_css_parser_consume_any (GtkCssParser *parser,
|
|
|
|
|
const GtkCssParseOption *options,
|
|
|
|
|
gsize n_options,
|
|
|
|
|
gpointer user_data);
|
2019-03-24 20:11:53 +00:00
|
|
|
|
|
2012-01-13 22:48:42 +00:00
|
|
|
|
gboolean _gtk_css_parser_has_number (GtkCssParser *parser);
|
2011-04-14 02:47:18 +00:00
|
|
|
|
|
2012-01-13 22:48:42 +00:00
|
|
|
|
void _gtk_css_parser_skip_whitespace (GtkCssParser *parser);
|
2011-04-14 02:47:18 +00:00
|
|
|
|
void _gtk_css_parser_resync (GtkCssParser *parser,
|
|
|
|
|
gboolean sync_at_semicolon,
|
|
|
|
|
char terminator);
|
|
|
|
|
|
2014-05-01 17:47:58 +00:00
|
|
|
|
/* XXX: Find better place to put it? */
|
|
|
|
|
void _gtk_css_print_string (GString *str,
|
|
|
|
|
const char *string);
|
|
|
|
|
|
|
|
|
|
|
2011-04-14 02:47:18 +00:00
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
|
|
#endif /* __GTK_CSS_PARSER_PRIVATE_H__ */
|