Use an enum class for Marker.
[libdcp.git] / src / util.h
index 992c5a61d8e38a92a43f0e63f0b2ca23f97f1bf4..232b91ccb44a80b13883fc0a29bd12754716a0f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
  *  @brief Utility methods.
  */
 
+
+#include "array_data.h"
 #include "types.h"
-#include "data.h"
-#include <boost/shared_ptr.hpp>
+#include "local_time.h"
+#include <asdcp/KM_log.h>
+#include <memory>
 #include <boost/function.hpp>
 #include <boost/filesystem.hpp>
 #include <boost/optional.hpp>
 #include <string>
 #include <stdint.h>
 
+#define LIBDCP_UNUSED(x) (void)(x)
+
 namespace xmlpp {
        class Element;
        class Node;
@@ -60,11 +65,11 @@ class OpenJPEGImage;
 
 extern std::string make_uuid ();
 extern std::string make_digest (boost::filesystem::path filename, boost::function<void (float)>);
-extern std::string make_digest (Data data);
+extern std::string make_digest (ArrayData data);
 extern bool empty_or_white_space (std::string s);
 extern bool ids_equal (std::string a, std::string b);
 extern std::string remove_urn_uuid (std::string raw);
-extern void init ();
+extern void init (boost::optional<boost::filesystem::path> tags_directory = boost::optional<boost::filesystem::path>());
 
 extern int base64_decode (std::string const & in, unsigned char* out, int out_length);
 extern boost::optional<boost::filesystem::path> relative_to_root (boost::filesystem::path root, boost::filesystem::path file);
@@ -75,6 +80,24 @@ extern xmlpp::Node* find_child (xmlpp::Node const * node, std::string name);
 extern std::string openjpeg_version();
 extern std::string spaces (int n);
 extern void indent (xmlpp::Element* element, int initial);
+extern bool day_less_than_or_equal (LocalTime a, LocalTime b);
+extern bool day_greater_than_or_equal (LocalTime a, LocalTime b);
+extern std::string unique_string (std::vector<std::string> existing, std::string base);
+extern ASDCP::Dictionary const* asdcp_smpte_dict;
+
+
+class ASDCPErrorSuspender
+{
+public:
+       ASDCPErrorSuspender();
+       ~ASDCPErrorSuspender();
+
+private:
+       Kumu::LogEntryList _log;
+       Kumu::ILogSink& _old;
+       Kumu::EntryListLogSink* _sink;
+};
+
 
 }