From d4a2e054dee6ee80b578500e47f4eaf84731f140 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 29 Nov 2015 23:45:59 +0000 Subject: Take DCP-o-matic's version of Data class. --- src/data.h | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'src/data.h') diff --git a/src/data.h b/src/data.h index 12949fe4..60689031 100644 --- a/src/data.h +++ b/src/data.h @@ -20,33 +20,37 @@ #ifndef LIBDCP_DATA_H #define LIBDCP_DATA_H -/** @file src/data.h - * @brief Data class. - */ - #include #include #include namespace dcp { -/** A block of arbitrary data */ class Data { public: - Data () {} + Data (); + Data (int size); + Data (uint8_t const * data, int size); + Data (boost::shared_array data, int size); + Data (boost::filesystem::path file); - Data (boost::shared_array data_, boost::uintmax_t size_) - : data (data_) - , size (size_) - {} + virtual ~Data () {} - Data (uint8_t const * data, boost::uintmax_t size_); + void write (boost::filesystem::path file) const; + void write_via_temp (boost::filesystem::path temp, boost::filesystem::path final) const; - Data (boost::filesystem::path file); + boost::shared_array data () const { + return _data; + } + + int size () const { + return _size; + } - boost::shared_array data; - boost::uintmax_t size; +private: + boost::shared_array _data; + int _size; }; } -- cgit v1.2.3