[gnote] Remove boost::format and use Glib::ustring in timespan



commit 092c08007f74334ff4049269362827041c8798b3
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Mon Jan 9 23:19:46 2017 +0200

    Remove boost::format and use Glib::ustring in timespan

 src/sharp/timespan.cpp |   15 ++++++---------
 src/sharp/timespan.hpp |    8 ++++----
 2 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/src/sharp/timespan.cpp b/src/sharp/timespan.cpp
index f319e75..cf44eb0 100644
--- a/src/sharp/timespan.cpp
+++ b/src/sharp/timespan.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013 Aurimas Cernius
+ * Copyright (C) 2012-2013,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
@@ -18,8 +18,6 @@
  */
 
 
-#include <boost/format.hpp>
-
 #include "base/macros.hpp"
 #include "string.hpp"
 #include "timespan.hpp"
@@ -84,9 +82,9 @@ namespace sharp {
   }
 
 
-  std::string TimeSpan::string() const
+  Glib::ustring TimeSpan::string() const
   {
-    return str(boost::format("%1%:%2%:%3%:%4%:%5%") % m_days % m_hours % m_minutes % m_seconds % m_usecs);
+    return Glib::ustring::compose("%1:%2:%3:%4:%5", m_days, m_hours, m_minutes, m_seconds, m_usecs);
   }
 
 
@@ -105,7 +103,7 @@ namespace sharp {
   }
 
 
-  TimeSpan TimeSpan::parse(const std::string & s)
+  TimeSpan TimeSpan::parse(const Glib::ustring & s)
   {
     std::vector<std::string> tokens;
     sharp::string_split(tokens, s, ":");
@@ -117,9 +115,8 @@ namespace sharp {
     int mins = STRING_TO_INT(tokens[2]);
     int secs = STRING_TO_INT(tokens[3]);
     int usecs = STRING_TO_INT(tokens[4]);
-    boost::format fmt("%1%:%2%:%3%:%4%:%5%");
-    fmt % days % hours % mins % secs % usecs;
-    if(str(fmt) != s) {
+    Glib::ustring fmt = Glib::ustring::compose("%1:%2:%3:%4:%5", days, hours, mins, secs, usecs);
+    if(fmt != s) {
       return TimeSpan(0, 0, 0, 0, 0);
     }
 
diff --git a/src/sharp/timespan.hpp b/src/sharp/timespan.hpp
index 2e7ca72..c31462d 100644
--- a/src/sharp/timespan.hpp
+++ b/src/sharp/timespan.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012 Aurimas Cernius
+ * Copyright (C) 2012,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
@@ -23,7 +23,7 @@
 #define _SHARP_TIMESPAN_HPP_
 
 
-#include <string>
+#include <glibmm/ustring.h>
 
 
 namespace sharp {
@@ -59,10 +59,10 @@ namespace sharp {
     double total_minutes() const;
     double total_seconds() const;
     double total_milliseconds() const;
-    std::string string() const;
+    Glib::ustring string() const;
     TimeSpan operator-(const TimeSpan & ts);
 
-    static TimeSpan parse(const std::string & s);
+    static TimeSpan parse(const Glib::ustring & s);
   private:
     int _total_hours() const;
     int _total_minutes() const;


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