summaryrefslogtreecommitdiff
path: root/libs/ardour/presentation_info.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2016-08-28 20:43:17 +1000
committerTim Mayberry <mojofunk@gmail.com>2017-04-19 09:36:53 +1000
commit20400af96f92c85be9d6ec9d9d470d5e32e069b6 (patch)
tree6f5ef892a09400c8a19d00f493feeda3b09075f2 /libs/ardour/presentation_info.cc
parent7798179558076ddd3c0369b322e617ebd4fe037b (diff)
Use XMLNode::get/set_property API in ARDOUR::PresentationInfo class
Diffstat (limited to 'libs/ardour/presentation_info.cc')
-rw-r--r--libs/ardour/presentation_info.cc32
1 files changed, 17 insertions, 15 deletions
diff --git a/libs/ardour/presentation_info.cc b/libs/ardour/presentation_info.cc
index e3e7700d40..f269541de0 100644
--- a/libs/ardour/presentation_info.cc
+++ b/libs/ardour/presentation_info.cc
@@ -21,8 +21,8 @@
#include <cassert>
-#include "pbd/convert.h"
#include "pbd/debug.h"
+#include "pbd/enum_convert.h"
#include "pbd/enumwriter.h"
#include "pbd/error.h"
#include "pbd/failed_constructor.h"
@@ -33,6 +33,10 @@
#include "pbd/i18n.h"
+namespace PBD {
+ DEFINE_ENUM_CONVERT(ARDOUR::PresentationInfo::Flag);
+}
+
using namespace ARDOUR;
using namespace PBD;
using std::string;
@@ -150,9 +154,9 @@ XMLNode&
PresentationInfo::get_state ()
{
XMLNode* node = new XMLNode (state_node_name);
- node->add_property ("order", PBD::to_string (_order, std::dec));
- node->add_property ("flags", enum_2_string (_flags));
- node->add_property ("color", PBD::to_string (_color, std::dec));
+ node->set_property ("order", _order);
+ node->set_property ("flags", _flags);
+ node->set_property ("color", _color);
return *node;
}
@@ -164,28 +168,27 @@ PresentationInfo::set_state (XMLNode const& node, int /* version */)
return -1;
}
- XMLProperty const* prop;
PropertyChange pc;
- if ((prop = node.property (X_("order"))) != 0) {
- order_t o = atoi (prop->value());
+ order_t o;
+ if (node.get_property (X_("order"), o)) {
if (o != _order) {
pc.add (Properties::order);
_order = o;
}
- _order = atoi (prop->value());
+ _order = o; // huh?
}
- if ((prop = node.property (X_("flags"))) != 0) {
- Flag f = Flag (string_2_enum (prop->value(), f));
+ Flag f;
+ if (node.get_property (X_("flags"), f)) {
if ((f&Hidden) != (_flags&Hidden)) {
pc.add (Properties::hidden);
}
_flags = f;
}
- if ((prop = node.property (X_("color"))) != 0) {
- color_t c = atoi (prop->value());
+ color_t c;
+ if (node.get_property (X_("color"), c)) {
if (c != _color) {
pc.add (Properties::color);
_color = c;
@@ -207,9 +210,8 @@ PresentationInfo::get_flags (XMLNode const& node)
XMLNode* child = *niter;
if (child->name() == PresentationInfo::state_node_name) {
- XMLProperty const* prop = child->property (X_("flags"));
- if (prop) {
- Flag f = (Flag) string_2_enum (prop->value(), f);
+ Flag f;
+ if (child->get_property (X_("flags"), f)) {
return f;
}
}