[gnote] Replace std::string by Glib::ustring in Uri
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Replace std::string by Glib::ustring in Uri
- Date: Fri, 27 Jan 2017 21:17:41 +0000 (UTC)
commit a97dea1173b64e09432cce4d97cf783d52209990
Author: Aurimas Černius <aurisc4 gmail com>
Date: Fri Jan 27 22:48:36 2017 +0200
Replace std::string by Glib::ustring in Uri
src/sharp/uri.cpp | 16 ++++++++--------
src/sharp/uri.hpp | 12 ++++++------
2 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/sharp/uri.cpp b/src/sharp/uri.cpp
index 11ba0ea..0116bd3 100644
--- a/src/sharp/uri.cpp
+++ b/src/sharp/uri.cpp
@@ -25,7 +25,7 @@
*/
-#include <glibmm.h>
+#include <glibmm/stringutils.h>
#include "sharp/string.hpp"
#include "sharp/uri.hpp"
@@ -46,22 +46,22 @@ namespace sharp {
/// TODO this function does not behave as expected.
// it does not handle local_path for non file URI.
- std::string Uri::local_path() const
+ Glib::ustring Uri::local_path() const
{
if(!is_file()) {
return m_uri;
}
- return string_replace_first(m_uri, std::string(FILE_URI_SCHEME) + "//", "");
+ return string_replace_first(m_uri, Glib::ustring(FILE_URI_SCHEME) + "//", "");
}
- bool Uri::_is_scheme(const std::string & scheme) const
+ bool Uri::_is_scheme(const Glib::ustring & scheme) const
{
return Glib::str_has_prefix(m_uri, scheme);
}
- std::string Uri::get_host() const
+ Glib::ustring Uri::get_host() const
{
- std::string host;
+ Glib::ustring host;
if(!is_file()) {
if(_is_scheme(HTTP_URI_SCHEME) || _is_scheme(HTTPS_URI_SCHEME)
@@ -82,14 +82,14 @@ namespace sharp {
}
- std::string Uri::get_absolute_uri() const
+ Glib::ustring Uri::get_absolute_uri() const
{
return m_uri;
}
/** this is a very minimalistic implementation */
- std::string Uri::escape_uri_string(const std::string &s)
+ Glib::ustring Uri::escape_uri_string(const Glib::ustring &s)
{
return string_replace_all(s, " ", "%20");
}
diff --git a/src/sharp/uri.hpp b/src/sharp/uri.hpp
index df19ac2..60f296a 100644
--- a/src/sharp/uri.hpp
+++ b/src/sharp/uri.hpp
@@ -37,7 +37,7 @@ namespace sharp {
class Uri
{
public:
- Uri(const std::string & u)
+ Uri(const Glib::ustring & u)
: m_uri(u)
{
}
@@ -46,12 +46,12 @@ namespace sharp {
return m_uri;
}
bool is_file() const;
- std::string local_path() const;
- std::string get_host() const;
- std::string get_absolute_uri() const;
- static std::string escape_uri_string(const std::string &);
+ Glib::ustring local_path() const;
+ Glib::ustring get_host() const;
+ Glib::ustring get_absolute_uri() const;
+ static Glib::ustring escape_uri_string(const Glib::ustring &);
private:
- bool _is_scheme(const std::string & scheme) const;
+ bool _is_scheme(const Glib::ustring & scheme) const;
Glib::ustring m_uri;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]