Tidying.
[libdcp.git] / src / ref.h
index fd15c29e24556d720e95b963cc5738762aec7684..d306f963429d25274dc661fa1cbcad7a37517bbf 100644 (file)
--- a/src/ref.h
+++ b/src/ref.h
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
     files in the program, then also delete it here.
 */
 
+
 /** @file  src/ref.h
- *  @brief Ref class.
+ *  @brief Ref class
  */
 
+
 #ifndef LIBDCP_REF_H
 #define LIBDCP_REF_H
 
+
 #include "exceptions.h"
 #include "asset.h"
 #include "util.h"
-#include <boost/shared_ptr.hpp>
+#include <memory>
 #include <string>
 
+
 namespace dcp {
 
+
 /** @class Ref
- *  @brief A reference to an asset which is identified by a universally-unique identifier (UUID).
+ *  @brief A reference to an asset which is identified by a universally-unique identifier (UUID)
  *
  *  This class is a `pointer' to a thing.  It will always know the
  *  UUID of the thing, and it may have a shared_ptr to the C++ object
  *  which represents the thing.
  *
  *  If the Ref does not have a shared_ptr it may be given one by
- *  calling resolve() with a list of assets.  The shared_ptr will be
- *  set up using any object on the list which has a matching ID.
+ *  calling resolve() with a vector of assets.  The shared_ptr will be
+ *  set up using any object on the vector which has a matching ID.
  */
 class Ref
 {
@@ -66,7 +71,7 @@ public:
        {}
 
        /** Initialise a Ref with a shared_ptr to an asset */
-       explicit Ref (boost::shared_ptr<Asset> asset)
+       explicit Ref (std::shared_ptr<Asset> asset)
                : _id (asset->id ())
                , _asset (asset)
        {}
@@ -77,7 +82,10 @@ public:
                _id = id;
        }
 
-       void resolve (std::list<boost::shared_ptr<Asset> > assets);
+       /** Look through a list of assets and copy a shared_ptr to any asset
+        *  which matches the ID of this one
+        */
+       void resolve (std::vector<std::shared_ptr<Asset>> assets);
 
        /** @return the ID of the thing that we are pointing to */
        std::string id () const {
@@ -85,9 +93,9 @@ public:
        }
 
        /** @return a shared_ptr to the thing; an UnresolvedRefError is thrown
-        *  if the shared_ptr is not known.
+        *  if the shared_ptr is not known
         */
-       boost::shared_ptr<Asset> asset () const {
+       std::shared_ptr<Asset> asset () const {
                if (!_asset) {
                        throw UnresolvedRefError (_id);
                }
@@ -96,7 +104,7 @@ public:
        }
 
        /** operator-> to access the shared_ptr; an UnresolvedRefError is thrown
-        *  if the shared_ptr is not known.
+        *  if the shared_ptr is not known
         */
        Asset * operator->() const {
                if (!_asset) {
@@ -113,9 +121,11 @@ public:
 
 private:
        std::string _id;             ///< ID; will always be known
-       boost::shared_ptr<Asset> _asset; ///< shared_ptr to the thing, may be null.
+       std::shared_ptr<Asset> _asset; ///< shared_ptr to the thing, may be null.
 };
 
+
 }
 
+
 #endif