Remove now unused PBD::string_is_affirmative function
[ardour.git] / libs / pbd / id.cc
index c9823f0dc8e5f2589ac8f163e40050c9232bfd73..d50782434931ea37fd38fbf2d9ffb05157c60f58 100644 (file)
 #include <ostream>
 #include <stdio.h>
 
-#ifndef __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS
-#endif
-#include <inttypes.h>
-
 #include "pbd/id.h"
+#include "pbd/string_convert.h"
+
 #include <string>
 
 using namespace std;
@@ -61,31 +58,24 @@ ID::reset ()
 {
        Glib::Threads::Mutex::Lock lm (*counter_lock);
        _id = _counter++;
-}      
-
-int
-ID::string_assign (string str)
-{
-       return sscanf (str.c_str(), "%" PRIu64, &_id) != 0;
 }
 
-void
-ID::print (char* buf, uint32_t bufsize) const
+bool
+ID::string_assign (string str)
 {
-       snprintf (buf, bufsize, "%" PRIu64, _id);
+       return string_to_uint64 (str, _id);
 }
 
-string ID::to_s() const
+std::string
+ID::to_s () const
 {
-    char buf[32]; // see print()
-    print(buf, sizeof (buf));
-    return string(buf);
+       return to_string (_id);
 }
 
 bool
 ID::operator== (const string& str) const
 {
-       return to_s() == str;
+       return to_string (_id) == str;
 }
 
 ID&
@@ -105,11 +95,9 @@ ID::operator= (const ID& other)
 }
 
 ostream&
-operator<< (ostream& ostr, const ID& _id)
+operator<< (ostream& ostr, const ID& id)
 {
-       char buf[32];
-       _id.print (buf, sizeof (buf));
-       ostr << buf;
+       ostr << id.to_s();
        return ostr;
 }