summaryrefslogtreecommitdiff
path: root/src/lib/server.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-04-01 02:25:02 +0100
committerCarl Hetherington <cth@carlh.net>2013-04-01 02:25:02 +0100
commitb468ccabdb13fca86ae8a324239d83490ef5832e (patch)
tree816332e6d3437b3924c1fdf6ada7d61965136337 /src/lib/server.cc
parent640c53f0a5f178a894ff2718bf6d74e9e977eb80 (diff)
XML metadata and some other bits.
Diffstat (limited to 'src/lib/server.cc')
-rw-r--r--src/lib/server.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/lib/server.cc b/src/lib/server.cc
index 9c5a77f68..ca0bec580 100644
--- a/src/lib/server.cc
+++ b/src/lib/server.cc
@@ -29,6 +29,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/scoped_array.hpp>
+#include <libcxml/cxml.h>
#include "server.h"
#include "util.h"
#include "scaler.h"
@@ -51,6 +52,19 @@ using boost::bind;
using boost::scoped_array;
using libdcp::Size;
+ServerDescription::ServerDescription (shared_ptr<const cxml::Node> node)
+{
+ _host_name = node->string_child ("HostName");
+ _threads = node->number_child<int> ("Threads");
+}
+
+void
+ServerDescription::as_xml (xmlpp::Node* root) const
+{
+ root->add_child("HostName")->add_child_text (_host_name);
+ root->add_child("Threads")->add_child_text (boost::lexical_cast<string> (_threads));
+}
+
/** Create a server description from a string of metadata returned from as_metadata().
* @param v Metadata.
* @return ServerDescription, or 0.
@@ -68,15 +82,6 @@ ServerDescription::create_from_metadata (string v)
return new ServerDescription (b[0], atoi (b[1].c_str ()));
}
-/** @return Description of this server as text */
-string
-ServerDescription::as_metadata () const
-{
- stringstream s;
- s << _host_name << N_(" ") << _threads;
- return s.str ();
-}
-
Server::Server (shared_ptr<Log> log)
: _log (log)
{