[gnote] Replace std::string by Glib::ustring in files
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Replace std::string by Glib::ustring in files
- Date: Fri, 27 Jan 2017 21:17:11 +0000 (UTC)
commit ea72d6ead83ca4305436521df514a0334f7ca54d
Author: Aurimas Černius <aurisc4 gmail com>
Date: Fri Jan 27 22:03:59 2017 +0200
Replace std::string by Glib::ustring in files
src/sharp/files.cpp | 22 +++++++++++-----------
src/sharp/files.hpp | 17 +++++++++--------
2 files changed, 20 insertions(+), 19 deletions(-)
---
diff --git a/src/sharp/files.cpp b/src/sharp/files.cpp
index ef03cf6..52fbb73 100644
--- a/src/sharp/files.cpp
+++ b/src/sharp/files.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011 Aurimas Cernius
+ * Copyright (C) 2011,2017 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -33,44 +33,44 @@
namespace sharp {
- bool file_exists(const std::string & file)
+ bool file_exists(const Glib::ustring & file)
{
return Glib::file_test(file, Glib::FILE_TEST_EXISTS)
&& Glib::file_test(file, Glib::FILE_TEST_IS_REGULAR);
}
- std::string file_basename(const std::string & p)
+ Glib::ustring file_basename(const Glib::ustring & p)
{
- const std::string & filename = Glib::path_get_basename(p);
- const std::string::size_type pos = filename.find_last_of('.');
+ const Glib::ustring filename = Glib::path_get_basename(p);
+ const Glib::ustring::size_type pos = filename.find_last_of('.');
- return std::string(filename, 0, pos);
+ return Glib::ustring(filename, 0, pos);
}
- std::string file_dirname(const std::string & p)
+ Glib::ustring file_dirname(const Glib::ustring & p)
{
return Glib::path_get_dirname(p);
}
- std::string file_filename(const std::string & p)
+ Glib::ustring file_filename(const Glib::ustring & p)
{
return Glib::path_get_basename(p);
}
- void file_delete(const std::string & p)
+ void file_delete(const Glib::ustring & p)
{
g_unlink(p.c_str());
}
- void file_copy(const std::string & source, const std::string & dest)
+ void file_copy(const Glib::ustring & source, const Glib::ustring & dest)
{
Gio::File::create_for_path(source)->copy(Gio::File::create_for_path(dest), Gio::FILE_COPY_OVERWRITE);
}
- void file_move(const std::string & from, const std::string & to)
+ void file_move(const Glib::ustring & from, const Glib::ustring & to)
{
g_rename(from.c_str(), to.c_str());
}
diff --git a/src/sharp/files.hpp b/src/sharp/files.hpp
index b5e19c2..cf330b9 100644
--- a/src/sharp/files.hpp
+++ b/src/sharp/files.hpp
@@ -1,6 +1,7 @@
/*
* gnote
*
+ * Copyright (C) 2017 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -25,20 +26,20 @@
#ifndef __SHARP_FILES_HPP_
#define __SHARP_FILES_HPP_
-#include <string>
+#include <glibmm/ustring.h>
namespace sharp {
- bool file_exists(const std::string & p);
- void file_delete(const std::string & p);
- void file_move(const std::string & from, const std::string & to);
+ bool file_exists(const Glib::ustring & p);
+ void file_delete(const Glib::ustring & p);
+ void file_move(const Glib::ustring & from, const Glib::ustring & to);
/** return the basename of the file path */
- std::string file_basename(const std::string & p);
+ Glib::ustring file_basename(const Glib::ustring & p);
/** return the directory from the file path */
- std::string file_dirname(const std::string & p);
+ Glib::ustring file_dirname(const Glib::ustring & p);
/** return the filename from the file path */
- std::string file_filename(const std::string & p);
- void file_copy(const std::string & source, const std::string & dest);
+ Glib::ustring file_filename(const Glib::ustring & p);
+ void file_copy(const Glib::ustring & source, const Glib::ustring & dest);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]