From 67638eeec5267977940dce29c5a94ce4d093ed69 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 12 Dec 2016 18:26:16 +0300 Subject: Add constexpr and noexcept into some methods. --- src/resources/fboinfo.h | 2 +- src/resources/imagehelper.h | 6 +++--- src/resources/mstack.h | 2 +- src/resources/openglimagehelper.h | 12 ++++++------ src/resources/safeopenglimagehelper.h | 8 ++++---- src/resources/sdl2imagehelper.h | 7 ++++--- src/resources/sdl2softwareimagehelper.h | 6 +++--- src/resources/sdlimagehelper.h | 4 ++-- src/resources/sprite/animatedsprite.h | 2 +- src/resources/surfaceimagehelper.h | 4 ++-- 10 files changed, 27 insertions(+), 26 deletions(-) (limited to 'src/resources') diff --git a/src/resources/fboinfo.h b/src/resources/fboinfo.h index 81d753856..e8c4ace88 100644 --- a/src/resources/fboinfo.h +++ b/src/resources/fboinfo.h @@ -39,7 +39,7 @@ struct FBOInfo final { - FBOInfo() : + constexpr2 FBOInfo() : fboId(0), textureId(0), rboId(0) { } diff --git a/src/resources/imagehelper.h b/src/resources/imagehelper.h index 2f4276305..4ade89199 100644 --- a/src/resources/imagehelper.h +++ b/src/resources/imagehelper.h @@ -91,15 +91,15 @@ class ImageHelper notfinal static void dumpSurfaceFormat(const SDL_Surface *const image); - static void setEnableAlpha(const bool n) + constexpr static void setEnableAlpha(const bool n) noexcept2 { mEnableAlpha = n; } static SDL_Surface *loadPng(SDL_RWops *const rw); - static void setOpenGlMode(const RenderType useOpenGL) + constexpr static void setOpenGlMode(const RenderType useOpenGL) noexcept2 { mUseOpenGL = useOpenGL; } - virtual RenderType useOpenGL() const A_WARN_UNUSED + virtual RenderType useOpenGL() const noexcept2 A_WARN_UNUSED { return mUseOpenGL; } virtual void postInit() diff --git a/src/resources/mstack.h b/src/resources/mstack.h index f8a49af49..2fcf558a2 100644 --- a/src/resources/mstack.h +++ b/src/resources/mstack.h @@ -28,7 +28,7 @@ template struct MStack final { - explicit MStack(const size_t maxSize) : + constexpr2 explicit MStack(const size_t maxSize) : mStack(new T[maxSize]), mMaxSize(maxSize), mPointer(mStack - 1), diff --git a/src/resources/openglimagehelper.h b/src/resources/openglimagehelper.h index 5f6e0b8aa..87faaefe7 100644 --- a/src/resources/openglimagehelper.h +++ b/src/resources/openglimagehelper.h @@ -92,28 +92,28 @@ class OpenGLImageHelper final : public ImageHelper // OpenGL only public functions - static int getTextureType() A_WARN_UNUSED + static int getTextureType() noexcept2 A_WARN_UNUSED { return mTextureType; } - static int getInternalTextureType() A_WARN_UNUSED + static int getInternalTextureType() noexcept2 A_WARN_UNUSED { return mInternalTextureType; } - static void setInternalTextureType(const int n) + constexpr static void setInternalTextureType(const int n) noexcept2 { mInternalTextureType = n; } - static void setBlur(const bool n) + constexpr static void setBlur(const bool n) noexcept2 { mBlur = n; } static int mTextureType; static int mInternalTextureType; - static int getTextureSize() A_WARN_UNUSED + static int getTextureSize() noexcept2 A_WARN_UNUSED { return mTextureSize; } static void initTextureSampler(const GLint id); - static void setUseTextureSampler(const bool b) + constexpr static void setUseTextureSampler(const bool b) noexcept2 { mUseTextureSampler = b; } static void invalidate(const GLuint textureId); diff --git a/src/resources/safeopenglimagehelper.h b/src/resources/safeopenglimagehelper.h index 90a168bad..0f2382d98 100644 --- a/src/resources/safeopenglimagehelper.h +++ b/src/resources/safeopenglimagehelper.h @@ -98,22 +98,22 @@ class SafeOpenGLImageHelper final : public ImageHelper static int getInternalTextureType() A_WARN_UNUSED { return mInternalTextureType; } - static void setInternalTextureType(const int n) + constexpr static void setInternalTextureType(const int n) noexcept2 { mInternalTextureType = n; } - static void setBlur(const bool n) + constexpr static void setBlur(const bool n) noexcept2 { mBlur = n; } static int mTextureType; static int mInternalTextureType; - static int getTextureSize() A_WARN_UNUSED + static int getTextureSize() noexcept2 A_WARN_UNUSED { return mTextureSize; } static void initTextureSampler(const GLint id); - static void setUseTextureSampler(const bool b) + constexpr static void setUseTextureSampler(const bool b) noexcept2 { mUseTextureSampler = b; } static void invalidate(const GLuint textureId); diff --git a/src/resources/sdl2imagehelper.h b/src/resources/sdl2imagehelper.h index 59cec36ea..aa40aa065 100644 --- a/src/resources/sdl2imagehelper.h +++ b/src/resources/sdl2imagehelper.h @@ -67,10 +67,10 @@ class SDLImageHelper final : public ImageHelper SDL_Surface *const surface) const override final; - static void SDLSetEnableAlphaCache(const bool n) + constexpr static void SDLSetEnableAlphaCache(const bool n) noexcept2 { mEnableAlphaCache = n; } - static bool SDLGetEnableAlphaCache() A_WARN_UNUSED + static bool SDLGetEnableAlphaCache() noexcept2 A_WARN_UNUSED { return mEnableAlphaCache; } static SDL_Surface* SDLDuplicateSurface(SDL_Surface *const tmpImage) @@ -81,7 +81,8 @@ class SDLImageHelper final : public ImageHelper SDL_Surface *restrict const dst, SDL_Rect *restrict const dstrect); - static void setRenderer(SDL_Renderer *const renderer) + constexpr static void setRenderer(SDL_Renderer *const renderer) + noexcept2 { mRenderer = renderer; } protected: diff --git a/src/resources/sdl2softwareimagehelper.h b/src/resources/sdl2softwareimagehelper.h index 0160a5660..38bd0f9d0 100644 --- a/src/resources/sdl2softwareimagehelper.h +++ b/src/resources/sdl2softwareimagehelper.h @@ -60,10 +60,10 @@ class SDL2SoftwareImageHelper final : public ImageHelper const float alpha) override final A_WARN_UNUSED; - static void SDLSetEnableAlphaCache(const bool n) + constexpr static void SDLSetEnableAlphaCache(const bool n) noexcept2 { mEnableAlphaCache = n; } - static bool SDLGetEnableAlphaCache() A_WARN_UNUSED + static bool SDLGetEnableAlphaCache() noexcept2 A_WARN_UNUSED { return mEnableAlphaCache; } static SDL_Surface* SDLDuplicateSurface(SDL_Surface *const tmpImage) @@ -74,7 +74,7 @@ class SDL2SoftwareImageHelper final : public ImageHelper SDL_Surface *restrict const dst, SDL_Rect *restrict const dstrect); - static void setFormat(SDL_PixelFormat *const format) + constexpr2 static void setFormat(SDL_PixelFormat *const format) noexcept2 { mFormat = format; if (mFormat) diff --git a/src/resources/sdlimagehelper.h b/src/resources/sdlimagehelper.h index 347a8b585..57fd33d68 100644 --- a/src/resources/sdlimagehelper.h +++ b/src/resources/sdlimagehelper.h @@ -81,10 +81,10 @@ class SDLImageHelper final : public ImageHelper SDL_Surface *const surface) const override final; - static void SDLSetEnableAlphaCache(const bool n) + constexpr static void SDLSetEnableAlphaCache(const bool n) noexcept2 { mEnableAlphaCache = n; } - static bool SDLGetEnableAlphaCache() A_WARN_UNUSED + static bool SDLGetEnableAlphaCache() noexcept2 A_WARN_UNUSED { return mEnableAlphaCache; } static SDL_Surface* SDLDuplicateSurface(SDL_Surface *const tmpImage) diff --git a/src/resources/sprite/animatedsprite.h b/src/resources/sprite/animatedsprite.h index 7f8332e46..27d6b61a5 100644 --- a/src/resources/sprite/animatedsprite.h +++ b/src/resources/sprite/animatedsprite.h @@ -114,7 +114,7 @@ class AnimatedSprite final : public Sprite bool isTerminated() const restrict2 noexcept2 { return mTerminated; } - static void setEnableCache(const bool b) noexcept2 + constexpr static void setEnableCache(const bool b) noexcept2 { mEnableCache = b; } void setLastTime(const int time) noexcept2 diff --git a/src/resources/surfaceimagehelper.h b/src/resources/surfaceimagehelper.h index 15c8d66d2..243a370c1 100644 --- a/src/resources/surfaceimagehelper.h +++ b/src/resources/surfaceimagehelper.h @@ -63,10 +63,10 @@ class SurfaceImageHelper final : public ImageHelper const float alpha) override final A_WARN_UNUSED; - static void SDLSetEnableAlphaCache(const bool n) + constexpr static void SDLSetEnableAlphaCache(const bool n) noexcept2 { mEnableAlphaCache = n; } - static bool SDLGetEnableAlphaCache() A_WARN_UNUSED + static bool SDLGetEnableAlphaCache() noexcept2 A_WARN_UNUSED { return mEnableAlphaCache; } /** -- cgit v1.2.3-70-g09d2