[gnote] Replace std::list with std::vector in printnotes
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Replace std::list with std::vector in printnotes
- Date: Mon, 22 Apr 2019 08:42:34 +0000 (UTC)
commit 359d1fb4c34c3bd0f287fed02a410ca77de04fbb
Author: Aurimas Černius <aurisc4 gmail com>
Date: Mon Apr 22 11:24:01 2019 +0300
Replace std::list with std::vector in printnotes
src/addins/printnotes/printnotesnoteaddin.cpp | 18 +++++++-----------
src/addins/printnotes/printnotesnoteaddin.hpp | 5 ++---
2 files changed, 9 insertions(+), 14 deletions(-)
---
diff --git a/src/addins/printnotes/printnotesnoteaddin.cpp b/src/addins/printnotes/printnotesnoteaddin.cpp
index 2eca621e..b38cd263 100644
--- a/src/addins/printnotes/printnotesnoteaddin.cpp
+++ b/src/addins/printnotes/printnotesnoteaddin.cpp
@@ -116,14 +116,13 @@ namespace printnotes {
}
- void PrintNotesNoteAddin::get_paragraph_attributes(const Glib::RefPtr<Pango::Layout> & layout,
+ std::vector<Pango::Attribute> PrintNotesNoteAddin::get_paragraph_attributes(const
Glib::RefPtr<Pango::Layout> & layout,
double dpiX,
int & indentation,
Gtk::TextIter & position,
- const Gtk::TextIter & limit,
- std::list<Pango::Attribute> & attributes)
+ const Gtk::TextIter & limit)
{
- attributes.clear();
+ std::vector<Pango::Attribute> attributes;
indentation = 0;
Glib::SListHandle<Glib::RefPtr<Gtk::TextTag> > tags = position.get_tags();
@@ -206,6 +205,8 @@ namespace printnotes {
tag->property_stretch()));
}
}
+
+ return attributes;
}
Glib::RefPtr<Pango::Layout>
@@ -230,17 +231,12 @@ namespace printnotes {
while (segm_start.compare (p_end) < 0) {
segm_end = segm_start;
- std::list<Pango::Attribute> attrs;
- get_paragraph_attributes (layout, dpiX, indentation,
- segm_end, p_end, attrs);
+ auto attrs = get_paragraph_attributes(layout, dpiX, indentation, segm_end, p_end);
guint si = (guint) (segm_start.get_line_index() - start_index);
guint ei = (guint) (segm_end.get_line_index() - start_index);
- for(std::list<Pango::Attribute>::iterator iter = attrs.begin();
- iter != attrs.end(); ++iter) {
-
- Pango::Attribute & a(*iter);
+ for(auto & a : attrs) {
a.set_start_index(si);
a.set_end_index(ei);
attr_list.insert(a);
diff --git a/src/addins/printnotes/printnotesnoteaddin.hpp b/src/addins/printnotes/printnotesnoteaddin.hpp
index df1a3b6d..49e76e7a 100644
--- a/src/addins/printnotes/printnotesnoteaddin.hpp
+++ b/src/addins/printnotes/printnotesnoteaddin.hpp
@@ -96,11 +96,10 @@ public:
}
private:
- void get_paragraph_attributes(const Glib::RefPtr<Pango::Layout> & layout,
+ std::vector<Pango::Attribute> get_paragraph_attributes(const Glib::RefPtr<Pango::Layout> & layout,
double dpiX, int & indentation,
Gtk::TextIter & position,
- const Gtk::TextIter & limit,
- std::list<Pango::Attribute> & attributes);
+ const Gtk::TextIter & limit);
Glib::RefPtr<Pango::Layout> create_layout_for_paragraph(const Glib::RefPtr<Gtk::PrintContext> & context,
Gtk::TextIter p_start,
Gtk::TextIter p_end,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]