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



commit 7db3bee18d9071568794f4fd675b381df1cde017
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Fri Feb 17 21:30:31 2017 +0200

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

 .../specialnotes/specialnotesapplicationaddin.cpp  |    4 ++--
 src/notebooks/notebook.cpp                         |   16 ++++++++--------
 src/notebooks/notebook.hpp                         |   20 +++++++++-----------
 src/notebooks/specialnotebooks.cpp                 |   10 +++++-----
 src/notebooks/specialnotebooks.hpp                 |   12 ++++++------
 5 files changed, 30 insertions(+), 32 deletions(-)
---
diff --git a/src/addins/specialnotes/specialnotesapplicationaddin.cpp 
b/src/addins/specialnotes/specialnotesapplicationaddin.cpp
index c9e9589..c13db93 100644
--- a/src/addins/specialnotes/specialnotesapplicationaddin.cpp
+++ b/src/addins/specialnotes/specialnotesapplicationaddin.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2013-2014 Aurimas Cernius
+ * Copyright (C) 2013-2014,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
@@ -38,7 +38,7 @@ namespace {
       : SpecialNotebook(nm, _("Special Notes"))
       {}
 
-    virtual std::string get_normalized_name() const override
+    virtual Glib::ustring get_normalized_name() const override
       {
         return "___SpecialNotesAddin___SpecialNotes__Notebook___";
       }
diff --git a/src/notebooks/notebook.cpp b/src/notebooks/notebook.cpp
index 00b0e64..2e79d28 100644
--- a/src/notebooks/notebook.cpp
+++ b/src/notebooks/notebook.cpp
@@ -61,7 +61,7 @@ namespace notebooks {
   /// A <see cref="System.String"/>.  This is the name that will be used
   /// to identify the notebook.
   /// </param>
-  Notebook::Notebook(NoteManager & manager, const std::string & name, bool is_special)
+  Notebook::Notebook(NoteManager & manager, const Glib::ustring & name, bool is_special)
     : m_note_manager(manager)
   {
     // is special assume the name as is, and we don't want a tag.
@@ -71,7 +71,7 @@ namespace notebooks {
     else {
       set_name(name);
       m_tag = ITagManager::obj().get_or_create_system_tag(
-        std::string(NOTEBOOK_TAG_PREFIX) + name);
+        Glib::ustring(NOTEBOOK_TAG_PREFIX) + name);
     }
   }
 
@@ -85,15 +85,15 @@ namespace notebooks {
     : m_note_manager(manager)
   {
   // Parse the notebook name from the tag name
-    std::string systemNotebookPrefix = std::string(Tag::SYSTEM_TAG_PREFIX)
+    Glib::ustring systemNotebookPrefix = Glib::ustring(Tag::SYSTEM_TAG_PREFIX)
       + NOTEBOOK_TAG_PREFIX;
-    std::string notebookName = sharp::string_substring(notebookTag->name(), 
+    Glib::ustring notebookName = sharp::string_substring(notebookTag->name(),
                                                        systemNotebookPrefix.length());
     set_name(notebookName);
     m_tag = notebookTag;
   }
 
-  void Notebook::set_name(const std::string & value)
+  void Notebook::set_name(const Glib::ustring & value)
   {
     Glib::ustring trimmedName = sharp::string_trim(value);
     if(!trimmedName.empty()) {
@@ -111,7 +111,7 @@ namespace notebooks {
   }
 
 
-  std::string Notebook::get_normalized_name() const
+  Glib::ustring Notebook::get_normalized_name() const
   {
     return m_normalized_name;
   }
@@ -148,7 +148,7 @@ namespace notebooks {
     NoteBase::Ptr note = find_template_note();
 
     if (!note) {
-      std::string title = m_default_template_note_title;
+      Glib::ustring title = m_default_template_note_title;
       if(m_note_manager.find(title)) {
         std::list<NoteBase*> tag_notes;
         m_tag->get_notes(tag_notes);
@@ -214,7 +214,7 @@ namespace notebooks {
     return true;
   }
 
-  std::string Notebook::normalize(const std::string & s)
+  Glib::ustring Notebook::normalize(const Glib::ustring & s)
   {
     return Glib::ustring(sharp::string_trim(s)).lowercase();
   }
diff --git a/src/notebooks/notebook.hpp b/src/notebooks/notebook.hpp
index eb2b181..d894104 100644
--- a/src/notebooks/notebook.hpp
+++ b/src/notebooks/notebook.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2014 Aurimas Cernius
+ * Copyright (C) 2010-2014,2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -23,8 +23,6 @@
 #ifndef __NOTEBOOKS_NOTEBOOK_HPP_
 #define __NOTEBOOKS_NOTEBOOK_HPP_
 
-#include <string>
-
 #include "base/macros.hpp"
 #include "tag.hpp"
 #include "note.hpp"
@@ -42,19 +40,19 @@ class Notebook
 public:
   typedef shared_ptr<Notebook> Ptr;
   static const char * NOTEBOOK_TAG_PREFIX;
-  Notebook(NoteManager &, const std::string &, bool is_special = false);
+  Notebook(NoteManager &, const Glib::ustring &, bool is_special = false);
   Notebook(NoteManager &, const Tag::Ptr &);
-  std::string get_name() const
+  Glib::ustring get_name() const
     { return m_name; }
-  void set_name(const std::string &);
-  virtual std::string get_normalized_name() const;
+  void set_name(const Glib::ustring &);
+  virtual Glib::ustring get_normalized_name() const;
   virtual Tag::Ptr    get_tag() const;
   Note::Ptr find_template_note() const;
   virtual Note::Ptr   get_template_note() const;
   Note::Ptr create_notebook_note();
   virtual bool contains_note(const Note::Ptr & note, bool include_system = false);
   virtual bool add_note(const Note::Ptr &);
-  static std::string normalize(const std::string & s);
+  static Glib::ustring normalize(const Glib::ustring & s);
 ////
   virtual ~Notebook()
     {}
@@ -68,9 +66,9 @@ private:
 
   Notebook(const Notebook &);
   Notebook & operator=(const Notebook &);
-  std::string m_name;
-  std::string m_normalized_name;
-  std::string m_default_template_note_title;
+  Glib::ustring m_name;
+  Glib::ustring m_normalized_name;
+  Glib::ustring m_default_template_note_title;
   Tag::Ptr    m_tag;
 };
 
diff --git a/src/notebooks/specialnotebooks.cpp b/src/notebooks/specialnotebooks.cpp
index 36e74d0..4c80a89 100644
--- a/src/notebooks/specialnotebooks.cpp
+++ b/src/notebooks/specialnotebooks.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2014 Aurimas Cernius
+ * Copyright (C) 2010-2014,2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -47,7 +47,7 @@ AllNotesNotebook::AllNotesNotebook(NoteManager & manager)
 {
 }
 
-std::string AllNotesNotebook::get_normalized_name() const
+Glib::ustring AllNotesNotebook::get_normalized_name() const
 {
   return "___NotebookManager___AllNotes__Notebook___";
 }
@@ -76,7 +76,7 @@ UnfiledNotesNotebook::UnfiledNotesNotebook(NoteManager & manager)
 {
 }
 
-std::string UnfiledNotesNotebook::get_normalized_name() const
+Glib::ustring UnfiledNotesNotebook::get_normalized_name() const
 {
   return "___NotebookManager___UnfiledNotes__Notebook___";
 }
@@ -107,7 +107,7 @@ PinnedNotesNotebook::PinnedNotesNotebook(NoteManager & manager)
 {
 }
 
-std::string PinnedNotesNotebook::get_normalized_name() const
+Glib::ustring PinnedNotesNotebook::get_normalized_name() const
 {
   return "___NotebookManager___PinnedNotes__Notebook___";
 }
@@ -136,7 +136,7 @@ ActiveNotesNotebook::ActiveNotesNotebook(NoteManager & manager)
     .connect(sigc::mem_fun(*this, &ActiveNotesNotebook::on_note_deleted));
 }
 
-std::string ActiveNotesNotebook::get_normalized_name() const
+Glib::ustring ActiveNotesNotebook::get_normalized_name() const
 {
   return "___NotebookManager___ActiveNotes__Notebook___";
 }
diff --git a/src/notebooks/specialnotebooks.hpp b/src/notebooks/specialnotebooks.hpp
index 32a6408..79d9672 100644
--- a/src/notebooks/specialnotebooks.hpp
+++ b/src/notebooks/specialnotebooks.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2014 Aurimas Cernius
+ * Copyright (C) 2010-2014,2017 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -43,7 +43,7 @@ public:
 
   virtual Glib::RefPtr<Gdk::Pixbuf> get_icon() = 0;
 protected:
-  SpecialNotebook(NoteManager & m, const std::string &s)
+  SpecialNotebook(NoteManager & m, const Glib::ustring &s)
     : Notebook(m, s, true)
     {
     }
@@ -58,7 +58,7 @@ class AllNotesNotebook
 public:
   typedef shared_ptr<AllNotesNotebook> Ptr;
   AllNotesNotebook(NoteManager &);
-  virtual std::string get_normalized_name() const override;
+  virtual Glib::ustring get_normalized_name() const override;
   virtual bool        contains_note(const Note::Ptr & note, bool include_system = false) override;
   virtual bool        add_note(const Note::Ptr &) override;
   virtual Glib::RefPtr<Gdk::Pixbuf> get_icon() override;
@@ -71,7 +71,7 @@ class UnfiledNotesNotebook
 public:
   typedef shared_ptr<UnfiledNotesNotebook> Ptr;
   UnfiledNotesNotebook(NoteManager &);
-  virtual std::string get_normalized_name() const override;
+  virtual Glib::ustring get_normalized_name() const override;
   virtual bool        contains_note(const Note::Ptr & note, bool include_system = false) override;
   virtual bool        add_note(const Note::Ptr &) override;
   virtual Glib::RefPtr<Gdk::Pixbuf> get_icon() override;
@@ -84,7 +84,7 @@ class PinnedNotesNotebook
 public:
   typedef shared_ptr<PinnedNotesNotebook> Ptr;
   PinnedNotesNotebook(NoteManager &);
-  virtual std::string get_normalized_name() const override;
+  virtual Glib::ustring get_normalized_name() const override;
   virtual bool        contains_note(const Note::Ptr & note, bool include_system = false) override;
   virtual bool        add_note(const Note::Ptr &) override;
   virtual Glib::RefPtr<Gdk::Pixbuf> get_icon() override;
@@ -97,7 +97,7 @@ class ActiveNotesNotebook
 public:
   typedef shared_ptr<ActiveNotesNotebook> Ptr;
   ActiveNotesNotebook(NoteManager &);
-  virtual std::string get_normalized_name() const override;
+  virtual Glib::ustring get_normalized_name() const override;
   virtual bool        contains_note(const Note::Ptr & note, bool include_system = false) override;
   virtual bool        add_note(const Note::Ptr &) override;
   virtual Glib::RefPtr<Gdk::Pixbuf> get_icon() override;


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