[gnote] Replace std::list with std::vector in notewindow
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Replace std::list with std::vector in notewindow
- Date: Sat, 27 Apr 2019 16:56:54 +0000 (UTC)
commit 3fdee43b7726c9d82ae8efbbbe3f8aabf3ac57c8
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sat Apr 27 19:52:20 2019 +0300
Replace std::list with std::vector in notewindow
src/notewindow.cpp | 20 +++++---------------
src/notewindow.hpp | 4 ++--
2 files changed, 7 insertions(+), 17 deletions(-)
---
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index 10c6e590..ed2eff9a 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -630,10 +630,7 @@ namespace gnote {
if (m_current_matches.empty() || m_current_matches.size() == 0)
return false;
- std::list<Match>::reverse_iterator iter(m_current_matches.rbegin());
- for ( ; iter != m_current_matches.rend() ; ++iter) {
- Match & match(*iter);
-
+ for (auto & match : m_current_matches) {
Glib::RefPtr<NoteBuffer> buffer = match.buffer;
Gtk::TextIter selection_start, selection_end;
buffer->get_selection_bounds(selection_start, selection_end);
@@ -653,10 +650,7 @@ namespace gnote {
if (m_current_matches.empty() || m_current_matches.size() == 0)
return false;
- std::list<Match>::iterator iter(m_current_matches.begin());
- for ( ; iter != m_current_matches.end() ; ++iter) {
- Match & match(*iter);
-
+ for (auto & match : m_current_matches) {
Glib::RefPtr<NoteBuffer> buffer = match.buffer;
Gtk::TextIter selection_start, selection_end;
buffer->get_selection_bounds(selection_start, selection_end);
@@ -714,9 +708,7 @@ namespace gnote {
return;
}
- for(std::list<Match>::iterator iter = m_current_matches.begin();
- iter != m_current_matches.end(); ++iter) {
- Match &match(*iter);
+ for(auto & match : m_current_matches) {
Glib::RefPtr<NoteBuffer> buffer = match.buffer;
if (match.highlighting != highlight) {
@@ -741,9 +733,7 @@ namespace gnote {
if (!m_current_matches.empty()) {
highlight_matches (false /* unhighlight */);
- for(std::list<Match>::const_iterator iter = m_current_matches.begin();
- iter != m_current_matches.end(); ++iter) {
- const Match &match(*iter);
+ for(auto & match : m_current_matches) {
match.buffer->delete_mark(match.start_mark);
match.buffer->delete_mark(match.end_mark);
}
@@ -756,7 +746,7 @@ namespace gnote {
void NoteFindHandler::find_matches_in_buffer(const Glib::RefPtr<NoteBuffer> & buffer,
const std::vector<Glib::ustring> & words,
- std::list<NoteFindHandler::Match> & matches)
+ std::vector<NoteFindHandler::Match> & matches)
{
matches.clear();
Glib::ustring note_text = buffer->get_slice (buffer->begin(),
diff --git a/src/notewindow.hpp b/src/notewindow.hpp
index 523389ce..cd1d73e8 100644
--- a/src/notewindow.hpp
+++ b/src/notewindow.hpp
@@ -118,10 +118,10 @@ private:
void cleanup_matches();
void find_matches_in_buffer(const Glib::RefPtr<NoteBuffer> & buffer,
const std::vector<Glib::ustring> & words,
- std::list<Match> & matches);
+ std::vector<Match> & matches);
Note & m_note;
- std::list<Match> m_current_matches;
+ std::vector<Match> m_current_matches;
};
class NoteWindow
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]