[gnote] Replace std::string by Glib::ustring in FileInfo



commit 4fb63baf3e75392040a4c43ca394f773e9e79cc6
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Fri Jan 27 21:56:09 2017 +0200

    Replace std::string by Glib::ustring in FileInfo

 src/sharp/directory.cpp |    2 +-
 src/sharp/fileinfo.cpp  |   18 +++++++++---------
 src/sharp/fileinfo.hpp  |   14 +++++++-------
 3 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/src/sharp/directory.cpp b/src/sharp/directory.cpp
index 3f2ebe6..74f4eec 100644
--- a/src/sharp/directory.cpp
+++ b/src/sharp/directory.cpp
@@ -51,7 +51,7 @@ namespace sharp {
     for (Glib::Dir::iterator itr = d.begin(); itr != d.end(); ++itr) {
       const Glib::ustring file(dir + "/" + *itr);
       const sharp::FileInfo file_info(file);
-      const std::string & extension = file_info.get_extension();
+      const Glib::ustring extension = file_info.get_extension();
 
       if (Glib::file_test(file, Glib::FILE_TEST_IS_REGULAR)
           && (ext.empty() || (Glib::ustring(extension).lowercase() == ext))) {
diff --git a/src/sharp/fileinfo.cpp b/src/sharp/fileinfo.cpp
index b3c0d1f..3ae0628 100644
--- a/src/sharp/fileinfo.cpp
+++ b/src/sharp/fileinfo.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011-2012 Aurimas Cernius
+ * Copyright (C) 2011-2012,2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -33,34 +33,34 @@
 namespace sharp {
 
 
-  FileInfo::FileInfo(const std::string & s)
+  FileInfo::FileInfo(const Glib::ustring & s)
     : m_path(s)
   {
   }
 
 
-  std::string FileInfo::get_name() const
+  Glib::ustring FileInfo::get_name() const
   {
     return Glib::path_get_basename(m_path);
   }
 
 
-  std::string FileInfo::get_extension() const
+  Glib::ustring FileInfo::get_extension() const
   {
-    const std::string & name = get_name();
+    const Glib::ustring name = get_name();
 
     if ("." == name || ".." == name)
       return "";
 
-    const std::string::size_type pos = name.find_last_of('.');
-    return (std::string::npos == pos) ? "" : std::string(name, pos);
+    const Glib::ustring::size_type pos = name.find_last_of('.');
+    return (Glib::ustring::npos == pos) ? "" : Glib::ustring(name, pos);
   }
 
 
-  DateTime file_modification_time(const std::string &path)
+  DateTime file_modification_time(const Glib::ustring &path)
   {
     Glib::RefPtr<Gio::FileInfo> file_info = Gio::File::create_for_path(path)->query_info(
-        G_FILE_ATTRIBUTE_TIME_MODIFIED + std::string(",") + G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC);
+        G_FILE_ATTRIBUTE_TIME_MODIFIED + Glib::ustring(",") + G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC);
     if(file_info)
       return DateTime(file_info->modification_time());
     return DateTime();
diff --git a/src/sharp/fileinfo.hpp b/src/sharp/fileinfo.hpp
index e92ad7e..e4d15ff 100644
--- a/src/sharp/fileinfo.hpp
+++ b/src/sharp/fileinfo.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011-2012 Aurimas Cernius
+ * Copyright (C) 2011-2012,2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -28,7 +28,7 @@
 #define __SHARP_FILEINFO_HPP_
 
 
-#include <string>
+#include <glibmm/ustring.h>
 
 #include "sharp/datetime.hpp"
 
@@ -38,15 +38,15 @@ namespace sharp {
 class FileInfo
 {
 public:
-  FileInfo(const std::string & );
-  std::string get_name() const;
-  std::string get_extension() const;
+  FileInfo(const Glib::ustring & );
+  Glib::ustring get_name() const;
+  Glib::ustring get_extension() const;
 private: 
-  std::string m_path;
+  Glib::ustring m_path;
 };
 
 
-DateTime file_modification_time(const std::string &);
+DateTime file_modification_time(const Glib::ustring &);
 
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]