Vec2< T > Class Template Reference

small class which defines a vector with 2 elements More...

#include <libwps_internal.h>

Classes

struct  PosSizeLtX
 internal struct used to create sorted map, sorted by X More...
 
struct  PosSizeLtY
 internal struct used to create sorted map, sorted by Y More...
 

Public Member Functions

 Vec2 (T xx=0, T yy=0)
 constructor
 
template<class U >
 Vec2 (Vec2< U > const &p)
 generic copy constructor
 
x () const
 first element
 
y () const
 second element
 
operator[] (int c) const
 operator[]
 
T & operator[] (int c)
 operator[]
 
void set (T xx, T yy)
 resets the two elements
 
void setX (T xx)
 resets the first element
 
void setY (T yy)
 resets the second element
 
void add (T dx, T dy)
 increases the actuals values by dx and dy
 
Vec2< T > & operator+= (Vec2< T > const &p)
 operator+=
 
Vec2< T > & operator-= (Vec2< T > const &p)
 operator-=
 
template<class U >
Vec2< T > & operator*= (U scale)
 generic operator*=
 
bool operator== (Vec2< T > const &p) const
 comparison==
 
bool operator!= (Vec2< T > const &p) const
 comparison!=
 
bool operator< (Vec2< T > const &p) const
 comparison<: sort by y
 
int cmp (Vec2< T > const &p) const
 a comparison function: which first compares x then y
 
int cmpY (Vec2< T > const &p) const
 a comparison function: which first compares y then x
 

Protected Attributes

m_x
 first element
 
m_y
 second element
 

Friends

Vec2< T > operator+ (Vec2< T > const &p1, Vec2< T > const &p2)
 operator+
 
Vec2< T > operator- (Vec2< T > const &p1, Vec2< T > const &p2)
 operator-
 
template<class U >
Vec2< T > operator* (U scale, Vec2< T > const &p1)
 generic operator*
 
std::ostream & operator<< (std::ostream &o, Vec2< T > const &f)
 operator<<: prints data in form "XxY"
 

Detailed Description

template<class T>
class Vec2< T >

small class which defines a vector with 2 elements

Constructor & Destructor Documentation

◆ Vec2() [1/2]

template<class T >
Vec2< T >::Vec2 ( T xx = 0,
T yy = 0 )
inlineexplicit

constructor

◆ Vec2() [2/2]

template<class T >
template<class U >
Vec2< T >::Vec2 ( Vec2< U > const & p)
inlineexplicit

generic copy constructor

Member Function Documentation

◆ add()

template<class T >
void Vec2< T >::add ( T dx,
T dy )
inline

increases the actuals values by dx and dy

◆ cmp()

template<class T >
int Vec2< T >::cmp ( Vec2< T > const & p) const
inline

a comparison function: which first compares x then y

Referenced by WPSGraphicShape::cmp(), WPSGraphicStyle::cmp(), WPSGraphicStyle::Pattern::cmp(), and Vec2< T >::PosSizeLtX::operator()().

◆ cmpY()

template<class T >
int Vec2< T >::cmpY ( Vec2< T > const & p) const
inline

a comparison function: which first compares y then x

Referenced by WPSPosition::cmp(), Vec2< T >::operator!=(), Vec2< T >::PosSizeLtY::operator()(), Vec2< T >::operator<(), and Vec2< T >::operator==().

◆ operator!=()

template<class T >
bool Vec2< T >::operator!= ( Vec2< T > const & p) const
inline

comparison!=

◆ operator*=()

template<class T >
template<class U >
Vec2< T > & Vec2< T >::operator*= ( U scale)
inline

generic operator*=

◆ operator+=()

template<class T >
Vec2< T > & Vec2< T >::operator+= ( Vec2< T > const & p)
inline

operator+=

◆ operator-=()

template<class T >
Vec2< T > & Vec2< T >::operator-= ( Vec2< T > const & p)
inline

operator-=

◆ operator<()

template<class T >
bool Vec2< T >::operator< ( Vec2< T > const & p) const
inline

comparison<: sort by y

◆ operator==()

template<class T >
bool Vec2< T >::operator== ( Vec2< T > const & p) const
inline

comparison==

◆ operator[]() [1/2]

template<class T >
T & Vec2< T >::operator[] ( int c)
inline

operator[]

◆ operator[]() [2/2]

template<class T >
T Vec2< T >::operator[] ( int c) const
inline

operator[]

◆ set()

template<class T >
void Vec2< T >::set ( T xx,
T yy )
inline

resets the two elements

Referenced by WPS8Graph::readBDR(), and WPS8Graph::sendObjects().

◆ setX()

template<class T >
void Vec2< T >::setX ( T xx)
inline

resets the first element

Referenced by WPS8Parser::readFRAM(), and WPS8Graph::readPICT().

◆ setY()

template<class T >
void Vec2< T >::setY ( T yy)
inline

resets the second element

Referenced by WPS8Parser::readFRAM(), and WPS8Graph::readPICT().

◆ x()

◆ y()

Friends And Related Symbol Documentation

◆ operator*

template<class T >
template<class U >
Vec2< T > operator* ( U scale,
Vec2< T > const & p1 )
friend

generic operator*

◆ operator+

template<class T >
Vec2< T > operator+ ( Vec2< T > const & p1,
Vec2< T > const & p2 )
friend

operator+

◆ operator-

template<class T >
Vec2< T > operator- ( Vec2< T > const & p1,
Vec2< T > const & p2 )
friend

operator-

◆ operator<<

template<class T >
std::ostream & operator<< ( std::ostream & o,
Vec2< T > const & f )
friend

operator<<: prints data in form "XxY"

Member Data Documentation

◆ m_x

◆ m_y


The documentation for this class was generated from the following file:

Generated on Thu Jul 18 2024 00:00:00 for libwps by doxygen 1.12.0