[gnote] Move semantics for NoteDataBufferSynchronizer
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Move semantics for NoteDataBufferSynchronizer
- Date: Mon, 18 Apr 2022 19:58:16 +0000 (UTC)
commit 96a2d2ae5e17fdc04d1da3f38312f8f445bcb6c6
Author: Aurimas Černius <aurisc4 gmail com>
Date: Mon Apr 18 22:40:52 2022 +0300
Move semantics for NoteDataBufferSynchronizer
src/note.cpp | 10 +++++-----
src/note.hpp | 6 +++---
src/notebase.cpp | 8 ++++----
src/notebase.hpp | 4 ++--
4 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/note.cpp b/src/note.cpp
index b42e5ae7..d0e9b199 100644
--- a/src/note.cpp
+++ b/src/note.cpp
@@ -159,9 +159,9 @@ namespace gnote {
return (m_width != 0) && (m_height != 0);
}
- void NoteDataBufferSynchronizer::set_buffer(const Glib::RefPtr<NoteBuffer> & b)
+ void NoteDataBufferSynchronizer::set_buffer(Glib::RefPtr<NoteBuffer> && b)
{
- m_buffer = b;
+ m_buffer = std::move(b);
m_buffer->signal_changed().connect(sigc::mem_fun(*this, &NoteDataBufferSynchronizer::buffer_changed));
m_buffer->signal_apply_tag()
.connect(sigc::mem_fun(*this, &NoteDataBufferSynchronizer::buffer_tag_applied));
@@ -179,9 +179,9 @@ namespace gnote {
return data().text();
}
- void NoteDataBufferSynchronizer::set_text(const Glib::ustring & t)
+ void NoteDataBufferSynchronizer::set_text(Glib::ustring && t)
{
- data().text() = t;
+ data().text() = std::move(t);
synchronize_buffer();
}
@@ -689,7 +689,7 @@ namespace gnote {
if(!m_buffer) {
DBG_OUT("Creating buffer for %s", m_data.data().title().c_str());
m_buffer = NoteBuffer::create(get_tag_table(), *this, m_gnote.preferences());
- m_data.set_buffer(m_buffer);
+ m_data.set_buffer(Glib::RefPtr<NoteBuffer>(m_buffer));
m_buffer->signal_changed().connect(
sigc::mem_fun(*this, &Note::on_buffer_changed));
diff --git a/src/note.hpp b/src/note.hpp
index 945352d5..96351670 100644
--- a/src/note.hpp
+++ b/src/note.hpp
@@ -64,9 +64,9 @@ public:
{
return m_buffer;
}
- void set_buffer(const Glib::RefPtr<NoteBuffer> & b);
- virtual const Glib::ustring & text() override;
- virtual void set_text(const Glib::ustring & t) override;
+ void set_buffer(Glib::RefPtr<NoteBuffer> && b);
+ const Glib::ustring & text() override;
+ void set_text(Glib::ustring && t) override;
private:
void invalidate_text();
diff --git a/src/notebase.cpp b/src/notebase.cpp
index 2672832f..f119a8ae 100644
--- a/src/notebase.cpp
+++ b/src/notebase.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011-2014,2017,2019-2020 Aurimas Cernius
+ * Copyright (C) 2011-2014,2017,2019-2020,2022 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -49,9 +49,9 @@ const Glib::ustring & NoteDataBufferSynchronizerBase::text()
return data().text();
}
-void NoteDataBufferSynchronizerBase::set_text(const Glib::ustring & t)
+void NoteDataBufferSynchronizerBase::set_text(Glib::ustring && t)
{
- data().text() = t;
+ data().text() = std::move(t);
}
@@ -315,7 +315,7 @@ Glib::ustring NoteBase::get_complete_note_xml()
void NoteBase::set_xml_content(const Glib::ustring & xml)
{
- data_synchronizer().set_text(xml);
+ data_synchronizer().set_text(Glib::ustring(xml));
}
Glib::ustring NoteBase::text_content()
diff --git a/src/notebase.hpp b/src/notebase.hpp
index d9264c4e..233cb373 100644
--- a/src/notebase.hpp
+++ b/src/notebase.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011-2014,2017,2019-2021 Aurimas Cernius
+ * Copyright (C) 2011-2014,2017,2019-2022 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -176,7 +176,7 @@ public:
return *m_data;
}
virtual const Glib::ustring & text();
- virtual void set_text(const Glib::ustring & t);
+ virtual void set_text(Glib::ustring && t);
private:
std::unique_ptr<NoteData> m_data;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]