Add g_regex_get_max_backref() and g_regex_get_capture_count(). (#419371,
authorMatthias Clasen <mclasen@redhat.com>
Mon, 30 Apr 2007 16:37:38 +0000 (16:37 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 30 Apr 2007 16:37:38 +0000 (16:37 +0000)
2007-04-30  Matthias Clasen  <mclasen@redhat.com>

        * glib/glib.symbols:
        * glib/gregex.[hc]: Add g_regex_get_max_backref() and
        g_regex_get_capture_count().  (#419371, Marco Barisione)

svn path=/trunk/; revision=5469

ChangeLog
docs/reference/ChangeLog
docs/reference/glib/glib-sections.txt
glib/glib.symbols
glib/gregex.c
glib/gregex.h

index 36f9958..9a013e0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2007-04-30  Matthias Clasen  <mclasen@redhat.com>
 
        * glib/glib.symbols:
+       * glib/gregex.[hc]: Add g_regex_get_max_backref() and
+       g_regex_get_capture_count().  (#419371, Marco Barisione)
+       
+2007-04-30  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/glib.symbols:
        * glib/gregex.[hc]: Split GRegex into GRegex and GMatchInfo.
        (#419368, Marco Barisione)
 
index 7633c90..176d959 100644 (file)
@@ -1,5 +1,9 @@
 2007-04-30  Matthias Clasen  <mclasen@redhat.com>
 
+       * glib/glib-sections.txt: Add new regex functions
+
+2007-04-30  Matthias Clasen  <mclasen@redhat.com>
+
        * glib/glib-sections.txt: 
        * glib/tmpl/gregex.sgml: Update for the GRegex/GMatchInfo
        split.
index 4aa8656..6e79a9c 100644 (file)
@@ -875,6 +875,8 @@ GRegexEvalCallback
 g_regex_new
 g_regex_free
 g_regex_get_pattern
+g_regex_get_max_backref
+g_regex_get_capture_count
 g_regex_get_string_number
 g_regex_escape_string
 g_regex_match_simple
index 89da36c..7813c00 100644 (file)
@@ -1425,6 +1425,8 @@ g_regex_error_quark
 g_regex_new
 g_regex_free
 g_regex_get_pattern
+g_regex_get_max_backref
+g_regex_get_capture_count
 g_regex_get_string_number
 g_regex_escape_string
 g_regex_match_simple
index 756c1a1..0308574 100644 (file)
@@ -874,6 +874,50 @@ g_regex_get_pattern (const GRegex *regex)
 }
 
 /**
+ * g_regex_get_max_backref:
+ * @regex: a #GRegex
+ *  
+ * Returns the number of the highest back reference
+ * in the pattern, or 0 if the pattern does not contain
+ * back references.
+ *
+ * Returns: the number of the highest back reference.
+ *
+ * Since: 2.14
+ */
+gint
+g_regex_get_max_backref (const GRegex *regex)
+{
+  gint value;
+
+  pcre_fullinfo (regex->pcre_re, regex->extra,
+                PCRE_INFO_BACKREFMAX, &value);
+
+  return value;
+}
+
+/**
+ * g_regex_get_capture_count:
+ * @regex: a #GRegex
+ *
+ * Returns the number of capturing subpatterns in the pattern.
+ *
+ * Returns: the number of capturing subpatterns.
+ *
+ * Since: 2.14
+ */
+gint
+g_regex_get_capture_count (const GRegex *regex)
+{
+  gint value;
+
+  pcre_fullinfo (regex->pcre_re, regex->extra,
+                PCRE_INFO_CAPTURECOUNT, &value);
+
+  return value;
+}
+
+/**
  * g_regex_match_simple:
  * @pattern: the regular expression
  * @string: the string to scan for matches
index 5d4eaaa..3807ece 100644 (file)
@@ -90,6 +90,8 @@ GRegex                 *g_regex_new                   (const gchar         *pattern,
                                                 GError             **error);
 void             g_regex_free                  (GRegex              *regex);
 const gchar     *g_regex_get_pattern           (const GRegex        *regex);
+gint             g_regex_get_max_backref       (const GRegex        *regex);
+gint             g_regex_get_capture_count     (const GRegex        *regex);
 gint             g_regex_get_string_number     (const GRegex        *regex, 
                                                 const gchar         *name);
 gchar           *g_regex_escape_string         (const gchar         *string,