| 21 | */ |
| 22 | |
| 23 | class cDimension { |
| 24 | public: |
| 25 | unsigned int mWidth, mHeight; |
| 26 | |
| 27 | public: |
| 28 | cDimension() : mWidth( 0 ), mHeight( 0 ) {} |
| 29 | cDimension( unsigned int pWidth, unsigned int pHeight ) : mWidth( pWidth ), mHeight( pHeight ) {} |
| 30 | |
| 31 | void Set( unsigned int pWidth, unsigned int pHeight ) { mWidth = pWidth; mHeight = pHeight; } |
| 32 | |
| 33 | unsigned int WidthByHeight() { return mWidth * mHeight; } |
| 34 | int getWidth() const { return mWidth; } |
| 35 | int getHeight() const { return mHeight; } |
| 36 | |
| 37 | cPosition getCentre() const { return { mWidth / 2, mHeight / 2 }; }; |
| 38 | |
| 39 | cDimension operator/(const cDimension& pDim) { |
| 40 | return cDimension(mWidth / pDim.mWidth, mHeight / pDim.mHeight); |
| 41 | } |
| 42 | |
| 43 | bool operator==(const cDimension& pRight) { |
| 44 | return mWidth == pRight.mWidth && mHeight == pRight.mHeight; |
| 45 | } |
| 46 | |
| 47 | cDimension operator+(const cDimension& pRight) { |
| 48 | |
| 49 | return cDimension(mWidth + pRight.mWidth, mHeight + pRight.mHeight); |
| 50 | } |
| 51 | }; |
no outgoing calls
no test coverage detected