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
This commit is contained in:
subhransu mohanty
2018-09-19 11:29:26 +09:00
parent cf2d643534
commit e341c2cf57
2 changed files with 5 additions and 10 deletions

View 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;
};

View 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;
}