[gnote] Replace std::string by Glib::ustring in NoteManager
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Replace std::string by Glib::ustring in NoteManager
- Date: Sun, 5 Feb 2017 20:55:07 +0000 (UTC)
commit cba6a1eb94718b0798fbcdcdb26e173679c65f9a
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Feb 5 21:40:21 2017 +0200
Replace std::string by Glib::ustring in NoteManager
src/notemanager.cpp | 14 +++++++-------
src/notemanager.hpp | 10 +++++-----
src/notemanagerbase.cpp | 16 ++++++++--------
src/notemanagerbase.hpp | 18 +++++++++---------
4 files changed, 29 insertions(+), 29 deletions(-)
---
diff --git a/src/notemanager.cpp b/src/notemanager.cpp
index 276f14d..1dac87a 100644
--- a/src/notemanager.cpp
+++ b/src/notemanager.cpp
@@ -40,7 +40,7 @@ namespace gnote {
NoteManager::NoteManager(const Glib::ustring & directory)
: NoteManagerBase(directory)
{
- std::string backup = directory + "/Backup";
+ Glib::ustring backup = directory + "/Backup";
_common_init(directory, backup);
}
@@ -129,7 +129,7 @@ namespace gnote {
// Catalog.GetString ("GNOME Panel");
// for some reason I have to set the xmlns -- Hub
- std::string start_note_content =
+ Glib::ustring start_note_content =
_("<note-content xmlns:link=\"http://beatniksoftware.com/tomboy/link\">"
"Start Here\n\n"
"<bold>Welcome to Gnote!</bold>\n\n"
@@ -148,7 +148,7 @@ namespace gnote {
"gets underlined? Click on the link to open the note."
"</note-content>");
- std::string links_note_content =
+ Glib::ustring links_note_content =
_("<note-content>"
"Using Links in Gnote\n\n"
"Notes in Gnote can be linked together by "
@@ -227,7 +227,7 @@ namespace gnote {
}
}
- void NoteManager::migrate_notes(const std::string & old_note_dir)
+ void NoteManager::migrate_notes(const Glib::ustring & old_note_dir)
{
std::list<Glib::ustring> files;
sharp::directory_get_files_with_ext(old_note_dir, ".note", files);
@@ -282,7 +282,7 @@ namespace gnote {
// Create a new note with the specified title from the default
// template note. Optionally the body can be overridden.
- NoteBase::Ptr NoteManager::create_new_note(Glib::ustring title, const std::string & guid)
+ NoteBase::Ptr NoteManager::create_new_note(Glib::ustring title, const Glib::ustring & guid)
{
NoteBase::Ptr new_note = NoteManagerBase::create_new_note(title, guid);
@@ -294,7 +294,7 @@ namespace gnote {
// Create a new note with the specified Xml content
NoteBase::Ptr NoteManager::create_new_note(const Glib::ustring & title, const Glib::ustring & xml_content,
- const std::string & guid)
+ const Glib::ustring & guid)
{
NoteBase::Ptr new_note = NoteManagerBase::create_new_note(title, xml_content, guid);
@@ -324,7 +324,7 @@ namespace gnote {
// the template note.
NoteBase::Ptr NoteManager::create_note_from_template(const Glib::ustring & title,
const NoteBase::Ptr & template_note,
- const std::string & guid)
+ const Glib::ustring & guid)
{
NoteBase::Ptr new_note = NoteManagerBase::create_note_from_template(title, template_note, guid);
if(new_note == 0) {
diff --git a/src/notemanager.hpp b/src/notemanager.hpp
index 125399c..ec1ec0d 100644
--- a/src/notemanager.hpp
+++ b/src/notemanager.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
@@ -55,13 +55,13 @@ namespace gnote {
protected:
virtual void _common_init(const Glib::ustring & directory, const Glib::ustring & backup) override;
virtual void post_load() override;
- virtual void migrate_notes(const std::string & old_note_dir) override;
+ virtual void migrate_notes(const Glib::ustring & old_note_dir) override;
virtual NoteBase::Ptr create_note_from_template(const Glib::ustring & title,
const NoteBase::Ptr & template_note,
- const std::string & guid) override;
- virtual NoteBase::Ptr create_new_note(Glib::ustring title, const std::string & guid) override;
+ const Glib::ustring & guid) override;
+ virtual NoteBase::Ptr create_new_note(Glib::ustring title, const Glib::ustring & guid) override;
virtual NoteBase::Ptr create_new_note(const Glib::ustring & title, const Glib::ustring & xml_content,
- const std::string & guid) override;
+ const Glib::ustring & guid) override;
virtual NoteBase::Ptr note_create_new(const Glib::ustring & title, const Glib::ustring & file_name)
override;
virtual NoteBase::Ptr note_load(const Glib::ustring & file_name) override;
private:
diff --git a/src/notemanagerbase.cpp b/src/notemanagerbase.cpp
index aad20bc..82c48e0 100644
--- a/src/notemanagerbase.cpp
+++ b/src/notemanagerbase.cpp
@@ -107,7 +107,7 @@ void NoteManagerBase::_common_init(const Glib::ustring & /*directory*/, const Gl
m_backup_dir = backup_directory;
bool is_first_run = first_run();
- const std::string old_note_dir = IGnote::old_note_dir();
+ const Glib::ustring old_note_dir = IGnote::old_note_dir();
const bool migration_needed = is_first_run && sharp::directory_exists(old_note_dir);
create_notes_dir();
@@ -146,7 +146,7 @@ bool NoteManagerBase::create_directory(const Glib::ustring & directory) const
return g_mkdir_with_parents(directory.c_str(), S_IRWXU) == 0;
}
-void NoteManagerBase::migrate_notes(const std::string & /*old_note_dir*/)
+void NoteManagerBase::migrate_notes(const Glib::ustring & /*old_note_dir*/)
{
}
@@ -180,7 +180,7 @@ NoteBase::List NoteManagerBase::get_notes_linking_to(const Glib::ustring & title
NoteBase::List result;
FOREACH(const NoteBase::Ptr & note, m_notes) {
if(note->get_title() != title) {
- if(note->get_complete_note_xml().find(tag) != std::string::npos) {
+ if(note->get_complete_note_xml().find(tag) != Glib::ustring::npos) {
result.push_back(note);
}
}
@@ -219,7 +219,7 @@ NoteBase::Ptr NoteManagerBase::find(const Glib::ustring & linked_title) const
return NoteBase::Ptr();
}
-NoteBase::Ptr NoteManagerBase::find_by_uri(const std::string & uri) const
+NoteBase::Ptr NoteManagerBase::find_by_uri(const Glib::ustring & uri) const
{
FOREACH(const NoteBase::Ptr & note, m_notes) {
if (note->uri() == uri) {
@@ -253,7 +253,7 @@ NoteBase::Ptr NoteManagerBase::create(const Glib::ustring & title, const Glib::u
// the template note.
NoteBase::Ptr NoteManagerBase::create_note_from_template(const Glib::ustring & title,
const NoteBase::Ptr & template_note,
- const std::string & guid)
+ const Glib::ustring & guid)
{
Glib::ustring new_title(title);
Tag::Ptr template_save_title =
ITagManager::obj().get_or_create_system_tag(ITagManager::TEMPLATE_NOTE_SAVE_TITLE_SYSTEM_TAG);
@@ -296,7 +296,7 @@ Glib::ustring NoteManagerBase::get_unique_name(const Glib::ustring & basename) c
// Create a new note with the specified title from the default
// template note. Optionally the body can be overridden.
-NoteBase::Ptr NoteManagerBase::create_new_note(Glib::ustring title, const std::string & guid)
+NoteBase::Ptr NoteManagerBase::create_new_note(Glib::ustring title, const Glib::ustring & guid)
{
Glib::ustring body;
@@ -325,7 +325,7 @@ NoteBase::Ptr NoteManagerBase::create_new_note(Glib::ustring title, const std::s
// Create a new note with the specified Xml content
NoteBase::Ptr NoteManagerBase::create_new_note(const Glib::ustring & title, const Glib::ustring &
xml_content,
- const std::string & guid)
+ const Glib::ustring & guid)
{
if(title.empty())
throw sharp::Exception("Invalid title");
@@ -496,7 +496,7 @@ NoteBase::Ptr NoteManagerBase::import_note(const Glib::ustring & file_path)
}
-NoteBase::Ptr NoteManagerBase::create_with_guid(const Glib::ustring & title, const std::string & guid)
+NoteBase::Ptr NoteManagerBase::create_with_guid(const Glib::ustring & title, const Glib::ustring & guid)
{
return create_new_note(title, guid);
}
diff --git a/src/notemanagerbase.hpp b/src/notemanagerbase.hpp
index 2b1a554..95e9da5 100644
--- a/src/notemanagerbase.hpp
+++ b/src/notemanagerbase.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
@@ -54,7 +54,7 @@ public:
return m_read_only;
}
NoteBase::Ptr find(const Glib::ustring &) const;
- NoteBase::Ptr find_by_uri(const std::string &) const;
+ NoteBase::Ptr find_by_uri(const Glib::ustring &) const;
NoteBase::List get_notes_linking_to(const Glib::ustring & title) const;
NoteBase::Ptr create();
NoteBase::Ptr create(const Glib::ustring & title);
@@ -67,7 +67,7 @@ public:
// Import a note read from file_path
// Will ensure the sanity including the unique title.
NoteBase::Ptr import_note(const Glib::ustring & file_path);
- NoteBase::Ptr create_with_guid(const Glib::ustring & title, const std::string & guid);
+ NoteBase::Ptr create_with_guid(const Glib::ustring & title, const Glib::ustring & guid);
const Glib::ustring & notes_dir() const
{
@@ -78,7 +78,7 @@ public:
return m_notes;
}
- const std::string & start_note_uri() const
+ const Glib::ustring & start_note_uri() const
{
return m_start_note_uri;
}
@@ -91,24 +91,24 @@ protected:
virtual void _common_init(const Glib::ustring & directory, const Glib::ustring & backup);
bool first_run() const;
virtual void post_load();
- virtual void migrate_notes(const std::string & old_note_dir);
+ virtual void migrate_notes(const Glib::ustring & old_note_dir);
/** add the note to the manager and setup signals */
void add_note(const NoteBase::Ptr &);
void on_note_rename(const NoteBase::Ptr & note, const Glib::ustring & old_title);
void on_note_save(const NoteBase::Ptr & note);
virtual NoteBase::Ptr create_note_from_template(const Glib::ustring & title,
const NoteBase::Ptr & template_note,
- const std::string & guid);
- virtual NoteBase::Ptr create_new_note(Glib::ustring title, const std::string & guid);
+ const Glib::ustring & guid);
+ virtual NoteBase::Ptr create_new_note(Glib::ustring title, const Glib::ustring & guid);
virtual NoteBase::Ptr create_new_note(const Glib::ustring & title, const Glib::ustring & xml_content,
- const std::string & guid);
+ const Glib::ustring & guid);
virtual NoteBase::Ptr note_create_new(const Glib::ustring & title, const Glib::ustring & file_name) = 0;
Glib::ustring make_new_file_name() const;
Glib::ustring make_new_file_name(const Glib::ustring & guid) const;
virtual NoteBase::Ptr note_load(const Glib::ustring & file_name) = 0;
NoteBase::List m_notes;
- std::string m_start_note_uri;
+ Glib::ustring m_start_note_uri;
Glib::ustring m_backup_dir;
Glib::ustring m_default_note_template_title;
private:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]