Keep ID::print in place for now and replace usage in subsequent commit to
minimize changes
#include <inttypes.h>
#include "pbd/id.h"
#include <inttypes.h>
#include "pbd/id.h"
+#include "pbd/string_convert.h"
+
#include <string>
using namespace std;
#include <string>
using namespace std;
ID::string_assign (string str)
{
ID::string_assign (string str)
{
- return sscanf (str.c_str(), "%" PRIu64, &_id) != 0;
+ return string_to_uint64 (str, _id);
snprintf (buf, bufsize, "%" PRIu64, _id);
}
snprintf (buf, bufsize, "%" PRIu64, _id);
}
+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
{
}
bool
ID::operator== (const string& str) const
{
+ return to_string (_id) == str;
-operator<< (ostream& ostr, const ID& _id)
+operator<< (ostream& ostr, const ID& id)
- char buf[32];
- _id.print (buf, sizeof (buf));
- ostr << buf;
}
void print (char* buf, uint32_t bufsize) const;
}
void print (char* buf, uint32_t bufsize) const;
- std::string to_s() const;
+
+ std::string to_s () const;
static uint64_t counter() { return _counter; }
static void init_counter (uint64_t val) { _counter = val; }
static uint64_t counter() { return _counter; }
static void init_counter (uint64_t val) { _counter = val; }
- int string_assign (std::string);
+ bool string_assign (std::string);
static Glib::Threads::Mutex* counter_lock;
static uint64_t _counter;
static Glib::Threads::Mutex* counter_lock;
static uint64_t _counter;