[gtk+/wip/css: 105/154] css: Add _gtk_css_parser_has_prefix()



commit d14696d3b01be1868d18058e98eaba9f00aa317b
Author: Benjamin Otte <otte redhat com>
Date:   Tue Dec 20 08:15:18 2011 +0100

    css: Add _gtk_css_parser_has_prefix()

 gtk/gtkcssparser.c        |    9 +++++++++
 gtk/gtkcssparserprivate.h |    2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssparser.c b/gtk/gtkcssparser.c
index 8867e04..8bdcfc2 100644
--- a/gtk/gtkcssparser.c
+++ b/gtk/gtkcssparser.c
@@ -92,6 +92,15 @@ _gtk_css_parser_begins_with (GtkCssParser *parser,
   return *parser->data == c;
 }
 
+gboolean
+_gtk_css_parser_has_prefix (GtkCssParser *parser,
+                            const char   *prefix)
+{
+  g_return_val_if_fail (GTK_IS_CSS_PARSER (parser), FALSE);
+
+  return g_ascii_strncasecmp (parser->data, prefix, strlen (prefix)) == 0;
+}
+
 guint
 _gtk_css_parser_get_line (GtkCssParser *parser)
 {
diff --git a/gtk/gtkcssparserprivate.h b/gtk/gtkcssparserprivate.h
index dd58fa6..f751b73 100644
--- a/gtk/gtkcssparserprivate.h
+++ b/gtk/gtkcssparserprivate.h
@@ -47,6 +47,8 @@ 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:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]