[gnote] Replace std::string by Glib::ustring in NoteTag
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Replace std::string by Glib::ustring in NoteTag
- Date: Sat, 4 Feb 2017 18:02:38 +0000 (UTC)
commit ca3d5ce646712103181503020a5e220d49e93431
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sat Feb 4 18:52:36 2017 +0200
Replace std::string by Glib::ustring in NoteTag
src/addins/bugzilla/bugzillalink.cpp | 18 +++++++++---------
src/addins/bugzilla/bugzillalink.hpp | 10 +++++-----
src/notetag.cpp | 18 +++++++++---------
src/notetag.hpp | 31 +++++++++++++++----------------
4 files changed, 38 insertions(+), 39 deletions(-)
---
diff --git a/src/addins/bugzilla/bugzillalink.cpp b/src/addins/bugzilla/bugzillalink.cpp
index 399cc10..3152c1d 100644
--- a/src/addins/bugzilla/bugzillalink.cpp
+++ b/src/addins/bugzilla/bugzillalink.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012 Aurimas Cernius
+ * Copyright (C) 2012,2017 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -35,7 +35,7 @@ namespace bugzilla {
}
- void BugzillaLink::initialize(const std::string & element_name)
+ void BugzillaLink::initialize(const Glib::ustring & element_name)
{
gnote::DynamicNoteTag::initialize(element_name);
@@ -48,9 +48,9 @@ namespace bugzilla {
}
- std::string BugzillaLink::get_bug_url() const
+ Glib::ustring BugzillaLink::get_bug_url() const
{
- std::string url;
+ Glib::ustring url;
AttributeMap::const_iterator iter = get_attributes().find(URI_ATTRIBUTE_NAME);
if(iter != get_attributes().end()) {
url = iter->second;
@@ -59,7 +59,7 @@ namespace bugzilla {
}
- void BugzillaLink::set_bug_url(const std::string & value)
+ void BugzillaLink::set_bug_url(const Glib::ustring & value)
{
get_attributes()[URI_ATTRIBUTE_NAME] = value;
make_image();
@@ -70,10 +70,10 @@ namespace bugzilla {
{
sharp::Uri uri(get_bug_url());
- std::string host = uri.get_host();
+ Glib::ustring host = uri.get_host();
- std::string imageDir = BugzillaNoteAddin::images_dir();
- std::string imagePath = imageDir + host + ".png";
+ Glib::ustring imageDir = BugzillaNoteAddin::images_dir();
+ Glib::ustring imagePath = imageDir + host + ".png";
Glib::RefPtr<Gdk::Pixbuf> image;
try {
image = Gdk::Pixbuf::create_from_file(imagePath);
@@ -104,7 +104,7 @@ namespace bugzilla {
}
- void BugzillaLink::on_attribute_read(const std::string & attributeName)
+ void BugzillaLink::on_attribute_read(const Glib::ustring & attributeName)
{
gnote::DynamicNoteTag::on_attribute_read(attributeName);
if (attributeName == URI_ATTRIBUTE_NAME) {
diff --git a/src/addins/bugzilla/bugzillalink.hpp b/src/addins/bugzilla/bugzillalink.hpp
index ad42c27..41af4e6 100644
--- a/src/addins/bugzilla/bugzillalink.hpp
+++ b/src/addins/bugzilla/bugzillalink.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012-2013 Aurimas Cernius
+ * Copyright (C) 2012-2013,2017 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -40,13 +40,13 @@ public:
return gnote::DynamicNoteTag::Ptr(new BugzillaLink);
}
BugzillaLink();
- std::string get_bug_url() const;
- void set_bug_url(const std::string & );
+ Glib::ustring get_bug_url() const;
+ void set_bug_url(const Glib::ustring & );
protected:
- virtual void initialize(const std::string & element_name) override;
+ virtual void initialize(const Glib::ustring & element_name) override;
virtual bool on_activate(const gnote::NoteEditor & , const Gtk::TextIter &,
const Gtk::TextIter &) override;
- virtual void on_attribute_read(const std::string &) override;
+ virtual void on_attribute_read(const Glib::ustring &) override;
private:
void make_image();
};
diff --git a/src/notetag.cpp b/src/notetag.cpp
index d69217f..4fb5344 100644
--- a/src/notetag.cpp
+++ b/src/notetag.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011,2013-2014 Aurimas Cernius
+ * Copyright (C) 2011,2013-2014,2017 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -31,7 +31,7 @@
namespace gnote {
- NoteTag::NoteTag(const std::string & tag_name, int flags) throw(sharp::Exception)
+ NoteTag::NoteTag(const Glib::ustring & tag_name, int flags) throw(sharp::Exception)
: Gtk::TextTag(tag_name)
, m_element_name(tag_name)
, m_widget(NULL)
@@ -56,7 +56,7 @@ namespace gnote {
}
- void NoteTag::initialize(const std::string & element_name)
+ void NoteTag::initialize(const Glib::ustring & element_name)
{
m_element_name = element_name;
m_flags = CAN_SERIALIZE | CAN_SPLIT;
@@ -327,7 +327,7 @@ namespace gnote {
if (start) {
while (xml.move_to_next_attribute()) {
- std::string name = xml.get_name();
+ Glib::ustring name = xml.get_name();
xml.read_attribute_value();
m_attributes [name] = xml.get_value();
@@ -564,7 +564,7 @@ namespace gnote {
DepthNoteTag::Ptr NoteTagTable::get_depth_tag(int depth, Pango::Direction direction)
{
- std::string name = "depth:" + TO_STRING(depth) + ":" + TO_STRING((int)direction);
+ Glib::ustring name = "depth:" + TO_STRING(depth) + ":" + TO_STRING((int)direction);
DepthNoteTag::Ptr tag = DepthNoteTag::Ptr::cast_dynamic(lookup(name));
@@ -587,9 +587,9 @@ namespace gnote {
return tag;
}
- DynamicNoteTag::Ptr NoteTagTable::create_dynamic_tag(const std::string & tag_name)
+ DynamicNoteTag::Ptr NoteTagTable::create_dynamic_tag(const Glib::ustring & tag_name)
{
- std::map<std::string, Factory>::iterator iter = m_tag_types.find(tag_name);
+ auto iter = m_tag_types.find(tag_name);
if(iter == m_tag_types.end()) {
return DynamicNoteTag::Ptr();
}
@@ -600,13 +600,13 @@ namespace gnote {
}
- void NoteTagTable::register_dynamic_tag(const std::string & tag_name, const Factory & factory)
+ void NoteTagTable::register_dynamic_tag(const Glib::ustring & tag_name, const Factory & factory)
{
m_tag_types[tag_name] = factory;
}
- bool NoteTagTable::is_dynamic_tag_registered(const std::string & tag_name)
+ bool NoteTagTable::is_dynamic_tag_registered(const Glib::ustring & tag_name)
{
return m_tag_types.find(tag_name) != m_tag_types.end();
}
diff --git a/src/notetag.hpp b/src/notetag.hpp
index 4ee40ef..2a0df7a 100644
--- a/src/notetag.hpp
+++ b/src/notetag.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011,2013-2014 Aurimas Cernius
+ * Copyright (C) 2011,2013-2014,2017 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -23,7 +23,6 @@
#ifndef __NOTE_TAG_HPP_
#define __NOTE_TAG_HPP_
-#include <string>
#include <map>
#include <sigc++/signal.h>
@@ -73,11 +72,11 @@ public:
CAN_SPLIT = 32
};
- static Ptr create(const std::string & tag_name, int flags) throw(sharp::Exception)
+ static Ptr create(const Glib::ustring & tag_name, int flags) throw(sharp::Exception)
{
return Ptr(new NoteTag(tag_name, flags));
}
- const std::string & get_element_name() const
+ const Glib::ustring & get_element_name() const
{
return m_element_name;
}
@@ -159,9 +158,9 @@ public:
property_foreground_gdk().set_value(render_foreground(value));
}
protected:
- NoteTag(const std::string & tag_name, int flags = 0) throw(sharp::Exception);
+ NoteTag(const Glib::ustring & tag_name, int flags = 0) throw(sharp::Exception);
NoteTag();
- virtual void initialize(const std::string & element_name);
+ virtual void initialize(const Glib::ustring & element_name);
friend class NoteTagTable;
@@ -171,7 +170,7 @@ private:
Gdk::Color get_background() const;
Gdk::Color render_foreground(ContrastPaletteColor symbol);
- std::string m_element_name;
+ Glib::ustring m_element_name;
Glib::RefPtr<Gtk::TextMark> m_widget_location;
Gtk::Widget * m_widget;
bool m_allow_middle_activate;
@@ -189,7 +188,7 @@ class DynamicNoteTag
public:
typedef Glib::RefPtr<DynamicNoteTag> Ptr;
typedef Glib::RefPtr<const DynamicNoteTag> ConstPtr;
- typedef std::map<std::string, std::string> AttributeMap;
+ typedef std::map<Glib::ustring, Glib::ustring> AttributeMap;
const AttributeMap & get_attributes() const
{
@@ -209,7 +208,7 @@ public:
/// A <see cref="System.String"/> that is the name of the
/// newly read attribute.
/// </param>
- virtual void on_attribute_read(const std::string &)
+ virtual void on_attribute_read(const Glib::ustring &)
{
}
@@ -245,8 +244,8 @@ private:
class TagType
{
public:
- typedef sigc::signal<DynamicNoteTag::Ptr, const std::string &> Factory;
- typedef sigc::slot<DynamicNoteTag::Ptr, const std::string &> FactorySlot;
+ typedef sigc::signal<DynamicNoteTag::Ptr, const Glib::ustring &> Factory;
+ typedef sigc::slot<DynamicNoteTag::Ptr, const Glib::ustring &> FactorySlot;
TagType(const FactorySlot & factory)
{
m_factory.connect(factory);
@@ -257,7 +256,7 @@ public:
}
TagType()
{}
- DynamicNoteTag::Ptr create(const std::string & name)
+ DynamicNoteTag::Ptr create(const Glib::ustring & name)
{
return m_factory(name);
}
@@ -297,9 +296,9 @@ public:
ChangeType get_change_type(const Glib::RefPtr<Gtk::TextTag> &tag);
DepthNoteTag::Ptr get_depth_tag(int depth, Pango::Direction direction);
- DynamicNoteTag::Ptr create_dynamic_tag(const std::string & );
- void register_dynamic_tag (const std::string & tag_name, const Factory & factory);
- bool is_dynamic_tag_registered(const std::string &);
+ DynamicNoteTag::Ptr create_dynamic_tag(const Glib::ustring & );
+ void register_dynamic_tag(const Glib::ustring & tag_name, const Factory & factory);
+ bool is_dynamic_tag_registered(const Glib::ustring &);
NoteTag::Ptr get_url_tag() const
@@ -329,7 +328,7 @@ private:
void _init_common_tags();
static NoteTagTable::Ptr s_instance;
- std::map<std::string, Factory> m_tag_types;
+ std::map<Glib::ustring, Factory> m_tag_types;
std::list<Glib::RefPtr<Gtk::TextTag> > m_added_tags;
NoteTag::Ptr m_url_tag;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]