aboutsummaryrefslogtreecommitdiff
path: root/include/dchat
diff options
context:
space:
mode:
Diffstat (limited to 'include/dchat')
-rw-r--r--include/dchat/Cache.hpp2
-rw-r--r--include/dchat/Gif.hpp6
-rwxr-xr-xinclude/dchat/utils.hpp6
3 files changed, 10 insertions, 4 deletions
diff --git a/include/dchat/Cache.hpp b/include/dchat/Cache.hpp
index debcd5b..62df621 100644
--- a/include/dchat/Cache.hpp
+++ b/include/dchat/Cache.hpp
@@ -3,6 +3,7 @@
#include "types.hpp"
#include "WebPagePreview.hpp"
#include "StringView.hpp"
+#include "utils.hpp"
#include <boost/filesystem/path.hpp>
#include <string>
#include <unordered_map>
@@ -64,6 +65,7 @@ namespace dchat
class Cache
{
+ DISABLE_COPY(Cache)
public:
// @createGifFunc can't be nullptr
Cache(CreateGifFunc createGifFunc);
diff --git a/include/dchat/Gif.hpp b/include/dchat/Gif.hpp
index f97ff2f..9e39473 100644
--- a/include/dchat/Gif.hpp
+++ b/include/dchat/Gif.hpp
@@ -28,16 +28,13 @@ namespace dchat
virtual ~Gif();
Vec2u getSize() const;
+ // Throws GifLoadException on error
void update();
static bool isDataGif(const StringView &data);
protected:
// Return false if texture creation failed
virtual bool createTexture(int width, int height) = 0;
- virtual void setPosition(const Vec2f &position) = 0;
- virtual Vec2f getPosition() const = 0;
- virtual void setScale(const Vec2f &scale) = 0;
- virtual void setColor(Color color) = 0;
// Size of texture data is same as the size that the texture was created with (also same size returned by @getSize function)
virtual void updateTexture(void *textureData) = 0;
private:
@@ -48,5 +45,6 @@ namespace dchat
unsigned int currentFrame;
double timeElapsedCs;
Clock frameTimer;
+ bool created;
};
}
diff --git a/include/dchat/utils.hpp b/include/dchat/utils.hpp
new file mode 100755
index 0000000..01e478d
--- /dev/null
+++ b/include/dchat/utils.hpp
@@ -0,0 +1,6 @@
+#pragma once
+
+// Disable copying for a class or struct
+#define DISABLE_COPY(ClassName) \
+ ClassName(ClassName&) = delete; \
+ ClassName& operator = (ClassName&) = delete;