[gnote] Move semantics for NoteTag
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Move semantics for NoteTag
- Date: Wed, 1 Jun 2022 20:32:20 +0000 (UTC)
commit 99e7b07dcf0b3d2320324bf055bbecfdc2fb3f18
Author: Aurimas Černius <aurisc4 gmail com>
Date: Wed Jun 1 23:31:38 2022 +0300
Move semantics for NoteTag
src/notebuffer.cpp | 2 +-
src/notetag.cpp | 16 ++++++++--------
src/notetag.hpp | 16 ++++++++--------
src/plugins/bugzilla/bugzillalink.cpp | 6 +++---
src/plugins/bugzilla/bugzillalink.hpp | 4 ++--
5 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/src/notebuffer.cpp b/src/notebuffer.cpp
index 79b58d5a..265755d2 100644
--- a/src/notebuffer.cpp
+++ b/src/notebuffer.cpp
@@ -748,7 +748,7 @@ namespace gnote {
if (data.adding && !data.tag->get_widget_location()) {
Glib::RefPtr<Gtk::TextChildAnchor> childAnchor = buffer->create_child_anchor(iter);
- data.tag->set_widget_location(location);
+ data.tag->set_widget_location(std::move(location));
m_note.add_child_widget(std::move(childAnchor), data.widget);
}
else if (!data.adding && data.tag->get_widget_location()) {
diff --git a/src/notetag.cpp b/src/notetag.cpp
index f91399c6..8e8976fe 100644
--- a/src/notetag.cpp
+++ b/src/notetag.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011,2013-2014,2017,2019-2021 Aurimas Cernius
+ * Copyright (C) 2011,2013-2014,2017,2019-2022 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -33,14 +33,14 @@
namespace gnote {
- NoteTag::NoteTag(const Glib::ustring & tag_name, int flags)
+ NoteTag::NoteTag(Glib::ustring && tag_name, int flags)
: Gtk::TextTag(tag_name)
- , m_element_name(tag_name)
+ , m_element_name(std::move(tag_name))
, m_widget(NULL)
, m_allow_middle_activate(false)
, m_flags(flags | CAN_SERIALIZE | CAN_SPLIT)
{
- if (tag_name.empty()) {
+ if(m_element_name.empty()) {
throw sharp::Exception ("NoteTags must have a tag name. Use "
"DynamicNoteTag for constructing "
"anonymous tags.");
@@ -58,9 +58,9 @@ namespace gnote {
}
- void NoteTag::initialize(const Glib::ustring & element_name)
+ void NoteTag::initialize(Glib::ustring && element_name)
{
- m_element_name = element_name;
+ m_element_name = std::move(element_name);
m_flags = CAN_SERIALIZE | CAN_SPLIT;
m_save_type = CONTENT;
}
@@ -576,14 +576,14 @@ namespace gnote {
return tag;
}
- DynamicNoteTag::Ptr NoteTagTable::create_dynamic_tag(const Glib::ustring & tag_name)
+ DynamicNoteTag::Ptr NoteTagTable::create_dynamic_tag(Glib::ustring && tag_name)
{
auto iter = m_tag_types.find(tag_name);
if(iter == m_tag_types.end()) {
return DynamicNoteTag::Ptr();
}
DynamicNoteTag::Ptr tag(iter->second());
- tag->initialize(tag_name);
+ tag->initialize(std::move(tag_name));
add(tag);
return tag;
}
diff --git a/src/notetag.hpp b/src/notetag.hpp
index e9ce6510..3fb0a05c 100644
--- a/src/notetag.hpp
+++ b/src/notetag.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011,2013-2014,2017,2019,2021 Aurimas Cernius
+ * Copyright (C) 2011,2013-2014,2017,2019,2021-2022 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -70,9 +70,9 @@ public:
CAN_SPLIT = 32
};
- static Ptr create(const Glib::ustring & tag_name, int flags)
+ static Ptr create(Glib::ustring && tag_name, int flags)
{
- return Ptr(new NoteTag(tag_name, flags));
+ return Ptr(new NoteTag(std::move(tag_name), flags));
}
const Glib::ustring & get_element_name() const
{
@@ -132,9 +132,9 @@ public:
{
return m_widget_location;
}
- void set_widget_location(const Glib::RefPtr<Gtk::TextMark> & value)
+ void set_widget_location(Glib::RefPtr<Gtk::TextMark> && value)
{
- m_widget_location = value;
+ m_widget_location = std::move(value);
}
////
TagActivatedHandler & signal_activate()
@@ -146,9 +146,9 @@ public:
return m_signal_changed;
}
protected:
- NoteTag(const Glib::ustring & tag_name, int flags = 0);
+ NoteTag(Glib::ustring && tag_name, int flags = 0);
NoteTag();
- virtual void initialize(const Glib::ustring & element_name);
+ virtual void initialize(Glib::ustring && element_name);
friend class NoteTagTable;
@@ -279,7 +279,7 @@ public:
ChangeType get_change_type(const Glib::RefPtr<Gtk::TextTag> &tag);
DepthNoteTag::Ptr get_depth_tag(int depth);
- DynamicNoteTag::Ptr create_dynamic_tag(const Glib::ustring & );
+ DynamicNoteTag::Ptr create_dynamic_tag(Glib::ustring &&);
void register_dynamic_tag(const Glib::ustring & tag_name, const Factory & factory);
bool is_dynamic_tag_registered(const Glib::ustring &);
diff --git a/src/plugins/bugzilla/bugzillalink.cpp b/src/plugins/bugzilla/bugzillalink.cpp
index 46654a6b..d47990ee 100644
--- a/src/plugins/bugzilla/bugzillalink.cpp
+++ b/src/plugins/bugzilla/bugzillalink.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012,2017,2019 Aurimas Cernius
+ * Copyright (C) 2012,2017,2019,2022 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -37,9 +37,9 @@ namespace bugzilla {
}
- void BugzillaLink::initialize(const Glib::ustring & element_name)
+ void BugzillaLink::initialize(Glib::ustring && element_name)
{
- gnote::DynamicNoteTag::initialize(element_name);
+ gnote::DynamicNoteTag::initialize(std::move(element_name));
property_underline() = Pango::UNDERLINE_SINGLE;
property_foreground() = "blue";
diff --git a/src/plugins/bugzilla/bugzillalink.hpp b/src/plugins/bugzilla/bugzillalink.hpp
index 73980b8c..14a47e03 100644
--- a/src/plugins/bugzilla/bugzillalink.hpp
+++ b/src/plugins/bugzilla/bugzillalink.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012-2013,2017,2019 Aurimas Cernius
+ * Copyright (C) 2012-2013,2017,2019,2022 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -47,7 +47,7 @@ public:
Glib::ustring get_bug_url() const;
void set_bug_url(const Glib::ustring & );
protected:
- virtual void initialize(const Glib::ustring & element_name) override;
+ void initialize(Glib::ustring && element_name) override;
virtual bool on_activate(const gnote::NoteEditor & , const Gtk::TextIter &,
const Gtk::TextIter &) override;
virtual void on_attribute_read(const Glib::ustring &) override;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]