[pangomm] AttrList: Add get_attributes(), update(), equal()
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm] AttrList: Add get_attributes(), update(), equal()
- Date: Mon, 6 Sep 2021 14:45:23 +0000 (UTC)
commit 2c7c44346c51245408d631455d2b19e1a0720980
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Mon Sep 6 16:42:48 2021 +0200
AttrList: Add get_attributes(), update(), equal()
Fixes #12
pango/src/attrlist.ccg | 2 ++
pango/src/attrlist.hg | 7 +++++++
tools/m4/convert_pango.m4 | 1 +
3 files changed, 10 insertions(+)
---
diff --git a/pango/src/attrlist.ccg b/pango/src/attrlist.ccg
index 4859167..0bbc1e8 100644
--- a/pango/src/attrlist.ccg
+++ b/pango/src/attrlist.ccg
@@ -20,6 +20,8 @@
namespace Pango
{
+using SListHandler_Attribute = Glib::SListHandler<Attribute, AttributeTraits>;
+
AttrList::AttrList(const Glib::ustring& markup_text, gunichar accel_marker)
{
gboolean bTest = pango_parse_markup(markup_text.c_str(), -1 /* means null-terminated */, accel_marker,
diff --git a/pango/src/attrlist.hg b/pango/src/attrlist.hg
index abea063..4ddfcb9 100644
--- a/pango/src/attrlist.hg
+++ b/pango/src/attrlist.hg
@@ -19,6 +19,7 @@
#include <pangomm/attributes.h>
#include <pangomm/attriter.h>
+#include <vector>
_DEFS(pangomm,pango)
@@ -78,6 +79,12 @@ public:
void change(Attribute& attr);
_IGNORE(pango_attr_list_change) // hand code because we need to pass a copy of the attribute
_WRAP_METHOD(void splice(AttrList& other, int pos, int len), pango_attr_list_splice)
+ _WRAP_METHOD(void update(int pos, int remove, int add), pango_attr_list_update, newin "2,50")
+
+#m4 _CONVERSION(`GSList*',`std::vector<Attribute>',`SListHandler_Attribute::slist_to_vector($3,
Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<Attribute> get_attributes() const, pango_attr_list_get_attributes, newin "2,50")
+
+ _WRAP_METHOD(bool equal(const AttrList& other_list) const, pango_attr_list_equal, newin "2,50")
_WRAP_METHOD(AttrIter get_iter(), pango_attr_list_get_iterator)
//TODO: Though it doesn't seem important:
diff --git a/tools/m4/convert_pango.m4 b/tools/m4/convert_pango.m4
index 1c9b093..fc4a6c3 100644
--- a/tools/m4/convert_pango.m4
+++ b/tools/m4/convert_pango.m4
@@ -61,6 +61,7 @@ _CONVERSION(`PangoAttrList*',`AttrList',`AttrList(($3))')
_CONVERSION(`PangoAttrList*',`Pango::AttrList',`Pango::AttrList(($3))')
_CONVERSION(`AttrList&',`PangoAttrList*',`($3).gobj()')
_CONVERSION(`Pango::AttrList&',`PangoAttrList*',`($3).gobj()')
+_CONVERSION(`const AttrList&',`PangoAttrList*',`const_cast<PangoAttrList*>(($3).gobj())')
_CONVERSION(`PangoAttrIterator*',`AttrIter',`Glib::wrap(($3))')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]