Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

Size_

 

template <class T>

struct Size_ : public Moveable< Size_<T> > 

 

Size_ is a generic structure that describes a two dimensional size object. The horizontal dimension is represented by cx and the vertical one by cy. Both dimension are of type T.

 

 

To get a specialized version of Size_, use one of the following:

 

Size

typedef Size_<int> Size

Size_ with with int dimensions.

 


 

Size16

typedef Size_<int16> Size16

Size_ with with int16 dimensions.

 


 

Size64

typedef Size_<int64> Size64

Size_ with with int64 dimensions.

 


 

Sizef

typedef Size_<double> Sizef

Size_ with with double dimensions.

 

 

Constructor Detail

 

Size_()

Creates an uninitialized Size_.

 


 

Size_(const Value& src)

Default copy constructor.

 


 

Size_(T cx, T cy)

Creates a Size_ object an initializes it's horizontal dimension with cx and it's vertical dimension with cy.

 


 

Size_(const Size_<int>& sz)

Creates a Size_ object and initializes it with a Size sz.

 


 

Size_(const Size_<short>& sz)

Creates a Size_ object and initializes it with a Size16 sz.

 


 

Size_(const Size_<double>& sz)

Creates a Size_ object and initializes it with a Sizef sz.

 


 

Size_(const Size_<int64>& sz)

Creates a Size_ object and initializes it with a Size64 sz.

 


 

Size_(const Point_<T>& pt)

Creates a Size_ object and initializes it with a Point sz.

 


 

Size_(const Nuller&)

Creates a Size_ object and initializes it with Null.

 

 

Public Field List

 

T cx

the horizontal dimension

 


 

T cy

the vertical dimension

 

 

Method List

 

void Clear()

Sets both dimension to 0.

 


 

bool IsEmpty() const

Returns true if at least one dimension is 0, false otherwise.

 


 

void SetNull()

Reinitializes the object to Null.

 


 

bool IsNullInstance() const

Verifies if size is Null.

 


 

unsigned GetHashValue() const

Returns the hash value of the size.

 


 

String ToString() const

Returns the String representation of the size.

 


 

Size_& operator+=(Size_ p)

Increases cx with p's horizontal dimension and cy with p's vertical dimension.

 


 

Size_& operator+=(T t)

Increases both dimension with the same value t.

 


 

Size_& operator-=(Size_ p)

Decreases cx with p's horizontal dimension and cy with p's vertical dimension.

 


 

Size_& operator-=(T t)

Decreases both dimension with the same value t.

 


 

Size_& operator*=(Size_ p)

Multiplies cx with p's horizontal dimension and cy with p's vertical dimension.

 


 

Size_& operator*=(T t)

Multiplies both dimension with the same value t.

 


 

Size_& operator/=(Size_ p)

Divides cx with p's horizontal dimension and cy with p's vertical dimension.

 


 

Size_& operator/=(T t)

Divides both dimension with the same value t.

 


 

Size_& operator<<=(int sh)

Shift both dimensions left by sh.

 


 

Size_& operator>>=(int sh)

Shift both dimensions right by sh.

 


 

Size_& operator++()

Increments both dimensions.

 


 

Size_& operator--()

Decrements both dimensions.

 


 

operator Value() const

Returns a conversion of the size to Value.

 


 

void Serialize(Stream& s)

Serializes the size to a stream s.

 

 

Friend List

 

friend Size_ operator+(Size_ s)

Returns an unmodified size s.

 


 

friend Size_ operator-(Size_ s)

Returns a negated size s.

 


 

friend Size_ operator+(Size_ a, Size_ b)

friend Size_ operator+(Size_ a, T t)

friend Size_ operator+(T t, Size_ b)

Returns the result of the addition of two Size_ values or a Size_ with single value.

 


 

friend Size_ operator-(Size_ a, Size_ b)

friend Size_ operator-(Size_ a, T t)

friend Size_ operator-(T t, Size_ b)

Returns the result of the subtraction of two Size_ values or a Size_ with single value.

 


 

friend Size_ operator*(Size_ a, Size_ b)

friend Size_ operator*(Size_ a, T b)

friend Size_ operator*(T a, Size_ b)

Returns the result of the multiplication of two Size_ values or a Size_ with single value.

 


 

friend Size_ operator/(Size_ a, Size_ b)

friend Size_ operator/(Size_ a, T b)

Returns the result of the division of two Size_ values or a Size_ with single value.

 


 

friend Size_ operator<<(Size_ a, int sh)

Returns the result of left shifting a by sh.

 


 

friend Size_ operator>>(Size_ a, int sh)

Returns the result of right shifting a by sh.

 


 

friend bool operator==(Size_ a, Size_ b)

Returns true if a and b have their respective dimension equal, false otherwise.

 


 

friend bool operator!=(Size_ a, Size_ b)

Returns true if a and b have at least an unequal dimension, false otherwise.

 


 

friend Size_ min(Size_ a, Size_ b)

Returns a Size_ with it's dimension equaling the minimum of the respective dimension between a and b.

 


 

friend Size_ max(Size_ a, Size_ b)

Returns a Size_ with it's dimension equaling the maximum of the respective dimension between a and b.

 


 

friend Size_ Nvl(Size_ a, Size_ b)

Returns b if a is Null, a otherwise.

 


 

friend T ScalarProduct(Size_ a, Size_ b)

Returns the scalar product between a and b.

 


 

friend T VectorProduct(Size_ a, Size_ b)

Returns the vectorial product between a and b.

 


 

friend T Squared(Size_ a)

Returns a Size_ with cx equal to the square of a.cx and cy equal to the square of a.cy.

 


 

friend double Length(Size_ a)

Returns the hypotenuse of the triangle described by a.

 

 

Last edit by cxl on 12/02/2017. Do you want to contribute?. T++