[pangomm/vector] Adapt Pango to vector utils.



commit b131bdd1c5b9810a248024cdbad3424d7c4342e2
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Sat Jan 22 20:05:31 2011 +0100

    Adapt Pango to vector utils.

 configure.ac              |    2 +-
 pango/src/attributes.hg   |    2 --
 pango/src/attriter.ccg    |    8 ++++----
 pango/src/attriter.hg     |    5 ++---
 pango/src/context.ccg     |   14 ++++++++------
 pango/src/context.hg      |   11 +++++------
 pango/src/coverage.ccg    |    6 ++++--
 pango/src/coverage.hg     |    5 +++--
 pango/src/fontface.ccg    |    7 ++-----
 pango/src/fontface.hg     |    2 +-
 pango/src/fontfamily.ccg  |    4 ++--
 pango/src/fontfamily.hg   |    8 +++++---
 pango/src/fontmap.ccg     |    9 ++++++---
 pango/src/fontmap.hg      |    8 +++++---
 pango/src/glyphstring.ccg |   10 ++++++----
 pango/src/glyphstring.hg  |   14 +++++++++-----
 pango/src/item.ccg        |    6 ++++--
 pango/src/item.hg         |   11 ++++++-----
 pango/src/language.ccg    |    6 ++++--
 pango/src/language.hg     |    4 +++-
 pango/src/layout.ccg      |    4 ++--
 pango/src/layout.hg       |    9 +++++----
 pango/src/layoutline.ccg  |    9 ++++++---
 pango/src/layoutline.hg   |    8 +++-----
 pango/src/tabarray.ccg    |    6 ++++--
 pango/src/tabarray.hg     |    9 ++++++---
 26 files changed, 106 insertions(+), 81 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9ea1b06..aa8c29f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,7 @@ AC_DISABLE_STATIC
 AC_LIBTOOL_WIN32_DLL
 AC_PROG_LIBTOOL
 
-AC_SUBST([PANGOMM_MODULES], ['glibmm-2.4 >= 2.14.1 cairomm-1.0 >= 1.2.2 pangocairo >= 1.23.0'])
+AC_SUBST([PANGOMM_MODULES], ['glibmm-2.4 >= 2.27.91.1 cairomm-1.0 >= 1.2.2 pangocairo >= 1.23.0'])
 PKG_CHECK_MODULES([PANGOMM], [$PANGOMM_MODULES])
 
 MM_PKG_CONFIG_SUBST([GTHREAD_CFLAGS], [--cflags-only-other gthread-2.0])
diff --git a/pango/src/attributes.hg b/pango/src/attributes.hg
index 14ff1db..25a11ba 100644
--- a/pango/src/attributes.hg
+++ b/pango/src/attributes.hg
@@ -472,8 +472,6 @@ struct AttributeTraits
   static void    release_c_type (CType ptr) { pango_attribute_destroy(const_cast<CTypeNonConst>(ptr)); }
 };
 
-typedef Glib::SListHandle<Attribute, AttributeTraits> SListHandle_Attribute;
-
 } // namespace Pango
 
 
diff --git a/pango/src/attriter.ccg b/pango/src/attriter.ccg
index 78d103a..ea02ad5 100644
--- a/pango/src/attriter.ccg
+++ b/pango/src/attriter.ccg
@@ -119,20 +119,20 @@ Language AttrIter::get_language() const
   return Language(language, true);
 }
 
-SListHandle_Attribute AttrIter::get_extra_attrs() const
+std::vector<Attribute> AttrIter::get_extra_attrs() const
 {
   FontDescription desc;
   GSList* extra_attrs = 0;
 
   pango_attr_iterator_get_font(const_cast<PangoAttrIterator*>(gobj()), desc.gobj(), 0, &extra_attrs);
 
-  return SListHandle_Attribute(extra_attrs, Glib::OWNERSHIP_DEEP);
+  return Glib::SListHandler<Attribute, AttributeTraits>::slist_to_vector (extra_attrs, Glib::OWNERSHIP_DEEP);
 }
 
-SListHandle_Attribute AttrIter::get_attrs() const
+std::vector<Attribute> AttrIter::get_attrs() const
 {
   GSList* attrs = pango_attr_iterator_get_attrs( const_cast<PangoAttrIterator*>(gobj()) );
-  return SListHandle_Attribute(attrs, Glib::OWNERSHIP_DEEP);
+  return Glib::SListHandler<Attribute, AttributeTraits>::slist_to_vector (attrs, Glib::OWNERSHIP_DEEP);
 }
    
 
diff --git a/pango/src/attriter.hg b/pango/src/attriter.hg
index 9b33013..d0495c9 100644
--- a/pango/src/attriter.hg
+++ b/pango/src/attriter.hg
@@ -17,7 +17,6 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <glibmm/slisthandle.h>
 #include <pangomm/attributes.h>
 
 _DEFS(pangomm,pango)
@@ -84,14 +83,14 @@ public:
    * Only the highest priority value of each attribute will be added to this list.
    * @return The list of non-font attributes at the current iterator position.
    */
-  SListHandle_Attribute get_extra_attrs() const;
+  std::vector<Attribute> get_extra_attrs() const;
 
   /** Gets a list all attributes a the current position of the
    * iterator.
    *
    * @result A list of all attributes for the current range.
    */
-  SListHandle_Attribute get_attrs() const;
+  std::vector<Attribute> get_attrs() const;
   _IGNORE(pango_attr_iterator_get_attrs)
 
   PangoAttrIterator*       gobj()       { return gobject_; }
diff --git a/pango/src/context.ccg b/pango/src/context.ccg
index a026572..f14cc82 100644
--- a/pango/src/context.ccg
+++ b/pango/src/context.ccg
@@ -24,17 +24,19 @@
 #include <pango/pangocairo.h>
 #include <pango/pango-types.h> //For PANGO_MATRIX_INIT
 
+#include <glibmm/vectorutils.h>
+
 namespace Pango
 {
 
-Glib::ArrayHandle< Glib::RefPtr<FontFamily> > Context::list_families() const
+std::vector< Glib::RefPtr<FontFamily> > Context::list_families() const
 {
   //Get array:
   PangoFontFamily** pFamilies = 0;
   int n_families = 0;
   pango_context_list_families(const_cast<PangoContext*>(gobj()), &pFamilies, &n_families);
   
-  return Glib::ArrayHandle< Glib::RefPtr<FontFamily> >
+  return Glib::ArrayHandler< Glib::RefPtr<FontFamily> >::array_to_vector
       (pFamilies, n_families, Glib::OWNERSHIP_SHALLOW);
 }
 
@@ -43,19 +45,19 @@ Pango::FontMetrics Context::get_metrics(const FontDescription& desc) const
   return FontMetrics(pango_context_get_metrics(const_cast<PangoContext*>(gobj()), desc.gobj(), 0));
 }
 
-ListHandle_Item Context::itemize(const Glib::ustring& text, const AttrList& attrs) const
+std::vector<Item> Context::itemize(const Glib::ustring& text, const AttrList& attrs) const
 {
-  return ListHandle_Item(
+  return Glib::ListHandler<Item, ItemTraits>::list_to_vector (
       pango_itemize(const_cast<PangoContext*>(gobj()),
                     text.c_str(), 0, text.bytes(),
                     const_cast<PangoAttrList*>(attrs.gobj()), 0),
       Glib::OWNERSHIP_DEEP);
 }
 
-ListHandle_Item Context::itemize(const Glib::ustring& text, int start_index, int length,
+std::vector<Item> Context::itemize(const Glib::ustring& text, int start_index, int length,
                                  const AttrList& attrs, AttrIter& cached_iter) const
 {
-  return ListHandle_Item(
+  return Glib::ListHandler<Item, ItemTraits>::list_to_vector (
       pango_itemize(const_cast<PangoContext*>(gobj()),
                     text.c_str(), start_index, length,
                     const_cast<PangoAttrList*>(attrs.gobj()), cached_iter.gobj()),
diff --git a/pango/src/context.hg b/pango/src/context.hg
index 2014ee6..895a916 100644
--- a/pango/src/context.hg
+++ b/pango/src/context.hg
@@ -19,10 +19,9 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <vector>
 
 #include <glibmm/object.h>
-#include <glibmm/arrayhandle.h>
-#include <glibmm/listhandle.h>
 #include <pangomm/fontdescription.h>
 #include <pangomm/fontmetrics.h>
 #include <pangomm/fontset.h>
@@ -85,7 +84,7 @@ public:
    * objects you use, e.g. in the default font description of the context.
    * @return An array of Pango::FontFamily objects.
    */
-  Glib::ArrayHandle< Glib::RefPtr<FontFamily> > list_families() const;
+  std::vector< Glib::RefPtr<FontFamily> > list_families() const;
   
   _WRAP_METHOD(void set_font_map(const Glib::RefPtr<FontMap>& font_map), pango_context_set_font_map)
 
@@ -129,7 +128,7 @@ public:
    * @param attrs The set of attributes that apply.
    * @return A list of Pango::Item objects.
    */
-  ListHandle_Item itemize(const Glib::ustring& text, const AttrList& attrs) const;
+  std::vector<Item> itemize(const Glib::ustring& text, const AttrList& attrs) const;
 
   /** Breaks a piece of text into segments with consistent directional level and shaping engine.
    * Each byte of @a text will be contained in exactly one of the items in the returned list. 
@@ -148,8 +147,8 @@ public:
    * @param cached_iter Cached attribute iterator.
    * @return A list of Pango::Item structures.
    */
-  ListHandle_Item itemize(const Glib::ustring& text, int start_index, int length,
-                          const AttrList& attrs, AttrIter& cached_iter) const;
+  std::vector<Item> itemize(const Glib::ustring& text, int start_index, int length,
+                            const AttrList& attrs, AttrIter& cached_iter) const;
 
   /** Updates a Pango Context previously created for use with Cairo to
    * match the current transformation and target surface of a Cairo
diff --git a/pango/src/coverage.ccg b/pango/src/coverage.ccg
index 1734653..c576c23 100644
--- a/pango/src/coverage.ccg
+++ b/pango/src/coverage.ccg
@@ -21,15 +21,17 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <glibmm/vectorutils.h>
+
 namespace Pango
 {
 
-Glib::ArrayHandle<unsigned char> Coverage::to_bytes() const
+std::vector<unsigned char> Coverage::to_bytes() const
 {
   guchar* bytes = 0;
   int n_bytes = 0;
   pango_coverage_to_bytes(const_cast<PangoCoverage*>(gobj()), &bytes, &n_bytes);
-  return Glib::ArrayHandle<unsigned char>(bytes, n_bytes, Glib::OWNERSHIP_SHALLOW);
+  return Glib::ArrayHandler<unsigned char>::array_to_vector(bytes, n_bytes, Glib::OWNERSHIP_SHALLOW);
 }
 
 } /* namespace Pango */
diff --git a/pango/src/coverage.hg b/pango/src/coverage.hg
index d74b6a0..05b1bd0 100644
--- a/pango/src/coverage.hg
+++ b/pango/src/coverage.hg
@@ -19,7 +19,8 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <glibmm/arrayhandle.h>
+#include <vector>
+
 #include <pango/pango-font.h>
 
 _DEFS(pangomm,pango)
@@ -54,7 +55,7 @@ public:
   /** Convert the coverage map into a flat binary format.
    * @return An array of bytes representing the coverage map.
    */
-  Glib::ArrayHandle<unsigned char> to_bytes() const;
+  std::vector<unsigned char> to_bytes() const;
 };
 
 } // namespace Pango
diff --git a/pango/src/fontface.ccg b/pango/src/fontface.ccg
index e35b42f..ecb4d63 100644
--- a/pango/src/fontface.ccg
+++ b/pango/src/fontface.ccg
@@ -23,16 +23,13 @@
 namespace Pango
 {
 
-Glib::ArrayHandle<int> FontFace::list_sizes() const
+std::vector<int> FontFace::list_sizes() const
 {
   int* sizes = 0;
   int n_sizes = 0;
   pango_font_face_list_sizes(const_cast<PangoFontFace*>(gobj()), &sizes, &n_sizes);
 
-  return Glib::ArrayHandle<int>(sizes, n_sizes, Glib::OWNERSHIP_SHALLOW); //The ArrayHandle will free the array.
+  return Glib::ArrayHandler<int>::array_to_vector (sizes, n_sizes, Glib::OWNERSHIP_SHALLOW);
 }
 
 } //namespace Pango
-
-
-                            
\ No newline at end of file
diff --git a/pango/src/fontface.hg b/pango/src/fontface.hg
index a760b8d..5975778 100644
--- a/pango/src/fontface.hg
+++ b/pango/src/fontface.hg
@@ -44,7 +44,7 @@ public:
    * For scalable fonts this returns an empty array. 
    * The sizes returned are in Pango units and are sorted in ascending order.
    */
-  Glib::ArrayHandle<int> list_sizes() const;
+  std::vector<int> list_sizes() const;
   _IGNORE(pango_font_face_list_sizes)
 
   _WRAP_METHOD(bool is_synthesized() const, pango_font_face_is_synthesized)
diff --git a/pango/src/fontfamily.ccg b/pango/src/fontfamily.ccg
index 152cd65..90b9936 100644
--- a/pango/src/fontfamily.ccg
+++ b/pango/src/fontfamily.ccg
@@ -23,14 +23,14 @@
 namespace Pango
 {
 
-Glib::ArrayHandle< Glib::RefPtr<FontFace> > FontFamily::list_faces() const
+std::vector< Glib::RefPtr<FontFace> > FontFamily::list_faces() const
 {
   //Get the array:
   PangoFontFace** pFontFaces = 0;
   int n_fonts = 0;
   pango_font_family_list_faces(const_cast<PangoFontFamily*>(gobj()), &pFontFaces, &n_fonts);
 
-  return Glib::ArrayHandle<Glib::RefPtr <FontFace> > (pFontFaces, n_fonts, Glib::OWNERSHIP_SHALLOW);
+  return Glib::ArrayHandler<Glib::RefPtr <FontFace> >::array_to_vector (pFontFaces, n_fonts, Glib::OWNERSHIP_SHALLOW);
 }
 
 } /* namespace Pango */
diff --git a/pango/src/fontfamily.hg b/pango/src/fontfamily.hg
index c428a5f..5b7d518 100644
--- a/pango/src/fontfamily.hg
+++ b/pango/src/fontfamily.hg
@@ -19,12 +19,14 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <vector>
 
 #include <glibmm/object.h>
-#include <glibmm/arrayhandle.h>
-#include <pangomm/fontface.h>
+
 #include <pango/pango-font.h>
 
+#include <pangomm/fontface.h>
+
 _DEFS(pangomm,pango)
 _PINCLUDE(glibmm/private/object_p.h)
 
@@ -44,7 +46,7 @@ public:
    * The faces in a family share a common design, but differ in slant, weight, width and other aspects.
    * @return an array of pointers to Pango::FontFace objects.
    */
-  Glib::ArrayHandle< Glib::RefPtr<FontFace> > list_faces() const;
+  std::vector< Glib::RefPtr<FontFace> > list_faces() const;
 
   _WRAP_METHOD(Glib::ustring get_name() const, pango_font_family_get_name)
   _WRAP_METHOD(bool is_monospace() const, pango_font_family_is_monospace)
diff --git a/pango/src/fontmap.ccg b/pango/src/fontmap.ccg
index 559ad05..992a4c2 100644
--- a/pango/src/fontmap.ccg
+++ b/pango/src/fontmap.ccg
@@ -20,20 +20,23 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <pangomm/context.h>
+#include <glibmm/vectorutils.h>
+
 #include <pango/pango-fontmap.h>
 
+#include <pangomm/context.h>
+
 namespace Pango
 {
 
-Glib::ArrayHandle< Glib::RefPtr<FontFamily> > FontMap::list_families() const
+std::vector< Glib::RefPtr<FontFamily> > FontMap::list_families() const
 {
   //Get the array:
   PangoFontFamily** pFamilies = 0;
   int n_families = 0;
   pango_font_map_list_families(const_cast<PangoFontMap*>(gobj()), &pFamilies, &n_families);
 
-  return Glib::ArrayHandle< Glib::RefPtr<FontFamily> >
+  return Glib::ArrayHandler< Glib::RefPtr<FontFamily> >::array_to_vector
       (pFamilies, n_families, Glib::OWNERSHIP_SHALLOW);
 }
 
diff --git a/pango/src/fontmap.hg b/pango/src/fontmap.hg
index bcdbf3d..1509a54 100644
--- a/pango/src/fontmap.hg
+++ b/pango/src/fontmap.hg
@@ -19,13 +19,15 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <vector>
 
 #include <glibmm/object.h>
-#include <glibmm/arrayhandle.h>
+
+#include <pango/pango-fontmap.h>
+
 #include <pangomm/font.h>
 #include <pangomm/fontset.h>
 #include <pangomm/fontfamily.h>
-#include <pango/pango-fontmap.h>
 
 _DEFS(pangomm,pango)
 _PINCLUDE(glibmm/private/object_p.h)
@@ -51,7 +53,7 @@ public:
   /** List all families for the fontmap.
    * @return an array of pointers to Pango::FontFamily objects.
    */
-  Glib::ArrayHandle< Glib::RefPtr<FontFamily> > list_families() const;
+  std::vector< Glib::RefPtr<FontFamily> > list_families() const;
 
   //This is not used unless ENABLE_BACKEND is defined: _WRAP_METHOD(Glib::ustring get_shape_engine_type() const, pango_font_map_get_shape_engine_type)
   _IGNORE(pango_font_map_get_shape_engine_type)
diff --git a/pango/src/glyphstring.ccg b/pango/src/glyphstring.ccg
index 7a17e86..f10c0ae 100644
--- a/pango/src/glyphstring.ccg
+++ b/pango/src/glyphstring.ccg
@@ -21,6 +21,8 @@
  */
 
 #include <glibmm/utility.h>
+#include <glibmm/vectorutils.h>
+
 #include <pango/pangocairo.h>
 
 namespace Pango
@@ -61,11 +63,11 @@ Rectangle GlyphString::get_logical_extents(int start, int end, const Glib::RefPt
   return logical_rect;
 }
 
-Glib::ArrayHandle<int> GlyphString::get_logical_widths(const Glib::ustring& text, int embedding_level) const
+std::vector<int> GlyphString::get_logical_widths(const Glib::ustring& text, int embedding_level) const
 {
   int* logical_widths = g_new(int, text.length());
   pango_glyph_string_get_logical_widths(const_cast<PangoGlyphString*>(gobj()), text.c_str(), text.bytes(), embedding_level, logical_widths);
-  return Glib::ArrayHandle<int>(logical_widths, text.length(), Glib::OWNERSHIP_SHALLOW);
+  return Glib::ArrayHandler<int>::array_to_vector (logical_widths, text.length(), Glib::OWNERSHIP_SHALLOW);
 }
 
 int GlyphString::index_to_x(const Glib::ustring& text, const Analysis& analysis, int index, bool trailing) const
@@ -82,9 +84,9 @@ void GlyphString::x_to_index(const Glib::ustring& text, const Analysis& analysis
   trailing = trailing_temp;
 }
 
-Glib::ArrayHandle<GlyphInfo> GlyphString::get_glyphs() const
+std::vector<GlyphInfo> GlyphString::get_glyphs() const
 {
-  return Glib::ArrayHandle<GlyphInfo>(reinterpret_cast<GlyphInfo*>(gobj()->glyphs), gobj()->num_glyphs, Glib::OWNERSHIP_NONE);
+  return Glib::ArrayHandler<GlyphInfo>::array_to_vector(reinterpret_cast<GlyphInfo*>(gobj()->glyphs), gobj()->num_glyphs, Glib::OWNERSHIP_NONE);
 }
 
 } //namespace Pango
diff --git a/pango/src/glyphstring.hg b/pango/src/glyphstring.hg
index ee72699..7e6bd6f 100644
--- a/pango/src/glyphstring.hg
+++ b/pango/src/glyphstring.hg
@@ -19,12 +19,16 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <vector>
+
+#include <pango/pango-glyph.h>
+#include <pango/pango-item.h> //For PangoAnalysis.
+
+#include <cairomm/context.h>
+
 #include <pangomm/font.h>
 #include <pangomm/glyph.h>
 #include <pangomm/item.h>
-#include <cairomm/context.h>
-#include <pango/pango-glyph.h>
-#include <pango/pango-item.h> //For PangoAnalysis.
 
 _DEFS(pangomm,pango)
 
@@ -92,7 +96,7 @@ public:
    * @param embedding_level The embedding level of the string.
    * @return An array of integers representing the resulting character widths.
    */
-  Glib::ArrayHandle<int> get_logical_widths(const Glib::ustring& text, int embedding_level) const;
+  std::vector<int> get_logical_widths(const Glib::ustring& text, int embedding_level) const;
 
   /** Converts from character position to x position.
    * (X position is measured from the left edge of the run). Character positions are computed by dividing up each cluster into equal portions.
@@ -120,7 +124,7 @@ public:
   /** Gharacter positions are computed by dividing up each cluster into equal portions.
    * @return An array of Pango::GlyphInfo objects.
    */
-  Glib::ArrayHandle<GlyphInfo> get_glyphs() const;
+  std::vector<GlyphInfo> get_glyphs() const;
 
   //TODO: 
   //void        pango_cairo_glyph_string_path   (cairo_t *cr,
diff --git a/pango/src/item.ccg b/pango/src/item.ccg
index f948a56..1108ace 100644
--- a/pango/src/item.ccg
+++ b/pango/src/item.ccg
@@ -15,6 +15,8 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <glibmm/vectorutils.h>
+
 #include <pangomm/font.h>
 #include <pangomm/attributes.h>
 #include <pangomm/glyphstring.h>
@@ -30,9 +32,9 @@ Analysis::Analysis(const PangoAnalysis* src)
   gobject_ (*src)
 {}
 
-SListHandle_Attribute Analysis::get_extra_attrs() const
+std::vector<Attribute> Analysis::get_extra_attrs() const
 {
-  return SListHandle_Attribute(gobj()->extra_attrs, Glib::OWNERSHIP_NONE);
+  return Glib::SListHandler<Attribute, AttributeTraits>::slist_to_vector (gobj()->extra_attrs, Glib::OWNERSHIP_NONE);
 }
 
 
diff --git a/pango/src/item.hg b/pango/src/item.hg
index 4e53903..82efaad 100644
--- a/pango/src/item.hg
+++ b/pango/src/item.hg
@@ -14,10 +14,13 @@
  * License along with this library; if not, write to the Free
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
- 
+
+#include <vector>
+
+#include <pango/pango-item.h>
+
 #include <pangomm/attributes.h>
 #include <pangomm/language.h>
-#include <pango/pango-item.h>
 
 _DEFS(pangomm,pango)
 
@@ -66,7 +69,7 @@ public:
   /** Gets a list of non-font attributes for this segment.
    * @return A list of non-font attributes for this segment.
    */
-  SListHandle_Attribute get_extra_attrs() const;
+  std::vector<Attribute> get_extra_attrs() const;
 
   /// Provides access to the underlying C GObject.
   PangoAnalysis*       gobj()       { return &gobject_; }
@@ -161,8 +164,6 @@ struct ItemTraits
   static void    release_c_type (CType ptr) { pango_item_free(const_cast<CTypeNonConst>(ptr)); }
 };
 
-typedef Glib::ListHandle<Item, ItemTraits> ListHandle_Item;
-
 } // namespace Pango
 
 
diff --git a/pango/src/language.ccg b/pango/src/language.ccg
index 7f78f48..f2b8ddd 100644
--- a/pango/src/language.ccg
+++ b/pango/src/language.ccg
@@ -18,6 +18,8 @@
 #include <pango/pango-enum-types.h>
 #include <pango/pango-script.h>
 
+#include <glibmm/vectorutils.h>
+
 namespace Pango
 {
 
@@ -62,11 +64,11 @@ Glib::ustring Language::get_string() const
     return Glib::ustring();
 }
 
-Glib::ArrayHandle<Script> Language::get_scripts() const
+std::vector<Script> Language::get_scripts() const
 {
   int num_scripts = 0;
   const PangoScript* carray = pango_language_get_scripts(const_cast<PangoLanguage*>(gobj()), &num_scripts);
-  return Glib::ArrayHandle<Script>((const Script*)carray, num_scripts, Glib::OWNERSHIP_NONE);
+  return Glib::ArrayHandler<Script>::array_to_vector ((const Script*)carray, num_scripts, Glib::OWNERSHIP_NONE);
 }
 
 
diff --git a/pango/src/language.hg b/pango/src/language.hg
index c3cb464..29f4b0e 100644
--- a/pango/src/language.hg
+++ b/pango/src/language.hg
@@ -15,6 +15,8 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <vector>
+
 #include <pango/pango-attributes.h>
 
 _DEFS(pangomm,pango)
@@ -68,7 +70,7 @@ public:
    *
    * @newin{2,14}
    */
-  Glib::ArrayHandle<Script> get_scripts() const;
+  std::vector<Script> get_scripts() const;
   _IGNORE(pango_language_get_scripts)
 };
 
diff --git a/pango/src/layout.ccg b/pango/src/layout.ccg
index 9f4cd27..a429dfb 100644
--- a/pango/src/layout.ccg
+++ b/pango/src/layout.ccg
@@ -55,14 +55,14 @@ void Layout::set_markup(const Glib::ustring& markup, gunichar accel_marker, guni
   return pango_layout_set_markup_with_accel(gobj(), markup.c_str(), markup.bytes(), accel_marker, &accel_char);
 }
 
-Glib::ArrayHandle<PangoLogAttr> Layout::get_log_attrs() const
+std::vector<PangoLogAttr> Layout::get_log_attrs() const
 {
   //Get array:
   PangoLogAttr* pAttrs = 0;
   int n_attrs = 0;
   pango_layout_get_log_attrs(const_cast<PangoLayout*>(gobj()), &pAttrs, &n_attrs);
 
-  return Glib::ArrayHandle<PangoLogAttr>(pAttrs, n_attrs, Glib::OWNERSHIP_SHALLOW);
+  return Glib::ArrayHandler<PangoLogAttr>::array_to_vector (pAttrs, n_attrs, Glib::OWNERSHIP_SHALLOW);
 }
 
 Rectangle Layout::index_to_pos(int index) const
diff --git a/pango/src/layout.hg b/pango/src/layout.hg
index a07c189..1701561 100644
--- a/pango/src/layout.hg
+++ b/pango/src/layout.hg
@@ -21,7 +21,6 @@
 
 
 #include <glibmm/object.h>
-#include <glibmm/slisthandle.h>
 #include <pangomm/font.h>
 #include <pangomm/fontdescription.h>
 #include <pangomm/context.h>
@@ -160,7 +159,7 @@ public:
   /** Retrieve an array of logical attributes for each character in the layout.
    * @return An array of logical attributes.
    */
-  Glib::ArrayHandle<LogAttr> get_log_attrs() const;
+  std::vector<LogAttr> get_log_attrs() const;
 
   /** Convert from an index within the layout to the onscreen position corresponding to the grapheme at that index, which is represented as rectangle.
    * Note that @a x in the returned rectangle is always the leading edge of the grapheme
@@ -229,9 +228,11 @@ public:
   _WRAP_METHOD(Glib::RefPtr<LayoutLine> get_line(int line), pango_layout_get_line, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const LayoutLine> get_line(int line) const, pango_layout_get_line_readonly, refreturn) 
 
+#m4 _CONVERSION(`GSList*',`std::vector<Glib::RefPtr<LayoutLine> >',`Glib::SListHandler<Glib::RefPtr<LayoutLine>, LayoutLineTraits>::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
   //Note that the const version uses a different (faster) C function:
-  _WRAP_METHOD(SListHandle_LayoutLine get_lines(), pango_layout_get_lines)
-  _WRAP_METHOD(SListHandle_ConstLayoutLine get_lines() const, pango_layout_get_lines_readonly)
+  _WRAP_METHOD(std::vector<Glib::RefPtr<LayoutLine> > get_lines(), pango_layout_get_lines)
+#m4 _CONVERSION(`GSList*',`std::vector<Glib::RefPtr<const LayoutLine> >',`Glib::SListHandler<Glib::RefPtr<const LayoutLine>, LayoutLineTraits>::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+  _WRAP_METHOD(std::vector<Glib::RefPtr<const LayoutLine> > get_lines() const, pango_layout_get_lines_readonly)
   
 _DEPRECATE_IFDEF_START
   /** Gets an iterator to iterate over the visual extents of the layout.
diff --git a/pango/src/layoutline.ccg b/pango/src/layoutline.ccg
index d1d4fec..448ea2c 100644
--- a/pango/src/layoutline.ccg
+++ b/pango/src/layoutline.ccg
@@ -20,9 +20,12 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <pangomm/layout.h>
+#include <vector>
+
 #include <pango/pangocairo.h>
 
+#include <pangomm/layout.h>
+
 namespace Pango {
 
 Rectangle LayoutLine::get_ink_extents() const
@@ -60,12 +63,12 @@ int LayoutLine::index_to_x(int index, bool trailing) const
   return x_pos;
 }
 
-Glib::ArrayHandle<std::pair<int,int> > LayoutLine::get_x_ranges(int start_index, int end_index) const
+std::vector<std::pair<int,int> > LayoutLine::get_x_ranges(int start_index, int end_index) const
 {
   int* ranges = 0;
   int n_ranges = 0;
   pango_layout_line_get_x_ranges(const_cast<PangoLayoutLine*>(gobj()), start_index, end_index, &ranges, &n_ranges);
-  return Glib::ArrayHandle<std::pair<int,int> >(reinterpret_cast<std::pair<int,int>*>(ranges), n_ranges, Glib::OWNERSHIP_SHALLOW);
+  return Glib::ArrayHandler<std::pair<int,int> >::array_to_vector (reinterpret_cast<std::pair<int,int>*>(ranges), n_ranges, Glib::OWNERSHIP_SHALLOW);
 }
 
 void LayoutLine::show_in_cairo_context(const Cairo::RefPtr<Cairo::Context>& context)
diff --git a/pango/src/layoutline.hg b/pango/src/layoutline.hg
index fb2c0d8..6ebb089 100644
--- a/pango/src/layoutline.hg
+++ b/pango/src/layoutline.hg
@@ -19,7 +19,8 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <glibmm/slisthandle.h> // For the Glib::SListHandle typedef
+#include <vector>
+
 #include <pangomm/rectangle.h>
 #include <cairomm/context.h>
 #include <pango/pango-layout.h>
@@ -67,7 +68,7 @@ public:
    * Otherwise, it will end at the trailing edge of the last character.
    * @return An array of ranges represented by pairs of integers marking the start and end pixel coordinates of the ranges.
    */
-  Glib::ArrayHandle<std::pair<int,int> > get_x_ranges(int start_index, int end_index) const;
+  std::vector<std::pair<int,int> > get_x_ranges(int start_index, int end_index) const;
 
   _WRAP_METHOD(void get_extents(Rectangle& ink_rect, Rectangle& logical_rect) const, pango_layout_line_get_extents)
 
@@ -144,8 +145,5 @@ struct LayoutLineTraits
   static void    release_c_type (CType          ptr) { pango_layout_line_unref(ptr); }
 };
 
-typedef Glib::SListHandle< Glib::RefPtr<LayoutLine>, LayoutLineTraits > SListHandle_LayoutLine;
-typedef Glib::SListHandle< Glib::RefPtr<const LayoutLine>, LayoutLineTraits > SListHandle_ConstLayoutLine;
-
 } // namespace Pango
 
diff --git a/pango/src/tabarray.ccg b/pango/src/tabarray.ccg
index ff102dc..8bc729c 100644
--- a/pango/src/tabarray.ccg
+++ b/pango/src/tabarray.ccg
@@ -20,6 +20,8 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <glibmm/vectorutils.h>
+
 namespace Pango
 {
 
@@ -38,7 +40,7 @@ std::pair<TabAlign,int> TabArray::get_tab(int tab_index) const
   return std::pair<TabAlign,int>(alignment, location);
 }
 
-Glib::ArrayHandle< std::pair<TabAlign,int> > TabArray::get_tabs() const
+std::vector< std::pair<TabAlign,int> > TabArray::get_tabs() const
 {
   typedef std::pair<TabAlign,int> PairType;
 
@@ -69,7 +71,7 @@ Glib::ArrayHandle< std::pair<TabAlign,int> > TabArray::get_tabs() const
     g_free(pLocations);
   }
 
-  return Glib::ArrayHandle<PairType>(pair_buffer, size, Glib::OWNERSHIP_SHALLOW);
+  return Glib::ArrayHandler<PairType>::array_to_vector (pair_buffer, size, Glib::OWNERSHIP_SHALLOW);
 }
 
 } /* namespace Pango */
diff --git a/pango/src/tabarray.hg b/pango/src/tabarray.hg
index dc0fb88..badb9b3 100644
--- a/pango/src/tabarray.hg
+++ b/pango/src/tabarray.hg
@@ -17,10 +17,13 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <pangomm/attrlist.h>
+#include <utility>
+#include <vector>
+
 #include <pango/pango-tabs.h>
 #include <pango/pango-break.h> /* For PangoLogAttrs */
-#include <utility>
+
+#include <pangomm/attrlist.h>
 
 _DEFS(pangomm,pango)
 
@@ -52,7 +55,7 @@ public:
   /** Gets an array of std::pairs containing the tab stop alignments and tab positions.
    * @return An array of std::pair<TabAlign, int>. The first element in each pair represents the tab stop alignment, the second one is the tab position.
    */
-  Glib::ArrayHandle< std::pair<TabAlign,int> > get_tabs() const;
+  std::vector< std::pair<TabAlign,int> > get_tabs() const;
 
   _WRAP_METHOD(bool get_positions_in_pixels() const, pango_tab_array_get_positions_in_pixels)
 };



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