summaryrefslogtreecommitdiff
path: root/src/data.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-11-29 23:45:59 +0000
committerCarl Hetherington <cth@carlh.net>2015-12-04 21:12:46 +0000
commitd4a2e054dee6ee80b578500e47f4eaf84731f140 (patch)
treebcbf36b8e6b64800e01dd3cd0b440e1cf1a52bf8 /src/data.h
parent660f1059c3b2c1ee08cd390cf6d5a0b5900a7edc (diff)
Take DCP-o-matic's version of Data class.
Diffstat (limited to 'src/data.h')
-rw-r--r--src/data.h32
1 files changed, 18 insertions, 14 deletions
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 <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;
};
}