[gnote] Replace std::string by Glib::ustring in Process
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Replace std::string by Glib::ustring in Process
- Date: Fri, 27 Jan 2017 21:17:21 +0000 (UTC)
commit e1a0c814246e17c998691e39f777a6e25bd201dc
Author: Aurimas Černius <aurisc4 gmail com>
Date: Fri Jan 27 22:27:48 2017 +0200
Replace std::string by Glib::ustring in Process
.../webdavsyncservice/webdavsyncserviceaddin.cpp | 12 +++++-----
.../webdavsyncservice/webdavsyncserviceaddin.hpp | 6 ++--
src/sharp/process.cpp | 8 +++---
src/sharp/process.hpp | 23 ++++++++++---------
src/synchronization/fusesyncserviceaddin.cpp | 2 +-
src/synchronization/fusesyncserviceaddin.hpp | 4 +-
src/synchronization/syncutils.cpp | 2 +-
7 files changed, 29 insertions(+), 28 deletions(-)
---
diff --git a/src/addins/webdavsyncservice/webdavsyncserviceaddin.cpp
b/src/addins/webdavsyncservice/webdavsyncserviceaddin.cpp
index 8ed1d34..0dac2d5 100644
--- a/src/addins/webdavsyncservice/webdavsyncserviceaddin.cpp
+++ b/src/addins/webdavsyncservice/webdavsyncserviceaddin.cpp
@@ -117,7 +117,7 @@ std::string WebDavSyncServiceAddin::fuse_mount_directory_error()
return res;
}
-std::vector<std::string> WebDavSyncServiceAddin::get_fuse_mount_exe_args(const std::string & mountPath, bool
fromStoredValues)
+std::vector<Glib::ustring> WebDavSyncServiceAddin::get_fuse_mount_exe_args(const std::string & mountPath,
bool fromStoredValues)
{
std::string url, username, password;
if(fromStoredValues) {
@@ -148,10 +148,10 @@ std::string WebDavSyncServiceAddin::get_fuse_mount_exe_args_for_display(const st
return str(boost::format("%1% -a %2% -u %3% -p %4% %5% -o fsname=gnotewdfs")
% mountPath % url % username % password % acceptSsl);*/
- std::vector<std::string> args = get_fuse_mount_exe_args(mountPath, fromStoredValues);
+ std::vector<Glib::ustring> args = get_fuse_mount_exe_args(mountPath, fromStoredValues);
std::string result;
- for(std::vector<std::string>::iterator iter = args.begin(); iter != args.end(); ++iter) {
- result += *iter + " ";
+ for(auto iter : args) {
+ result += iter + " ";
}
return result;
@@ -190,10 +190,10 @@ void WebDavSyncServiceAddin::reset_configuration_values()
// TODO: Unmount the FUSE mount!
}
-std::vector<std::string> WebDavSyncServiceAddin::get_fuse_mount_exe_args(const std::string & mountPath,
const std::string & url,
+std::vector<Glib::ustring> WebDavSyncServiceAddin::get_fuse_mount_exe_args(const std::string & mountPath,
const std::string & url,
const std::string & username, const std::string & password, bool acceptSsl)
{
- std::vector<std::string> args;
+ std::vector<Glib::ustring> args;
args.reserve(12);
args.push_back(url);
args.push_back(mountPath);
diff --git a/src/addins/webdavsyncservice/webdavsyncserviceaddin.hpp
b/src/addins/webdavsyncservice/webdavsyncserviceaddin.hpp
index f4aa88d..7720313 100644
--- a/src/addins/webdavsyncservice/webdavsyncserviceaddin.hpp
+++ b/src/addins/webdavsyncservice/webdavsyncserviceaddin.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012-2013 Aurimas Cernius
+ * Copyright (C) 2012-2013,2017 Aurimas Cernius
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -80,7 +80,7 @@ public:
virtual std::string fuse_mount_directory_error() override;
protected:
- virtual std::vector<std::string> get_fuse_mount_exe_args(const std::string & mountPath, bool
fromStoredValues) override;
+ virtual std::vector<Glib::ustring> get_fuse_mount_exe_args(const std::string & mountPath, bool
fromStoredValues) override;
virtual std::string get_fuse_mount_exe_args_for_display(const std::string & mountPath, bool
fromStoredValues) override;
virtual std::string fuse_mount_exe_name() override;
virtual bool verify_configuration() override;
@@ -91,7 +91,7 @@ protected:
/// </summary>
virtual void reset_configuration_values() override;
private:
- std::vector<std::string> get_fuse_mount_exe_args(const std::string & mountPath, const std::string & url,
+ std::vector<Glib::ustring> get_fuse_mount_exe_args(const std::string & mountPath, const std::string & url,
const std::string & username, const std::string & password, bool acceptSsl);
bool get_config_settings(std::string & url, std::string & username, std::string & password);
void save_config_settings(const std::string & url, const std::string & username, const std::string &
password);
diff --git a/src/sharp/process.cpp b/src/sharp/process.cpp
index 5f2da90..508d3a7 100644
--- a/src/sharp/process.cpp
+++ b/src/sharp/process.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012 Aurimas Cernius
+ * Copyright (C) 2012,2017 Aurimas Cernius
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -136,7 +136,7 @@ bool Process::standard_output_eof()
return eof(m_stdout_stream, m_stdout);
}
-std::string Process::standard_output_read_line()
+Glib::ustring Process::standard_output_read_line()
{
return read_line(m_stdout_stream, m_stdout);
}
@@ -146,7 +146,7 @@ bool Process::standard_error_eof()
return eof(m_stderr_stream, m_stderr);
}
-std::string Process::standard_error_read_line()
+Glib::ustring Process::standard_error_read_line()
{
return read_line(m_stderr_stream, m_stderr);
}
@@ -163,7 +163,7 @@ bool Process::eof(std::stringstream & stream, int & m_file)
return !m_file && stream.tellg() < 0;
}
-std::string Process::read_line(std::stringstream & stream, int & m_file)
+Glib::ustring Process::read_line(std::stringstream & stream, int & m_file)
{
while(m_file && !line_available(stream)) {
if(!perform_read(stream, m_file)) {
diff --git a/src/sharp/process.hpp b/src/sharp/process.hpp
index 4d5b2f4..dfb1b37 100644
--- a/src/sharp/process.hpp
+++ b/src/sharp/process.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012 Aurimas Cernius
+ * Copyright (C) 2012,2017 Aurimas Cernius
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,9 +22,10 @@
#define _SHARP_PROCESS_HPP_
#include <sstream>
-#include <string>
#include <vector>
+#include <glibmm/ustring.h>
+
namespace sharp {
@@ -36,26 +37,26 @@ public:
void wait_for_exit();
bool wait_for_exit(unsigned timeout);
bool standard_output_eof();
- std::string standard_output_read_line();
+ Glib::ustring standard_output_read_line();
bool standard_error_eof();
- std::string standard_error_read_line();
+ Glib::ustring standard_error_read_line();
int exit_code() const
{
return m_exit_code;
}
- std::string file_name() const
+ Glib::ustring file_name() const
{
return m_file_name;
}
- void file_name(const std::string & fname)
+ void file_name(const Glib::ustring & fname)
{
m_file_name = fname;
}
- std::vector<std::string> arguments() const
+ std::vector<Glib::ustring> arguments() const
{
return m_args;
}
- void arguments(const std::vector<std::string> & args)
+ void arguments(const std::vector<Glib::ustring> & args)
{
m_args = args;
}
@@ -80,13 +81,13 @@ private:
static void redirect_output(bool redirect, int fileno, int *pipedes);
bool eof(std::stringstream & stream, int & m_file);
- std::string read_line(std::stringstream & stream, int & m_file);
+ Glib::ustring read_line(std::stringstream & stream, int & m_file);
bool line_available(std::stringstream & stream);
bool perform_read(std::stringstream & stream, int & m_file);
int m_exit_code;
- std::string m_file_name;
- std::vector<std::string> m_args;
+ Glib::ustring m_file_name;
+ std::vector<Glib::ustring> m_args;
bool m_redirect_stdout;
bool m_redirect_stderr;
int m_pid;
diff --git a/src/synchronization/fusesyncserviceaddin.cpp b/src/synchronization/fusesyncserviceaddin.cpp
index 3cbfb38..3df946e 100644
--- a/src/synchronization/fusesyncserviceaddin.cpp
+++ b/src/synchronization/fusesyncserviceaddin.cpp
@@ -310,7 +310,7 @@ void FuseSyncServiceAddin::unmount_timeout()
sharp::Process p;
p.redirect_standard_output(false);
p.file_name(m_fuse_unmount_exe_path);
- std::vector<std::string> args;
+ std::vector<Glib::ustring> args;
args.push_back("-u");
args.push_back(m_mount_path);
p.arguments(args);
diff --git a/src/synchronization/fusesyncserviceaddin.hpp b/src/synchronization/fusesyncserviceaddin.hpp
index 9be1a2d..4f73cb6 100644
--- a/src/synchronization/fusesyncserviceaddin.hpp
+++ b/src/synchronization/fusesyncserviceaddin.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012-2013 Aurimas Cernius
+ * Copyright (C) 2012-2013,2017 Aurimas Cernius
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -54,7 +54,7 @@ protected:
virtual void save_configuration_values() = 0;
virtual void reset_configuration_values() = 0;
virtual std::string fuse_mount_exe_name() = 0;
- virtual std::vector<std::string> get_fuse_mount_exe_args(const std::string & mountPath, bool
fromStoredValues) = 0;
+ virtual std::vector<Glib::ustring> get_fuse_mount_exe_args(const std::string & mountPath, bool
fromStoredValues) = 0;
virtual std::string get_fuse_mount_exe_args_for_display(const std::string & mountPath, bool
fromStoredValues) = 0;
private:
static void redirect_standard_error();
diff --git a/src/synchronization/syncutils.cpp b/src/synchronization/syncutils.cpp
index 6827b51..661cca5 100644
--- a/src/synchronization/syncutils.cpp
+++ b/src/synchronization/syncutils.cpp
@@ -165,7 +165,7 @@ namespace sync {
// "modprobe fuse"
sharp::Process p;
p.file_name(m_guisu_tool);
- std::vector<std::string> args;
+ std::vector<Glib::ustring> args;
args.push_back(m_modprobe_tool);
args.push_back("fuse");
p.arguments(args);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]