FIXME: Remove all use of add_child() from xmlpp.
[dcpomatic.git] / src / lib / audio_point.cc
index b5ea2c31e6b0a81616536b05a2dd8bfe3911255b..036904520ad1bf81c4dcf507a52c6ff097e5785f 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #include "audio_point.h"
 #include <dcp/raw_convert.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
 #include <libxml++/libxml++.h>
+LIBDCP_ENABLE_WARNINGS
+
 
 using std::string;
 using dcp::raw_convert;
 
+
 AudioPoint::AudioPoint ()
 {
        for (int i = 0; i < COUNT; ++i) {
@@ -32,12 +38,14 @@ AudioPoint::AudioPoint ()
        }
 }
 
+
 AudioPoint::AudioPoint (cxml::ConstNodePtr node)
 {
-       _data[PEAK] = node->number_child<float> ("Peak");
-       _data[RMS] = node->number_child<float> ("RMS");
+       _data[PEAK] = node->number_child<float>("Peak");
+       _data[RMS] = node->number_child<float>("RMS");
 }
 
+
 AudioPoint::AudioPoint (AudioPoint const & other)
 {
        for (int i = 0; i < COUNT; ++i) {
@@ -45,6 +53,7 @@ AudioPoint::AudioPoint (AudioPoint const & other)
        }
 }
 
+
 AudioPoint &
 AudioPoint::operator= (AudioPoint const & other)
 {
@@ -59,9 +68,10 @@ AudioPoint::operator= (AudioPoint const & other)
        return *this;
 }
 
+
 void
 AudioPoint::as_xml (xmlpp::Element* parent) const
 {
-       parent->add_child ("Peak")->add_child_text (raw_convert<string> (_data[PEAK]));
-       parent->add_child ("RMS")->add_child_text (raw_convert<string> (_data[RMS]));
+       cxml::add_text_child(parent, "Peak", raw_convert<string>(_data[PEAK]));
+       cxml::add_text_child(parent, "RMS", raw_convert<string>(_data[RMS]));
 }