Fix/hide some warnings.
[libdcp.git] / src / array_data.h
index 09cfd09deeecd360b59f4a30d1ef6ef6eb623ecc..da7229bbcce646a3a96b9c2f4d2684e4ff0ef61a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
     files in the program, then also delete it here.
 */
 
+
+/** @file  src/array_data.h
+ *  @brief ArrayData class.
+ */
+
+
 #ifndef LIBDCP_ARRAY_DATA_H
 #define LIBDCP_ARRAY_DATA_H
 
 #include <boost/filesystem.hpp>
 #include <stdint.h>
 
+
 namespace dcp {
 
 
+/** @brief Class to hold an arbitrary block of data */
 class ArrayData : public Data
 {
 public:
        ArrayData ();
        explicit ArrayData (int size);
        ArrayData (uint8_t const * data, int size);
+
+       /** Create an ArrayData by copying a shared_array<>
+        *  @param data shared_array<> to copy (the shared_array<> is copied, not the data)
+        *  @param size Size of data in bytes
+        */
        ArrayData (boost::shared_array<uint8_t> data, int size);
+
+       /** Create an ArrayData by reading the contents of a file
+        *  @param file Filename to read
+        */
        explicit ArrayData (boost::filesystem::path file);
 
        virtual ~ArrayData () {}
 
-       uint8_t const * data () const {
+       uint8_t const * data () const override {
                return _data.get();
        }
 
-       uint8_t * data () {
+       uint8_t * data () override {
                return _data.get();
        }
 
-       int size () const {
+       /** @return size of the data in _data, or whatever was last
+        *  passed to a set_size() call
+        */
+       int size () const override {
                return _size;
        }
 
+       /** Set the size that will be returned from size() */
        void set_size (int s) {
                _size = s;
        }
@@ -73,9 +94,11 @@ public:
 private:
        boost::shared_array<uint8_t> _data;
        /** amount of `valid' data in _data; the array may be larger */
-       int _size;
+       int _size = 0;
 };
 
+
 }
 
+
 #endif