summaryrefslogtreecommitdiff
path: root/src/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-01-05 16:55:32 +0000
committerCarl Hetherington <cth@carlh.net>2016-01-05 16:55:32 +0000
commitca5f02dbf193fa5655c57cb25be96a3c9fd05157 (patch)
treed5be6180bca64a0f4f8af9aaef2030080787fc24 /src/util.cc
parente3b5521ac40125c3dfd9f254856cf58ea1584f79 (diff)
Put everything into dcp::dc and change DCP -> Package.
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/util.cc b/src/util.cc
index b9c21dc5..6519f11f 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -61,13 +61,13 @@ using boost::shared_array;
using boost::optional;
using boost::function;
using boost::algorithm::trim;
-using namespace dcp;
+using namespace dcp::dc;
/** Create a UUID.
* @return UUID.
*/
string
-dcp::make_uuid ()
+dcp::dc::make_uuid ()
{
char buffer[64];
Kumu::UUID id;
@@ -84,7 +84,7 @@ dcp::make_uuid ()
* @return Digest.
*/
string
-dcp::make_digest (boost::filesystem::path filename, function<void (float)> progress)
+dcp::dc::make_digest (boost::filesystem::path filename, function<void (float)> progress)
{
Kumu::FileReader reader;
Kumu::Result_t r = reader.OpenRead (filename.string().c_str ());
@@ -131,7 +131,7 @@ dcp::make_digest (boost::filesystem::path filename, function<void (float)> progr
* @return string.
*/
string
-dcp::content_kind_to_string (ContentKind kind)
+dcp::dc::content_kind_to_string (ContentKind kind)
{
switch (kind) {
case FEATURE:
@@ -164,8 +164,8 @@ dcp::content_kind_to_string (ContentKind kind)
* @param kind Content kind string.
* @return libdcp ContentKind.
*/
-dcp::ContentKind
-dcp::content_kind_from_string (string kind)
+dcp::dc::ContentKind
+dcp::dc::content_kind_from_string (string kind)
{
transform (kind.begin(), kind.end(), kind.begin(), ::tolower);
@@ -198,7 +198,7 @@ dcp::content_kind_from_string (string kind)
* @return true if the string contains only space, newline or tab characters, or is empty.
*/
bool
-dcp::empty_or_white_space (string s)
+dcp::dc::empty_or_white_space (string s)
{
for (size_t i = 0; i < s.length(); ++i) {
if (s[i] != ' ' && s[i] != '\n' && s[i] != '\t') {
@@ -213,7 +213,7 @@ dcp::empty_or_white_space (string s)
* by client applications.
*/
void
-dcp::init ()
+dcp::dc::init ()
{
if (xmlSecInit() < 0) {
throw MiscError ("could not initialise xmlsec");
@@ -234,17 +234,17 @@ dcp::init ()
}
}
-bool dcp::operator== (dcp::Size const & a, dcp::Size const & b)
+bool dcp::dc::operator== (Size const & a, Size const & b)
{
return (a.width == b.width && a.height == b.height);
}
-bool dcp::operator!= (dcp::Size const & a, dcp::Size const & b)
+bool dcp::dc::operator!= (Size const & a, Size const & b)
{
return !(a == b);
}
-ostream& dcp::operator<< (ostream& s, dcp::Size const & a)
+ostream& dcp::dc::operator<< (ostream& s, Size const & a)
{
s << a.width << "x" << a.height;
return s;
@@ -260,7 +260,7 @@ ostream& dcp::operator<< (ostream& s, dcp::Size const & a)
* @return Number of characters written to the output buffer.
*/
int
-dcp::base64_decode (string const & in, unsigned char* out, int out_length)
+dcp::dc::base64_decode (string const & in, unsigned char* out, int out_length)
{
BIO* b64 = BIO_new (BIO_f_base64 ());
@@ -293,7 +293,7 @@ dcp::base64_decode (string const & in, unsigned char* out, int out_length)
* with this wrapper.
*/
FILE *
-dcp::fopen_boost (boost::filesystem::path p, string t)
+dcp::dc::fopen_boost (boost::filesystem::path p, string t)
{
#ifdef LIBDCP_WINDOWS
wstring w (t.begin(), t.end());
@@ -305,7 +305,7 @@ dcp::fopen_boost (boost::filesystem::path p, string t)
}
optional<boost::filesystem::path>
-dcp::relative_to_root (boost::filesystem::path root, boost::filesystem::path file)
+dcp::dc::relative_to_root (boost::filesystem::path root, boost::filesystem::path file)
{
boost::filesystem::path::const_iterator i = root.begin ();
boost::filesystem::path::const_iterator j = file.begin ();
@@ -328,7 +328,7 @@ dcp::relative_to_root (boost::filesystem::path root, boost::filesystem::path fil
}
bool
-dcp::ids_equal (string a, string b)
+dcp::dc::ids_equal (string a, string b)
{
transform (a.begin(), a.end(), a.begin(), ::tolower);
transform (b.begin(), b.end(), b.begin(), ::tolower);
@@ -338,7 +338,7 @@ dcp::ids_equal (string a, string b)
}
string
-dcp::file_to_string (boost::filesystem::path p, uintmax_t max_length)
+dcp::dc::file_to_string (boost::filesystem::path p, uintmax_t max_length)
{
uintmax_t len = boost::filesystem::file_size (p);
if (len > max_length) {
@@ -365,7 +365,7 @@ dcp::file_to_string (boost::filesystem::path p, uintmax_t max_length)
* @return SHA1 fingerprint of key
*/
string
-dcp::private_key_fingerprint (string key)
+dcp::dc::private_key_fingerprint (string key)
{
boost::replace_all (key, "-----BEGIN RSA PRIVATE KEY-----\n", "");
boost::replace_all (key, "\n-----END RSA PRIVATE KEY-----\n", "");
@@ -384,7 +384,7 @@ dcp::private_key_fingerprint (string key)
}
xmlpp::Node *
-dcp::find_child (xmlpp::Node const * node, string name)
+dcp::dc::find_child (xmlpp::Node const * node, string name)
{
xmlpp::Node::NodeList c = node->get_children ();
xmlpp::Node::NodeList::iterator i = c.begin();
@@ -397,7 +397,7 @@ dcp::find_child (xmlpp::Node const * node, string name)
}
string
-dcp::remove_urn_uuid (string raw)
+dcp::dc::remove_urn_uuid (string raw)
{
DCP_ASSERT (raw.substr(0, 9) == "urn:uuid:");
return raw.substr (9);