[gtksourceviewmm/devel] Fix wrapping SearchFlags enum.



commit 65a8611821da55381651ed681e8c2a7877f6de36
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Mon Jan 11 10:02:44 2010 +0100

    Fix wrapping SearchFlags enum.
    
    * gtksourceview/src/sourceiter.ccg:
    * gtksourceview/src/sourceiter.hg: Fix SearchFlags for backward
    compatibility - its values does not have SOURCE_ prefix. Deprecated
    SearchFlags in favor of SourceSearchFlags. Deprecated methods
    using deprecated enum and written new.

 gtksourceview/src/sourceiter.ccg |   29 ++++++++++++++++++++++---
 gtksourceview/src/sourceiter.hg  |   43 ++++++++++++++++++++++++++++++++++---
 2 files changed, 64 insertions(+), 8 deletions(-)
---
diff --git a/gtksourceview/src/sourceiter.ccg b/gtksourceview/src/sourceiter.ccg
index 02f9359..1f26ac4 100644
--- a/gtksourceview/src/sourceiter.ccg
+++ b/gtksourceview/src/sourceiter.ccg
@@ -51,7 +51,7 @@ SourceIter::~SourceIter ()
 {
 }
 
-
+#ifndef GTKSOURCEVIEWMM_DISABLE_DEPRECATED
 bool
 SourceIter::forward_search (const Glib::ustring &a_str,
                             SearchFlags a_flags,
@@ -59,6 +59,27 @@ SourceIter::forward_search (const Glib::ustring &a_str,
                             Gtk::TextIter &a_match_end,
                             const Gtk::TextIter &a_limit) const
 {
+    return forward_search (a_str, static_cast<SourceSearchFlags>(a_flags), a_match_start, a_match_end, a_limit);
+}
+
+bool
+SourceIter::backward_search (const Glib::ustring &a_str,
+                              SearchFlags a_flags,
+                              Gtk::TextIter &a_match_start,
+                              Gtk::TextIter &a_match_end,
+                              const Gtk::TextIter &a_limit) const
+{
+    return backward_search (a_str, static_cast<SourceSearchFlags>(a_flags), a_match_start, a_match_end, a_limit);
+}
+#endif // GTKSOURCEVIEWMM_DISABLE_DEPRECATED
+
+bool
+SourceIter::forward_search (const Glib::ustring &a_str,
+                            SourceSearchFlags a_flags,
+                            Gtk::TextIter &a_match_start,
+                            Gtk::TextIter &a_match_end,
+                            const Gtk::TextIter &a_limit) const
+{
     const GtkTextIter *gobject (gobj ()) ;
     g_return_val_if_fail (gobject, FALSE) ;
     g_return_val_if_fail (a_str.c_str (), FALSE) ;
@@ -66,7 +87,7 @@ SourceIter::forward_search (const Glib::ustring &a_str,
     GtkTextIter match_start, match_end ;
     gboolean res = gtk_source_iter_forward_search (gobject,
                                                    a_str.c_str (),
-                                                   (GtkSourceSearchFlags)a_flags,
+                                                   static_cast<GtkSourceSearchFlags>(a_flags),
                                                    &match_start,
                                                    &match_end,
                                                    a_limit.gobj ()) ;
@@ -79,7 +100,7 @@ SourceIter::forward_search (const Glib::ustring &a_str,
 
 bool
 SourceIter::backward_search (const Glib::ustring &a_str,
-                              SearchFlags a_flags,
+                              SourceSearchFlags a_flags,
                               Gtk::TextIter &a_match_start,
                               Gtk::TextIter &a_match_end,
                               const Gtk::TextIter &a_limit) const
@@ -91,7 +112,7 @@ SourceIter::backward_search (const Glib::ustring &a_str,
     GtkTextIter match_start, match_end ;
     gboolean res = gtk_source_iter_backward_search (gobject,
                                                     a_str.c_str (),
-                                                    (GtkSourceSearchFlags)a_flags,
+                                                    static_cast<GtkSourceSearchFlags>(a_flags),
                                                     &match_start,
                                                     &match_end,
                                                     a_limit.gobj ()) ;
diff --git a/gtksourceview/src/sourceiter.hg b/gtksourceview/src/sourceiter.hg
index 5f6c05e..2d1d8d8 100644
--- a/gtksourceview/src/sourceiter.hg
+++ b/gtksourceview/src/sourceiter.hg
@@ -30,9 +30,10 @@ _CC_INCLUDE(gtksourceview/gtksourceiter.h)
 namespace gtksourceview
 {
 
-// TODO: rename all SearchFlags into SourceSearchFlags and remove the typedef when breaking API/ABI.
+#ifndef GTKSOURCEVIEWMM_DISABLE_DEPRECATED
+  _WRAP_ENUM(SearchFlags, GtkSourceSearchFlags, s#^SOURCE_##)
+#endif // GTKSOURCEVIEWMM_DISABLE_DEPRECATED
   _WRAP_ENUM(SourceSearchFlags, GtkSourceSearchFlags)
-  typedef SourceSearchFlags SearchFlags;
 
 /// \brief an iterator type for gtksourceview::SourceBuffer.
 ///
@@ -51,8 +52,7 @@ class SourceIter : public Gtk::TextIter
 
         ~SourceIter () ;
 
-
-
+#ifndef GTKSOURCEVIEWMM_DISABLE_DEPRECATED
         /// \brief search forward in the buffer
         ///
         /// \param a_str the string to search for
@@ -86,6 +86,41 @@ class SourceIter : public Gtk::TextIter
                               Gtk::TextIter &a_match_start,
                               Gtk::TextIter &a_match_end,
                               const Gtk::TextIter &a_limit) const ;
+#endif // GTKSOURCEVIEWMM_DISABLE_DEPRECATED
+
+        /// \brief search forward in the buffer
+        ///
+        /// \param a_str the string to search for
+        /// \param a_flags search flags, to be combined with the '|' operator
+        /// \param a_match_start out parameter. Points the the beginning
+        ///        of the region that matches the search. This is applicable
+        ///        if and only if the function returns true.
+        /// \param a_match_end out parameter.  Points the the end
+        ///        of the region that matches the search. This is applicable
+        ///        if and only if the function returns true.
+        /// \return true if the search was successful, false otherwise.
+        bool forward_search (const Glib::ustring &a_str,
+                             SourceSearchFlags a_flags,
+                             Gtk::TextIter &a_match_start,
+                             Gtk::TextIter &a_match_end,
+                             const Gtk::TextIter &a_limit) const ;
+
+        /// \brief search backward in the buffer
+        ///
+        /// \param a_str the string to search for
+        /// \param a_flags search flags, to be combined with the '|' operator
+        /// \param a_match_start out parameter. Points the the beginning
+        ///        of the region that matches the search. This is applicable
+        ///        if and only if the function returns true.
+        /// \param a_match_end out parameter.  Points the the end
+        ///        of the region that matches the search. This is applicable
+        ///         if and only if the function returns true.
+        /// \return true if the search was successful, false otherwise.
+        bool backward_search (const Glib::ustring &a_str,
+                              SourceSearchFlags a_flags,
+                              Gtk::TextIter &a_match_start,
+                              Gtk::TextIter &a_match_end,
+                              const Gtk::TextIter &a_limit) const ;
 
 };//end class SourceIter
 



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