[gnote] Replace std::string by Glib::ustring in sync utils
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Replace std::string by Glib::ustring in sync utils
- Date: Sun, 12 Feb 2017 15:14:45 +0000 (UTC)
commit 28255a69ebeacf5baa0abcc7785b5433435219f2
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Feb 12 15:23:53 2017 +0200
Replace std::string by Glib::ustring in sync utils
src/synchronization/syncutils.cpp | 25 ++++++++++++-------------
src/synchronization/syncutils.hpp | 19 +++++++++----------
2 files changed, 21 insertions(+), 23 deletions(-)
---
diff --git a/src/synchronization/syncutils.cpp b/src/synchronization/syncutils.cpp
index b00bd76..fbeba74 100644
--- a/src/synchronization/syncutils.cpp
+++ b/src/synchronization/syncutils.cpp
@@ -36,7 +36,7 @@
namespace gnote {
namespace sync {
- NoteUpdate::NoteUpdate(const std::string & xml_content, const std::string & title, const std::string &
uuid, int latest_revision)
+ NoteUpdate::NoteUpdate(const Glib::ustring & xml_content, const Glib::ustring & title, const Glib::ustring
& uuid, int latest_revision)
{
m_xml_content = xml_content;
m_title = title;
@@ -72,8 +72,8 @@ namespace sync {
xml.close();
// NOTE: Mostly a hack to ignore missing version attributes
- std::string existing_inner_content = get_inner_content(existing_note->data().text());
- std::string update_inner_content = get_inner_content(update_data->text());
+ Glib::ustring existing_inner_content = get_inner_content(existing_note->data().text());
+ Glib::ustring update_inner_content = get_inner_content(update_data->text());
return existing_inner_content == update_inner_content &&
existing_note->data().title() == update_data->title() &&
@@ -82,7 +82,7 @@ namespace sync {
}
- std::string NoteUpdate::get_inner_content(const std::string & full_content_element) const
+ Glib::ustring NoteUpdate::get_inner_content(const Glib::ustring & full_content_element) const
{
sharp::XmlReader xml;
xml.load_buffer(full_content_element);
@@ -206,37 +206,36 @@ namespace sync {
return false;
}
- std::string SyncUtils::find_first_executable_in_path(const std::vector<std::string> & executableNames)
+ Glib::ustring SyncUtils::find_first_executable_in_path(const std::vector<Glib::ustring> & executableNames)
{
- for(std::vector<std::string>::const_iterator iter = executableNames.begin();
- iter != executableNames.end(); ++iter) {
- std::string pathVar = Glib::getenv("PATH");
+ for(auto executable : executableNames) {
+ Glib::ustring pathVar = Glib::getenv("PATH");
std::vector<Glib::ustring> paths;
const char separator[] = {G_SEARCHPATH_SEPARATOR, 0};
sharp::string_split(paths, pathVar, separator);
for(unsigned i = 0; i < sizeof(common_paths) / sizeof(char*); ++i) {
- std::string commonPath = common_paths[i];
+ Glib::ustring commonPath = common_paths[i];
if(std::find(paths.begin(), paths.end(), commonPath) == paths.end()) {
paths.push_back(commonPath);
}
}
for(auto path : paths) {
- Glib::ustring testExecutablePath = Glib::build_filename(path, *iter);
+ Glib::ustring testExecutablePath = Glib::build_filename(path, executable);
if(sharp::file_exists(testExecutablePath)) {
return testExecutablePath;
}
}
- DBG_OUT("Unable to locate '%s' in your PATH", iter->c_str());
+ DBG_OUT("Unable to locate '%s' in your PATH", executable.c_str());
}
return "";
}
- std::string SyncUtils::find_first_executable_in_path(const std::string & executableName)
+ Glib::ustring SyncUtils::find_first_executable_in_path(const Glib::ustring & executableName)
{
- std::vector<std::string> executable_names;
+ std::vector<Glib::ustring> executable_names;
executable_names.push_back(executableName);
return find_first_executable_in_path(executable_names);
}
diff --git a/src/synchronization/syncutils.hpp b/src/synchronization/syncutils.hpp
index cb88904..05594a1 100644
--- a/src/synchronization/syncutils.hpp
+++ b/src/synchronization/syncutils.hpp
@@ -22,7 +22,6 @@
#define _SYNCHRONIZATION_SYNCUTILS_HPP_
-#include <string>
#include <vector>
#include "note.hpp"
@@ -69,15 +68,15 @@ namespace sync {
class NoteUpdate
{
public:
- std::string m_xml_content;//Empty if deleted?
- std::string m_title;
- std::string m_uuid; //needed?
+ Glib::ustring m_xml_content;//Empty if deleted?
+ Glib::ustring m_title;
+ Glib::ustring m_uuid; //needed?
int m_latest_revision;
- NoteUpdate(const std::string & xml_content, const std::string & title, const std::string & uuid, int
latest_revision);
+ NoteUpdate(const Glib::ustring & xml_content, const Glib::ustring & title, const Glib::ustring & uuid,
int latest_revision);
bool basically_equal_to(const Note::Ptr & existing_note);
private:
- std::string get_inner_content(const std::string & full_content_element) const;
+ Glib::ustring get_inner_content(const Glib::ustring & full_content_element) const;
bool compare_tags(const std::map<Glib::ustring, Tag::Ptr> set1, const std::map<Glib::ustring, Tag::Ptr>
set2) const;
};
@@ -88,14 +87,14 @@ namespace sync {
public:
bool is_fuse_enabled();
bool enable_fuse();
- std::string find_first_executable_in_path(const std::vector<std::string> & executableNames);
- std::string find_first_executable_in_path(const std::string & executableName);
+ Glib::ustring find_first_executable_in_path(const std::vector<Glib::ustring> & executableNames);
+ Glib::ustring find_first_executable_in_path(const Glib::ustring & executableName);
private:
static const char *common_paths[];
static SyncUtils s_obj;
- std::string m_guisu_tool;
- std::string m_modprobe_tool;
+ Glib::ustring m_guisu_tool;
+ Glib::ustring m_modprobe_tool;
};
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]