From f565f417f386c5d13f73da8b3eca19847dc4367c Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 22 Mar 2012 16:36:07 +0100 Subject: utils/dimension: added template for types of the metrics --- src/utils/dimension.hpp | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) (limited to 'src/utils/dimension.hpp') diff --git a/src/utils/dimension.hpp b/src/utils/dimension.hpp index 4518fbb8..788adbf9 100644 --- a/src/utils/dimension.hpp +++ b/src/utils/dimension.hpp @@ -29,20 +29,52 @@ namespace usdx { + template class Dimension { private: - unsigned int width; - unsigned int height; + T width; + T height; + public: - Dimension(unsigned int width, unsigned int height); - Dimension(const Dimension& dimension); + Dimension(T width, T height) : + width(width), height(height) + { + } + + Dimension(const Dimension& dimension) : + width(dimension.width), height(dimension.height) + { + } + + Dimension& operator=(const Dimension& dimension) + { + width = dimension.width; + height = dimension.height; + return *this; + } + + + + T get_width(void) const + { + return width; + } + + void set_width(const T& value) + { + width = value; + } - unsigned int get_width(void) const; - void set_width(unsigned int width); + T get_height(void) const + { + return height; + } - unsigned int get_height(void) const; - void set_height(unsigned int height); + void set_height(const T& value) + { + height = value; + } }; }; -- cgit v1.2.3