From e341c2cf579eabc08167c77153df79e3251fa941 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Wed, 19 Sep 2018 11:29:26 +0900 Subject: [PATCH] lottie: make animation class constructor private. 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 | 11 +++-------- src/lottie/lottieanimation.cpp | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/inc/lottieanimation.h b/inc/lottieanimation.h index c2a4e26..08edd48 100644 --- a/inc/lottieanimation.h +++ b/inc/lottieanimation.h @@ -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 d; }; diff --git a/src/lottie/lottieanimation.cpp b/src/lottie/lottieanimation.cpp index 07dfcb0..f7a929f 100644 --- a/src/lottie/lottieanimation.cpp +++ b/src/lottie/lottieanimation.cpp @@ -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(); + auto animation = std::unique_ptr(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(); + auto animation = std::unique_ptr(new Animation); animation->d->init(loader.model()); return animation; } -- 2.7.4