1 /* ///////////////////////////////////////////////////////////////////////
7 * Brief: The basic_size class
10 * Copyright (c) 2008-2020, Waruqi All rights reserved.
11 * //////////////////////////////////////////////////////////////////// */
13 #ifndef EXTL_GRAPHIC_BASIC_SIZE_H
14 #define EXTL_GRAPHIC_BASIC_SIZE_H
17 * \brief basic_size class
20 /* ///////////////////////////////////////////////////////////////////////
25 /* ///////////////////////////////////////////////////////////////////////
26 * ::extl::graphic namespace
28 EXTL_GRAPHIC_BEGIN_WHOLE_NAMESPACE
32 * \param Val the value type
34 * \ingroup extl_group_graphic
37 template<typename_param_k Val
>
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
;
59 /// \name Constructors
62 explicit_k
basic_size ( const_reference width
= value_type()
63 , const_reference height
= value_type()
69 basic_size(class_type
const& rhs
)
70 : m_width(rhs
.m_width
)
71 , m_height(rhs
.m_height
)
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
; }
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()); }
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
); }
102 /* ///////////////////////////////////////////////////////////////////////
103 * ::extl::graphic namespace
105 EXTL_GRAPHIC_END_WHOLE_NAMESPACE
107 /* //////////////////////////////////////////////////////////////////// */
108 #endif /* EXTL_GRAPHIC_BASIC_SIZE_H */
109 /* //////////////////////////////////////////////////////////////////// */