blip  0.1
Size.hpp
Go to the documentation of this file.
1 #ifndef __blip_Size_hpp
2 #define __blip_Size_hpp
3 
4 #include <blip/Blip.hpp>
5 
6 namespace blip {
7 
13 class Size
14 {
15  public:
16 
18  Size() throw();
19 
21  Size(uint_t width, uint_t height) throw();
22 
24  ~Size() throw();
25 
27  inline uint_t getWidth() const throw()
28  { return(_width); }
29 
31  inline void setWidth(uint_t width) throw()
32  { _width = width; }
33 
35  inline uint_t getHeight() const throw()
36  { return(_height); }
37 
39  inline void setHeight(uint_t height) throw()
40  { _height = height; }
41 
43  void setSize(uint_t width, uint_t height) throw();
44 
46  bool isEmpty() const throw();
47 
49  bool operator==(const Size& other) const throw();
50 
52  inline bool operator!=(const Size& other) const throw()
53  { return(!operator==(other)); }
54 
56  inline operator const void*() const throw()
57  { return(isEmpty() ? NULL : this); }
58 
60  inline bool operator!() const throw()
61  { return(isEmpty()); }
62 
70  bool fitsInside(const Size& other) const throw();
71 
72  private:
73 
74  uint_t _width;
75  uint_t _height;
76 };
77 
78 } // namespace blip
79 
80 #endif // __blip_Size_hpp
uint_t getHeight() const
Get the height.
Definition: Size.hpp:35
Size()
Construct a new Size with 0 width and height.
Definition: Size.cpp:8
void setSize(uint_t width, uint_t height)
Set the width and height.
Definition: Size.cpp:33
A rectangular size that has a width and a height.
Definition: Size.hpp:13
void setWidth(uint_t width)
Set the width.
Definition: Size.hpp:31
bool operator!=(const Size &other) const
Inequality operator.
Definition: Size.hpp:52
uint_t getWidth() const
Get the width.
Definition: Size.hpp:27
WAV file format details at: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/.
Definition: AccelerometerSensorEvent.cpp:3
void setHeight(uint_t height)
Set the height.
Definition: Size.hpp:39
bool operator==(const Size &other) const
Equality operator.
Definition: Size.cpp:50
bool fitsInside(const Size &other) const
Test if this Size "fits inside" another one, e.g., whether the other Size&#39;s width and height are both...
Definition: Size.cpp:58
bool operator!() const
Not operator.
Definition: Size.hpp:60
~Size()
Destructor.
Definition: Size.cpp:26
bool isEmpty() const
Test if this dimension is empty, i.e., has 0 width and/or height.
Definition: Size.cpp:42