remove \r
[extl.git] / extl / graphic / basic_size.h
bloba7aa68c375aa895913d8b6d73701bf3d7cc2fa94
1 /* ///////////////////////////////////////////////////////////////////////
2 * File: basic_size.h
4 * Created: 08.12.31
5 * Updated: 08.12.31
7 * Brief: The basic_size class
9 * [<Home>]
10 * Copyright (c) 2008-2020, Waruqi All rights reserved.
11 * //////////////////////////////////////////////////////////////////// */
13 #ifndef EXTL_GRAPHIC_BASIC_SIZE_H
14 #define EXTL_GRAPHIC_BASIC_SIZE_H
16 /*!\file basic_size.h
17 * \brief basic_size class
20 /* ///////////////////////////////////////////////////////////////////////
21 * Includes
23 #include "prefix.h"
25 /* ///////////////////////////////////////////////////////////////////////
26 * ::extl::graphic namespace
28 EXTL_GRAPHIC_BEGIN_WHOLE_NAMESPACE
30 /*!brief basic_size
32 * \param Val the value type
34 * \ingroup extl_group_graphic
37 template<typename_param_k Val>
38 class basic_size
40 /// \name Types
41 /// @{
42 public:
43 typedef basic_size class_type;
44 typedef Val value_type;
45 typedef value_type& reference;
46 typedef value_type const& const_reference;
47 typedef value_type* pointer;
48 typedef value_type const* const_pointer;
49 typedef e_bool_t bool_type;
50 /// @}
52 /// \name Members
53 /// @{
54 private:
55 value_type m_width;
56 value_type m_height;
57 /// @}
59 /// \name Constructors
60 /// @{
61 public:
62 explicit_k basic_size ( const_reference width = value_type()
63 , const_reference height = value_type()
65 : m_width(width)
66 , m_height(height)
69 basic_size(class_type const& rhs)
70 : m_width(rhs.m_width)
71 , m_height(rhs.m_height)
74 /// @}
76 /// \name Attributes
77 /// @{
78 public:
79 value_type const height() const { return m_width; }
80 void height(const_reference val) { m_width = val; }
82 value_type const width() const { return m_height; }
83 void width(const_reference val) { m_height = val; }
84 /// @}
86 /// \name Mutators
87 /// @{
88 public:
89 void swap(class_type& rhs) { std_swap(m_width, rhs.m_width); std_swap(m_height, rhs.m_height); }
90 void clear() { width(value_type()); height(value_type()); }
91 /// @}
93 /// \name Operators
94 /// @{
95 public:
96 bool_type operator ==(class_type const& rhs) const { return ((width() == rhs.width()) && (height() == rhs.height())); }
97 bool_type operator !=(class_type const& rhs) const { return !((*this) == rhs); }
98 /// @}
102 /* ///////////////////////////////////////////////////////////////////////
103 * ::extl::graphic namespace
105 EXTL_GRAPHIC_END_WHOLE_NAMESPACE
107 /* //////////////////////////////////////////////////////////////////// */
108 #endif /* EXTL_GRAPHIC_BASIC_SIZE_H */
109 /* //////////////////////////////////////////////////////////////////// */