[pangomm] Item, AttrIter: Use std::vector intead of SListHandle<>.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm] Item, AttrIter: Use std::vector intead of SListHandle<>.
- Date: Fri, 17 Mar 2017 12:35:13 +0000 (UTC)
commit b415b0af12d2b1fbf72622f5d135cf4bc83757a3
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Mar 17 13:00:23 2017 +0100
Item, AttrIter: Use std::vector intead of SListHandle<>.
Using Glib::SListHandler<>::slist_to_vector() and
Glib::SListHandler<>::vector_to_slist() instead, and only in the
implementation instead of in the API.
pango/src/attributes.hg | 3 ---
pango/src/attriter.ccg | 10 ++++++----
pango/src/attriter.hg | 5 ++---
pango/src/item.ccg | 5 +++--
pango/src/item.hg | 2 +-
pango/src/layout.hg | 1 -
pango/src/layoutline.hg | 1 -
7 files changed, 12 insertions(+), 15 deletions(-)
---
diff --git a/pango/src/attributes.hg b/pango/src/attributes.hg
index 14f8a9b..5d63d4c 100644
--- a/pango/src/attributes.hg
+++ b/pango/src/attributes.hg
@@ -22,7 +22,6 @@
#include <pangomm/color.h>
#include <pangomm/fontdescription.h>
#include <pango/pango-attributes.h>
-#include <glibmm/slisthandle.h>
_DEFS(pangomm,pango)
@@ -483,8 +482,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 ef31152..f46712d 100644
--- a/pango/src/attriter.ccg
+++ b/pango/src/attriter.ccg
@@ -119,20 +119,22 @@ Language AttrIter::get_language() const
return Language(language, true);
}
-SListHandle_Attribute AttrIter::get_extra_attrs() const
+using SListHandler_Attribute = Glib::SListHandler<Attribute, AttributeTraits>;
+
+std::vector<Attribute> AttrIter::get_extra_attrs() const
{
FontDescription desc;
GSList* extra_attrs = nullptr;
pango_attr_iterator_get_font(const_cast<PangoAttrIterator*>(gobj()), desc.gobj(), 0, &extra_attrs);
- return SListHandle_Attribute(extra_attrs, Glib::OWNERSHIP_DEEP);
+ return SListHandler_Attribute::slist_to_vector(extra_attrs, Glib::OWNERSHIP_DEEP);
}
-SListHandle_Attribute AttrIter::get_attrs() const
+std::vector<Attribute> AttrIter::get_attrs() const
{
auto attrs = pango_attr_iterator_get_attrs( const_cast<PangoAttrIterator*>(gobj()) );
- return SListHandle_Attribute(attrs, Glib::OWNERSHIP_DEEP);
+ return SListHandler_Attribute::slist_to_vector(attrs, Glib::OWNERSHIP_DEEP);
}
diff --git a/pango/src/attriter.hg b/pango/src/attriter.hg
index 2b8d898..038e690 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/item.ccg b/pango/src/item.ccg
index f057be1..c79a186 100644
--- a/pango/src/item.ccg
+++ b/pango/src/item.ccg
@@ -30,9 +30,10 @@ 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);
+ using SListHandler_Attribute = Glib::SListHandler<Attribute, AttributeTraits>;
+ return SListHandler_Attribute::slist_to_vector(gobj()->extra_attrs, Glib::OWNERSHIP_NONE);
}
diff --git a/pango/src/item.hg b/pango/src/item.hg
index 2eddbe6..7d0893b 100644
--- a/pango/src/item.hg
+++ b/pango/src/item.hg
@@ -67,7 +67,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_; }
diff --git a/pango/src/layout.hg b/pango/src/layout.hg
index a064703..e80cc7c 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>
diff --git a/pango/src/layoutline.hg b/pango/src/layoutline.hg
index c079b84..770fb81 100644
--- a/pango/src/layoutline.hg
+++ b/pango/src/layoutline.hg
@@ -19,7 +19,6 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glibmm/slisthandle.h> // For the Glib::SListHandle typedef
#include <pangomm/rectangle.h>
#include <cairomm/context.h>
#include <glibmm/arrayhandle.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]