#include <iostream>
#include <boost/filesystem.hpp>
-#include <boost/lexical_cast.hpp>
#include <boost/function.hpp>
#include <libxml++/nodes/element.h>
#include "AS_DCP.h"
#include "util.h"
#include "metadata.h"
#include "compose.hpp"
+#include "raw_convert.h"
using std::string;
using boost::shared_ptr;
-using boost::lexical_cast;
using namespace libdcp;
Asset::Asset (boost::filesystem::path directory, boost::filesystem::path file_name)
asset->add_child("Id")->add_child_text ("urn:uuid:" + _uuid);
asset->add_child("AnnotationText")->add_child_text (_file_name.string ());
asset->add_child("Hash")->add_child_text (digest ());
- asset->add_child("Size")->add_child_text (lexical_cast<string> (boost::filesystem::file_size(path())));
+ asset->add_child("Size")->add_child_text (raw_convert<string> (boost::filesystem::file_size(path())));
if (interop) {
asset->add_child("Type")->add_child_text (String::compose ("application/x-smpte-mxf;asdcpKind=%1", asdcp_kind ()));
} else {
chunk->add_child("Path")->add_child_text (_file_name.string ());
chunk->add_child("VolumeIndex")->add_child_text ("1");
chunk->add_child("Offset")->add_child_text ("0");
- chunk->add_child("Length")->add_child_text (lexical_cast<string> (boost::filesystem::file_size(path())));
+ chunk->add_child("Length")->add_child_text (raw_convert<string> (boost::filesystem::file_size(path())));
}
boost::filesystem::path
/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "signer.h"
#include "exceptions.h"
#include "compose.hpp"
+#include "raw_convert.h"
using std::string;
using std::stringstream;
xmlpp::Node* asset = node->add_child ("Asset");
asset->add_child("Id")->add_child_text ("urn:uuid:" + _id);
asset->add_child("Hash")->add_child_text (_digest);
- asset->add_child("Size")->add_child_text (lexical_cast<string> (_length));
+ asset->add_child("Size")->add_child_text (raw_convert<string> (_length));
if (interop) {
asset->add_child("Type")->add_child_text ("text/xml;asdcpKind=CPL");
} else {
chunk->add_child("Path")->add_child_text (_id + "_cpl.xml");
chunk->add_child("VolumeIndex")->add_child_text ("1");
chunk->add_child("Offset")->add_child_text("0");
- chunk->add_child("Length")->add_child_text(lexical_cast<string> (_length));
+ chunk->add_child("Length")->add_child_text (raw_convert<string> (_length));
}
#include <cassert>
#include <iostream>
#include <boost/filesystem.hpp>
-#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
-#include <boost/lexical_cast.hpp>
#include <libxml++/libxml++.h>
#include <xmlsec/xmldsig.h>
#include <xmlsec/app.h>
#include "cpl.h"
#include "signer.h"
#include "kdm.h"
+#include "raw_convert.h"
using std::string;
using std::list;
using std::back_inserter;
using std::make_pair;
using boost::shared_ptr;
-using boost::lexical_cast;
using namespace libdcp;
DCP::DCP (boost::filesystem::path directory)
chunk->add_child("Path")->add_child_text (pkl_uuid + "_pkl.xml");
chunk->add_child("VolumeIndex")->add_child_text ("1");
chunk->add_child("Offset")->add_child_text ("0");
- chunk->add_child("Length")->add_child_text (lexical_cast<string> (pkl_length));
+ chunk->add_child("Length")->add_child_text (raw_convert<string> (pkl_length));
for (list<shared_ptr<CPL> >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) {
(*i)->write_to_assetmap (asset_list);
#include <iostream>
#include <vector>
#include <boost/algorithm/string.hpp>
-#include <boost/lexical_cast.hpp>
#include <cmath>
#include "dcp_time.h"
#include "exceptions.h"
+#include "raw_convert.h"
using namespace std;
using namespace boost;
boost::throw_exception (DCPReadError ("unrecognised time specification"));
}
- h = lexical_cast<int> (b[0]);
- m = lexical_cast<int> (b[1]);
- s = lexical_cast<int> (b[2]);
- t = lexical_cast<int> (b[3]);
+ h = raw_convert<int> (b[0]);
+ m = raw_convert<int> (b[1]);
+ s = raw_convert<int> (b[2]);
+ t = raw_convert<int> (b[3]);
}
bool
/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
using std::ostream;
using std::string;
using boost::shared_ptr;
-using boost::lexical_cast;
using namespace libdcp;
struct MonoPictureAssetWriter::ASDCPState : public ASDCPStateBase
#include <iostream>
#include <boost/filesystem.hpp>
-#include <boost/lexical_cast.hpp>
#include <libxml++/nodes/element.h>
#include "AS_DCP.h"
#include "KM_prng.h"
#include "metadata.h"
#include "exceptions.h"
#include "kdm.h"
+#include "raw_convert.h"
using std::string;
using std::list;
using std::pair;
using boost::shared_ptr;
-using boost::lexical_cast;
using boost::dynamic_pointer_cast;
using namespace libdcp;
}
a->add_child ("Id")->add_child_text ("urn:uuid:" + _uuid);
a->add_child ("AnnotationText")->add_child_text (_file_name.string ());
- a->add_child ("EditRate")->add_child_text (lexical_cast<string> (_edit_rate) + " 1");
- a->add_child ("IntrinsicDuration")->add_child_text (lexical_cast<string> (_intrinsic_duration));
- a->add_child ("EntryPoint")->add_child_text (lexical_cast<string> (_entry_point));
- a->add_child ("Duration")->add_child_text (lexical_cast<string> (_duration));
+ a->add_child ("EditRate")->add_child_text (raw_convert<string> (_edit_rate) + " 1");
+ a->add_child ("IntrinsicDuration")->add_child_text (raw_convert<string> (_intrinsic_duration));
+ a->add_child ("EntryPoint")->add_child_text (raw_convert<string> (_entry_point));
+ a->add_child ("Duration")->add_child_text (raw_convert<string> (_duration));
if (!_key_id.empty ()) {
a->add_child("KeyId")->add_child_text ("urn:uuid:" + _key_id);
}
/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
#include "subtitle.h"
+#include "../raw_convert.h"
#include "../types.h"
using std::string;
} else if (u.find (":") != string::npos) {
t = Time (u);
} else {
- t = Time (0, 0, 0, lexical_cast<int> (u));
+ t = Time (0, 0, 0, raw_convert<int> (u));
}
if (t > Time (0, 0, 8, 0)) {
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "exceptions.h"
#include "xyz_frame.h"
#include "picture_asset_writer.h"
+#include "raw_convert.h"
using std::string;
using std::ostream;
assert (i != c.end ());
- (*i)->add_child ("FrameRate")->add_child_text (lexical_cast<string> (_edit_rate * edit_rate_factor ()) + " 1");
+ (*i)->add_child ("FrameRate")->add_child_text (raw_convert<string> (_edit_rate * edit_rate_factor ()) + " 1");
if (_interop) {
stringstream s;
s << std::fixed << std::setprecision (2) << (float (_size.width) / _size.height);
(*i)->add_child ("ScreenAspectRatio")->add_child_text (s.str ());
} else {
- (*i)->add_child ("ScreenAspectRatio")->add_child_text (lexical_cast<string> (_size.width) + " " + lexical_cast<string> (_size.height));
+ (*i)->add_child ("ScreenAspectRatio")->add_child_text (raw_convert<string> (_size.width) + " " + raw_convert<string> (_size.height));
}
}
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <fstream>
#include <cerrno>
-#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <libxml++/nodes/element.h>
#include "AS_DCP.h"
#include "parse/subtitle.h"
#include "util.h"
#include "xml.h"
+#include "raw_convert.h"
using std::string;
using std::list;
using std::stringstream;
using std::cout;
using boost::shared_ptr;
-using boost::lexical_cast;
using boost::optional;
using namespace libdcp;
if (_movie_title) {
root->add_child("MovieTitle")->add_child_text (_movie_title.get ());
}
- root->add_child("ReelNumber")->add_child_text (lexical_cast<string> (_reel_number));
+ root->add_child("ReelNumber")->add_child_text (raw_convert<string> (_reel_number));
root->add_child("Language")->add_child_text (_language);
if (_load_font_nodes.size() > 1) {
font->set_attribute ("Id", id);
font->set_attribute ("Italic", italic ? "yes" : "no");
font->set_attribute ("Color", color.to_argb_string());
- font->set_attribute ("Size", lexical_cast<string> (size));
+ font->set_attribute ("Size", raw_convert<string> (size));
font->set_attribute ("Effect", effect_to_string (effect));
font->set_attribute ("EffectColor", effect_color.to_argb_string());
font->set_attribute ("Script", "normal");
)) {
subtitle = font->add_child ("Subtitle");
- subtitle->set_attribute ("SpotNumber", lexical_cast<string> (spot_number++));
+ subtitle->set_attribute ("SpotNumber", raw_convert<string> (spot_number++));
subtitle->set_attribute ("TimeIn", (*i)->in().to_string());
subtitle->set_attribute ("TimeOut", (*i)->out().to_string());
- subtitle->set_attribute ("FadeUpTime", lexical_cast<string> ((*i)->fade_up_time().to_ticks()));
- subtitle->set_attribute ("FadeDownTime", lexical_cast<string> ((*i)->fade_down_time().to_ticks()));
+ subtitle->set_attribute ("FadeUpTime", raw_convert<string> ((*i)->fade_up_time().to_ticks()));
+ subtitle->set_attribute ("FadeDownTime", raw_convert<string> ((*i)->fade_down_time().to_ticks()));
last_in = (*i)->in ();
last_out = (*i)->out ();
xmlpp::Element* text = subtitle->add_child ("Text");
text->set_attribute ("VAlign", valign_to_string ((*i)->v_align()));
- text->set_attribute ("VPosition", lexical_cast<string> ((*i)->v_position()));
+ text->set_attribute ("VPosition", raw_convert<string> ((*i)->v_position()));
text->add_child_text ((*i)->text());
}
+/*
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
#include <vector>
#include <cstdio>
#include <iomanip>
#include <boost/algorithm/string.hpp>
#include "types.h"
#include "exceptions.h"
+#include "raw_convert.h"
using namespace std;
using namespace libdcp;
if (b.size() != 2) {
boost::throw_exception (XMLError ("malformed fraction " + s + " in XML node"));
}
- numerator = lexical_cast<int> (b[0]);
- denominator = lexical_cast<int> (b[1]);
+ numerator = raw_convert<int> (b[0]);
+ denominator = raw_convert<int> (b[1]);
}
bool