map2d_widget
size.h
Go to the documentation of this file.
1 
12 /*
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 */
27 #ifndef SIZE_H
28 #define SIZE_H
29 
30 #include "point.h"
31 #include <QString>
32 #include <QHash>
33 
34 namespace core {
35  struct Size
36  {
37 
38  Size();
39  Size(Point pt){width=pt.X(); height=pt.Y();};
40  Size(int Width,int Height){width=Width; height=Height;};
41  friend uint qHash(Size const& size);
42  // friend bool operator==(Size const& lhs,Size const& rhs);
43  Size operator-(const Size &sz1){return Size(width-sz1.width,height-sz1.height);}
44  Size operator+(const Size &sz1){return Size(sz1.width+width,sz1.height+height);}
45 
46  int GetHashCode(){return width^height;}
47  uint qHash(Size const& /*rect*/){return width^height;}
48  QString ToString(){return "With="+QString::number(width)+" ,Height="+QString::number(height);}
49  int Width()const {return width;}
50  int Height()const {return height;}
51  void SetWidth(int const& value){width=value;}
52  void SetHeight(int const& value){height=value;}
53  private:
54  int width;
55  int height;
56  };
57 }
58 #endif // SIZE_H
void SetHeight(int const &value)
Definition: size.h:52
Size()
Definition: size.cpp:31
Size(Point pt)
Definition: size.h:39
Size operator-(const Size &sz1)
Definition: size.h:43
int Y() const
Definition: point.h:48
Definition: accessmode.h:35
friend uint qHash(Size const &size)
int Width() const
Definition: size.h:49
Definition: size.h:35
Size(int Width, int Height)
Definition: size.h:40
Definition: point.h:35
Size operator+(const Size &sz1)
Definition: size.h:44
int GetHashCode()
Definition: size.h:46
int Height() const
Definition: size.h:50
uint qHash(Size const &)
Definition: size.h:47
void SetWidth(int const &value)
Definition: size.h:51
QString ToString()
Definition: size.h:48
int X() const
Definition: point.h:47