lottie: make animation class constructor private. 81/189581/1
authorsubhransu mohanty <sub.mohanty@samsung.com>
Wed, 19 Sep 2018 02:29:26 +0000 (11:29 +0900)
committersubhransu mohanty <sub.mohanty@samsung.com>
Wed, 19 Sep 2018 02:29:26 +0000 (11:29 +0900)
we can't use make_unique to create the animation object anymore because the constructor is private.
so used unique_ptr constructor instead.

Change-Id: I23b68c68d1b960085800365662ebb1cc676731cc

inc/lottieanimation.h
src/lottie/lottieanimation.cpp

index c2a4e26..08edd48 100644 (file)
@@ -28,7 +28,7 @@
 #endif
 
 class AnimationImpl;
-class LOTNode;
+struct LOTNode;
 
 namespace lottie {
 
@@ -209,17 +209,12 @@ public:
      */
     ~Animation();
 
+private:
     /**
      *  @brief default constructor
-     *
-     *  @note user should never construct animation object.
-     *         they should call the one of the factory method instead.
-     *
-     *  @see loadFromFile()
-     *  @see loadFromData()
      */
     Animation();
-private:
+
     std::unique_ptr<AnimationImpl> d;
 };
 
index 07dfcb0..f7a929f 100644 (file)
@@ -199,7 +199,7 @@ Animation::loadFromData(std::string jsonData, const std::string &key)
 
     LottieLoader loader;
     if (loader.loadFromData(std::move(jsonData), key)) {
-        auto animation = std::make_unique<Animation>();
+        auto animation = std::unique_ptr<Animation>(new Animation);
         animation->d->init(loader.model());
         return animation;
     }
@@ -216,7 +216,7 @@ Animation::loadFromFile(const std::string &path)
 
     LottieLoader loader;
     if (loader.load(path)) {
-        auto animation = std::make_unique<Animation>();
+        auto animation = std::unique_ptr<Animation>(new Animation);
         animation->d->init(loader.model());
         return animation;
     }