diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-11-29 23:45:59 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-12-04 21:12:46 +0000 |
| commit | d4a2e054dee6ee80b578500e47f4eaf84731f140 (patch) | |
| tree | bcbf36b8e6b64800e01dd3cd0b440e1cf1a52bf8 /src/data.h | |
| parent | 660f1059c3b2c1ee08cd390cf6d5a0b5900a7edc (diff) | |
Take DCP-o-matic's version of Data class.
Diffstat (limited to 'src/data.h')
| -rw-r--r-- | src/data.h | 32 |
1 files changed, 18 insertions, 14 deletions
@@ -20,33 +20,37 @@ #ifndef LIBDCP_DATA_H #define LIBDCP_DATA_H -/** @file src/data.h - * @brief Data class. - */ - #include <boost/shared_array.hpp> #include <boost/filesystem.hpp> #include <stdint.h> 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<uint8_t> data, int size); + Data (boost::filesystem::path file); - Data (boost::shared_array<uint8_t> 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<uint8_t> data () const { + return _data; + } + + int size () const { + return _size; + } - boost::shared_array<uint8_t> data; - boost::uintmax_t size; +private: + boost::shared_array<uint8_t> _data; + int _size; }; } |
