From e896b54f054c70bd7214b60cc38159c196c8d5a9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 19 Dec 2013 22:54:40 +0300 Subject: add noexcept into animation. --- src/resources/animation.cpp | 18 +++++++++--------- src/resources/animation.h | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp index 76e8543e0..541d578b0 100644 --- a/src/resources/animation.cpp +++ b/src/resources/animation.cpp @@ -24,7 +24,7 @@ #include "debug.h" -Animation::Animation() : +Animation::Animation() noexcept : mFrames(), mDuration(0) { @@ -32,7 +32,7 @@ Animation::Animation() : void Animation::addFrame(Image *const image, const int delay, const int offsetX, const int offsetY, - const int rand) + const int rand) noexcept { Frame frame = { image, delay, offsetX, offsetY, rand, Frame::ANIMATION, "" }; @@ -40,41 +40,41 @@ void Animation::addFrame(Image *const image, const int delay, mDuration += delay; } -void Animation::addTerminator(const int rand) +void Animation::addTerminator(const int rand) noexcept { addFrame(nullptr, 0, 0, 0, rand); } -bool Animation::isTerminator(const Frame &candidate) +bool Animation::isTerminator(const Frame &candidate) noexcept { return (!candidate.image && candidate.type == Frame::ANIMATION); } -void Animation::addJump(const std::string &name, const int rand) +void Animation::addJump(const std::string &name, const int rand) noexcept { Frame frame = { nullptr, 0, 0, 0, rand, Frame::JUMP, name }; mFrames.push_back(frame); } -void Animation::addLabel(const std::string &name) +void Animation::addLabel(const std::string &name) noexcept { Frame frame = { nullptr, 0, 0, 0, 100, Frame::LABEL, name }; mFrames.push_back(frame); } -void Animation::addGoto(const std::string &name, const int rand) +void Animation::addGoto(const std::string &name, const int rand) noexcept { Frame frame = { nullptr, 0, 0, 0, rand, Frame::GOTO, name }; mFrames.push_back(frame); } -void Animation::addPause(const int delay, const int rand) +void Animation::addPause(const int delay, const int rand) noexcept { Frame frame = { nullptr, delay, 0, 0, rand, Frame::PAUSE, "" }; mFrames.push_back(frame); } -void Animation::setLastFrameDelay(const int delay) +void Animation::setLastFrameDelay(const int delay) noexcept { for (FramesRevIter it = mFrames.rbegin(), it_end = mFrames.rend(); it != it_end; ++ it) diff --git a/src/resources/animation.h b/src/resources/animation.h index 9851e1c24..ac1ff971f 100644 --- a/src/resources/animation.h +++ b/src/resources/animation.h @@ -64,50 +64,50 @@ class Animation final friend class SimpleAnimation; public: - Animation(); + Animation() noexcept; /** * Appends a new animation at the end of the sequence. */ void addFrame(Image *const image, const int delay, const int offsetX, const int offsetY, - const int rand); + const int rand) noexcept; /** * Appends an animation terminator that states that the animation * should not loop. */ - void addTerminator(const int rand); + void addTerminator(const int rand) noexcept; /** * Returns the length of this animation in frames. */ - size_t getLength() const A_WARN_UNUSED + size_t getLength() const noexcept A_WARN_UNUSED { return mFrames.size(); } - void addJump(const std::string &name, const int rand); + void addJump(const std::string &name, const int rand) noexcept; - void addLabel(const std::string &name); + void addLabel(const std::string &name) noexcept; - void addGoto(const std::string &name, const int rand); + void addGoto(const std::string &name, const int rand) noexcept; - void addPause(const int delay, const int rand); + void addPause(const int delay, const int rand) noexcept; - void setLastFrameDelay(const int delay); + void setLastFrameDelay(const int delay) noexcept; typedef std::vector Frames; typedef Frames::iterator FramesIter; typedef Frames::reverse_iterator FramesRevIter; #ifdef UNITTESTS - Frames &getFrames() + Frames &getFrames() noexcept { return mFrames; } #endif /** * Determines whether the given animation frame is a terminator. */ - static bool isTerminator(const Frame &phase) A_WARN_UNUSED; + static bool isTerminator(const Frame &phase) noexcept A_WARN_UNUSED; protected: Frames mFrames; -- cgit v1.2.3-70-g09d2