[libvtemm] Changed match_check API.



commit 5176ca8f896dc1bf34b8ac879bb908f817b4c1ab
Author: Krzesimir Nowak <krnowak svn gnome org>
Date:   Tue May 19 17:24:50 2009 +0200

    Changed match_check API.
    
    * src/libvtemm.h: Added '#include <libvtemm/match.h>'.
    * src/libvtemm/Makefile.am: Added match.h and match.cc to
    files_extra.
    * src/libvtemm/g/terminal.ccg:
    * src/libvtemm/g/terminal.hg: Changed prototype and definition of
    match_check method.
    * src/libvtemm/match.cc:
    * src/libvtemm/match.h: New files.
---
 src/libvtemm.h              |    1 +
 src/libvtemm/Makefile.am    |    6 +++-
 src/libvtemm/g/terminal.ccg |    7 +++--
 src/libvtemm/g/terminal.hg  |    4 ++-
 src/libvtemm/match.cc       |   50 +++++++++++++++++++++++++++++++++++
 src/libvtemm/match.h        |   61 +++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 123 insertions(+), 6 deletions(-)

diff --git a/src/libvtemm.h b/src/libvtemm.h
index 7338472..1f23f10 100644
--- a/src/libvtemm.h
+++ b/src/libvtemm.h
@@ -25,6 +25,7 @@
 #include <libvtemm/charattributes.h>
 #include <libvtemm/cursorposition.h>
 #include <libvtemm/init.h>
+#include <libvtemm/match.h>
 #include <libvtemm/padding.h>
 #include <libvtemm/pty.h>
 //#include <libvtemm/reaper.h>
diff --git a/src/libvtemm/Makefile.am b/src/libvtemm/Makefile.am
index 45ac1a8..5b345b0 100644
--- a/src/libvtemm/Makefile.am
+++ b/src/libvtemm/Makefile.am
@@ -3,8 +3,10 @@
 
 SUBDIRS = g private
 
-files_extra_h = cursorposition.h init.h padding.h pty.h textandcharattrs.h wrap_init.h
-files_extra_cc = cursorposition.cc init.cc padding.cc pty.cc textandcharattrs.cc
+files_extra_h = cursorposition.h init.h match.h padding.h pty.h \
+	textandcharattrs.h wrap_init.h
+files_extra_cc = cursorposition.cc init.cc match.cc padding.cc pty.cc \
+	textandcharattrs.cc
 
 include $(top_srcdir)/build_shared/Makefile_shared.am_fragment
 #defined:
diff --git a/src/libvtemm/g/terminal.ccg b/src/libvtemm/g/terminal.ccg
index fa95b5e..bcebc6c 100644
--- a/src/libvtemm/g/terminal.ccg
+++ b/src/libvtemm/g/terminal.ccg
@@ -105,13 +105,14 @@ Terminal::get_cursor_position() const
   return CursorPosition(column, row);
 }
 
-Glib::ustring
-Terminal::match_check(long column, long row, int& tag)
+Match
+Terminal::match_check(long column, long row)
 {
+  int tag = 0;
   char* c_text = vte_terminal_match_check(gobj(), column, row, &tag);
   Glib::ustring text(c_text);
   g_free(c_text);
-  return text;
+  return Match(text, tag);
 }
 
 Padding
diff --git a/src/libvtemm/g/terminal.hg b/src/libvtemm/g/terminal.hg
index d4a32af..84089b1 100644
--- a/src/libvtemm/g/terminal.hg
+++ b/src/libvtemm/g/terminal.hg
@@ -27,6 +27,7 @@ _PINCLUDE(gtkmm/private/widget_p.h)
 #include <glibmm.h>
 #include <gtkmm.h>
 #include <libvtemm/cursorposition.h>
+#include <libvtemm/match.h>
 #include <libvtemm/padding.h>
 #include <libvtemm/textandcharattrs.h>
 #include <pangomm.h>
@@ -183,7 +184,8 @@ public:
   _WRAP_METHOD(void match_remove(int tag), vte_terminal_match_remove)
 
   _WRAP_METHOD_DOCS_ONLY(vte_terminal_match_check)
-  Glib::ustring match_check(long column, long row, int& tag);
+  //Glib::ustring match_check(long column, long row, int& tag);
+  Match match_check(long column, long row);
 
   _WRAP_METHOD(void set_emulation(const Glib::ustring& emulation), vte_terminal_set_emulation)
   _WRAP_METHOD(const Glib::ustring get_emulation() const, vte_terminal_get_emulation)
diff --git a/src/libvtemm/match.cc b/src/libvtemm/match.cc
new file mode 100644
index 0000000..3275889
--- /dev/null
+++ b/src/libvtemm/match.cc
@@ -0,0 +1,50 @@
+/* match.cc
+ *
+ * Copyright (C) 2008, 2009 libvtemm Development Team
+ *
+ * This file is part of libvtemm.
+ *
+ * libvtemm is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * libvtemm 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 Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser Public License
+ * along with libvtemm.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <libvtemm/match.h>
+
+namespace Gnome
+{
+
+namespace Vte
+{
+
+Match::Match(const Glib::ustring& text, int tag)
+:
+  m_text(text),
+  m_tag(tag)
+{}
+
+Match::~Match()
+{}
+
+Glib::ustring Match::get_text() const
+{
+  return m_text;
+}
+
+int Match::get_tag() const
+{
+  return m_tag;
+}
+
+} // namespace Vte
+
+} // namespace Gnome
diff --git a/src/libvtemm/match.h b/src/libvtemm/match.h
new file mode 100644
index 0000000..2bebd7b
--- /dev/null
+++ b/src/libvtemm/match.h
@@ -0,0 +1,61 @@
+/* match.h
+ *
+ * Copyright (C) 2008, 2009 libvtemm Development Team
+ *
+ * This file is part of libvtemm.
+ *
+ * libvtemm is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * libvtemm 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 Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser Public License
+ * along with libvtemm.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _LIBVTEMM_MATCH_H_
+#define _LIBVTEMM_MATCH_H_
+
+#include <glibmm.h>
+
+namespace Gnome
+{
+
+namespace Vte
+{
+/** Match - simple class holding match and tag of matched regular expression.
+ */
+class Match
+{
+public:
+/** The only way to fill #Gnome::Vte::Match class.
+ * @param text A match.
+ * @param tag Tag of matched expression.
+ */
+  Match(const Glib::ustring& text, int tag);
+  virtual ~Match();
+
+/** Gets match.
+ * @return Match.
+ */
+  Glib::ustring get_text() const;
+
+/** Gets tag.
+ * @return Tag.
+ */
+  int get_tag() const;
+private:
+  Glib::ustring m_text;
+  int m_tag;
+};
+
+} // namespace Vte
+
+} // namespace Gnome
+
+#endif // _LIBVTEMM_MATCH_H_



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