[gnote] Replace std::string by Glib::ustring in DateTime
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Replace std::string by Glib::ustring in DateTime
- Date: Thu, 26 Jan 2017 21:40:01 +0000 (UTC)
commit 8bf39a3fac045ec721fed0be618f1a466498b2ec
Author: Aurimas Černius <aurisc4 gmail com>
Date: Thu Jan 26 23:05:16 2017 +0200
Replace std::string by Glib::ustring in DateTime
src/sharp/datetime.cpp | 14 +++++++-------
src/sharp/datetime.hpp | 17 ++++++++---------
2 files changed, 15 insertions(+), 16 deletions(-)
---
diff --git a/src/sharp/datetime.cpp b/src/sharp/datetime.cpp
index 82fb400..9e2449c 100644
--- a/src/sharp/datetime.cpp
+++ b/src/sharp/datetime.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012 Aurimas Cernius
+ * Copyright (C) 2012,2017 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -106,29 +106,29 @@ namespace sharp {
return ((m_date.tv_sec != -1) && (m_date.tv_usec != -1));
}
- std::string DateTime::_to_string(const char * format, struct tm * t) const
+ Glib::ustring DateTime::_to_string(const char * format, struct tm * t) const
{
char output[256];
strftime(output, sizeof(output), format, t);
return Glib::locale_to_utf8(output);
}
- std::string DateTime::to_string(const char * format) const
+ Glib::ustring DateTime::to_string(const char * format) const
{
struct tm result;
return _to_string(format, localtime_r((const time_t *)&m_date.tv_sec, &result));
}
- std::string DateTime::to_short_time_string() const
+ Glib::ustring DateTime::to_short_time_string() const
{
struct tm result;
return _to_string("%R", localtime_r((const time_t *)&m_date.tv_sec, &result));
}
- std::string DateTime::to_iso8601() const
+ Glib::ustring DateTime::to_iso8601() const
{
- std::string retval;
+ Glib::ustring retval;
if(!is_valid()) {
return retval;
}
@@ -153,7 +153,7 @@ namespace sharp {
return DateTime(n);
}
- DateTime DateTime::from_iso8601(const std::string &iso8601)
+ DateTime DateTime::from_iso8601(const Glib::ustring &iso8601)
{
DateTime retval;
if(g_time_val_from_iso8601(iso8601.c_str(), &retval.m_date)) {
diff --git a/src/sharp/datetime.hpp b/src/sharp/datetime.hpp
index 814fd1c..45b5171 100644
--- a/src/sharp/datetime.hpp
+++ b/src/sharp/datetime.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012 Aurimas Cernius
+ * Copyright (C) 2012,2017 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -31,8 +31,7 @@
#include <time.h>
-#include <string>
-
+#include <glibmm/ustring.h>
#include <glibmm/timeval.h>
#include "timespan.hpp"
@@ -58,16 +57,16 @@ public:
bool is_valid() const;
- std::string to_string(const char * format) const;
- std::string to_string(const std::string & format) const
+ Glib::ustring to_string(const char * format) const;
+ Glib::ustring to_string(const Glib::ustring & format) const
{
return to_string(format.c_str());
}
- std::string to_short_time_string() const;
- std::string to_iso8601() const;
+ Glib::ustring to_short_time_string() const;
+ Glib::ustring to_iso8601() const;
static DateTime now();
- static DateTime from_iso8601(const std::string &);
+ static DateTime from_iso8601(const Glib::ustring &);
static int compare(const DateTime &, const DateTime &);
bool operator==(const DateTime & dt) const;
@@ -105,7 +104,7 @@ public:
}
private:
// return the string formatted according to strftime
- std::string _to_string(const char * format, struct tm *) const;
+ Glib::ustring _to_string(const char * format, struct tm *) const;
Glib::TimeVal m_date;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]