Vec2< T > Class Template Reference

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

`#include <libmwaw_internal.hxx>`

## 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 Types

typedef std::map< Vec2< T >, T, struct PosSizeLtX > | MapX
| map of Vec2 More...
typedef std::map< Vec2< T >, T, struct PosSizeLtY > | MapY
| map of Vec2 More...

## Public Member Functions

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

## Protected Attributes

T | m_x
| first element More...
T | m_y
| second element More...

## Friends

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

## Detailed Description

### template<class T>
class Vec2< T >

small class which defines a vector with 2 elements

## Member Typedef Documentation

template<class T>

Vec2< T >::MapX

map of Vec2

template<class T>

Vec2< T >::MapY

map of Vec2

## Constructor & Destructor Documentation

template<class T>

Vec2< T >::Vec2 | ( | T | xx = `0`,
|  | T | yy = `0`
| ) |  |

inline

constructor

template<class T>
template<class U >

Vec2< T >::Vec2 | ( | Vec2< U > const & | p | ) |

inline

generic copy constructor

## Member Function Documentation

template<class T>

void Vec2< T >::add | ( | T | dx,
|  | T | dy
| ) |  |

inline

increases the actuals values by dx and dy

template<class T>

int Vec2< T >::cmp | ( | Vec2< T > const & | p | ) | const

inline

a comparison function: which first compares x then y

Referenced by Vec2< T >::PosSizeLtX::operator()().

template<class T>

int Vec2< T >::cmpY | ( | Vec2< T > const & | p | ) | const

inline

a comparison function: which first compares y then x

Referenced by MWAWPictBitmapContainer< bool >::cmp(), MWAWPictBitmapContainerBool::cmp(), MWAWPosition::cmp(), MWAWPictLine::cmp(), Vec2< int >::operator!=(), Vec2< T >::PosSizeLtY::operator()(), Vec2< int >::operator<(), and Vec2< int >::operator==().

template<class T>

bool Vec2< T >::operator!= | ( | Vec2< T > const & | p | ) | const

inline

comparison!=

template<class T>
template<class U >

Vec2<T>& Vec2< T >::operator*= | ( | U | scale | ) |

inline

generic operator*=

template<class T>

Vec2<T>& Vec2< T >::operator+= | ( | Vec2< T > const & | p | ) |

inline

operator+=

template<class T>

Vec2<T>& Vec2< T >::operator-= | ( | Vec2< T > const & | p | ) |

inline

operator-=

template<class T>

bool Vec2< T >::operator< | ( | Vec2< T > const & | p | ) | const

inline

comparison<: sort by y

template<class T>

bool Vec2< T >::operator== | ( | Vec2< T > const & | p | ) | const

inline

comparison==

template<class T>

T Vec2< T >::operator[] | ( | int | c | ) | const

inline

operator[]

template<class T>

T& Vec2< T >::operator[] | ( | int | c | ) |

inline

operator[]

template<class T>

void Vec2< T >::set | ( | T | xx,
|  | T | yy
| ) |  |

inline

resets the two elements

Referenced by libmwaw::PrinterRect::read(), libmwaw::PrinterRectResolution::read(), libmwaw_applepict1::OpCode::readPoint(), and MSK4Zone::readPRNT().

template<class T>

void Vec2< T >::setX | ( | T | xx | ) |

inline

resets the first element

Referenced by MSK4Zone::readFRAM(), HMWJGraph::sendBasicGraph(), HMWKGraph::sendBasicGraph(), CWGraph::sendBasicPicture(), HMWJGraph::sendComment(), HMWJGraph::sendFrame(), HMWKGraph::sendFrame(), HMWJGraph::sendPictureFrame(), HMWKGraph::sendPictureFrame(), HMWJGraph::sendTextbox(), and HMWKGraph::sendTextBox().

template<class T>

void Vec2< T >::setY | ( | T | yy | ) |

inline

resets the second element

Referenced by MSK4Zone::readFRAM(), HMWJGraph::sendBasicGraph(), HMWKGraph::sendBasicGraph(), CWGraph::sendBasicPicture(), HMWJGraph::sendComment(), HMWJGraph::sendPictureFrame(), HMWKGraph::sendPictureFrame(), HMWJGraph::sendTextbox(), and HMWKGraph::sendTextBox().

template<class T>

T Vec2< T >::x | ( |  | ) | const

inline

first element

Referenced by MWAWContentListener::_handleFrameParameters(), MWAWPictMac::checkOrGet(), WPParserInternal::WindowsInfo::dimensionInvalid(), MWAWPictData::get(), MSKGraphInternal::BasicForm::getBinaryData(), MSKGraph::getEntryPictureV1(), MSKGraphInternal::Zone::getLocalBox(), MWAWPictLine::getODGBinary(), MWAWPictRectangle::getODGBinary(), MWAWPictCircle::getODGBinary(), MWAWPictArc::getODGBinary(), MWAWPictPath::getODGBinary(), MWAWPictPolygon::getODGBinary(), MWParserInternal::WindowsInfo::isEmpty(), HMWKGraphInternal::operator<<(), WPParserInternal::operator<<(), MWAWOLEParser::parse(), MSKGraphInternal::Zone::print(), MSKGraphInternal::BasicForm::print(), libmwaw::PrinterRect::read(), libmwaw_applepict1::Bitmap::read(), libmwaw_applepict1::Pixmap::read(), CWParser::readDocHeader(), MWParser::readGraphic(), WPParser::readGraphic(), MSK3Parser::readGroupHeaderInfo(), libmwaw_applepict1::Pixmap::readPixmapData(), WPParser::readPrintInfo(), MWParser::readPrintInfo(), ACParser::readPrintInfo(), LWParser::readPrintInfo(), MDWParser::readPrintInfo(), BWParser::readPrintInfo(), NSParser::readPrintInfo(), MORParser::readPrintInfo(), GWParser::readPrintInfo(), MSWParser::readPrintInfo(), MSK3Parser::readPrintInfo(), CWParser::readPrintInfo(), FWParser::readPrintInfo(), WNParser::readPrintInfo(), MWProParser::readPrintInfo(), HMWJParser::readPrintInfo(), MRWParser::readPrintInfo(), HMWKParser::readPrintInfo(), MSK4Zone::readPRNT(), WNText::readTokenV2(), libmwaw_applepict1::Bitmap::saveBitmap(), libmwaw_applepict1::Pixmap::savePixmap(), FWGraph::sendGraphic(), WNParser::sendPicture(), MWProParser::sendPicture(), MWParser::sendWindow(), and MWAWPictBasic::startODG().

template<class T>

T Vec2< T >::y | ( |  | ) | const

inline

second element

Referenced by MWAWContentListener::_handleFrameParameters(), MWAWPictMac::checkOrGet(), MSKGraph::computePositions(), WPParserInternal::WindowsInfo::dimensionInvalid(), MWAWPictData::get(), MSKGraphInternal::BasicForm::getBinaryData(), MSKGraph::getEntryPictureV1(), MSKGraphInternal::Zone::getLocalBox(), MWAWPictLine::getODGBinary(), MWAWPictRectangle::getODGBinary(), MWAWPictCircle::getODGBinary(), MWAWPictArc::getODGBinary(), MWAWPictPath::getODGBinary(), MWAWPictPolygon::getODGBinary(), HMWKGraphInternal::operator<<(), WPParserInternal::operator<<(), MWAWOLEParser::parse(), MSKGraphInternal::Zone::print(), libmwaw::PrinterRect::read(), libmwaw_applepict1::Bitmap::read(), libmwaw_applepict1::Pixmap::read(), libmwaw_applepict1::Bitmap::readBitmapData(), CWParser::readDocHeader(), MWParser::readGraphic(), WPParser::readGraphic(), MSK3Parser::readGroupHeaderInfo(), libmwaw_applepict1::Pixmap::readPixmapData(), WPParser::readPrintInfo(), MWParser::readPrintInfo(), ACParser::readPrintInfo(), LWParser::readPrintInfo(), MDWParser::readPrintInfo(), BWParser::readPrintInfo(), NSParser::readPrintInfo(), MORParser::readPrintInfo(), GWParser::readPrintInfo(), MSWParser::readPrintInfo(), CWParser::readPrintInfo(), MSK3Parser::readPrintInfo(), FWParser::readPrintInfo(), WNParser::readPrintInfo(), MWProParser::readPrintInfo(), HMWJParser::readPrintInfo(), MRWParser::readPrintInfo(), HMWKParser::readPrintInfo(), MSK4Zone::readPRNT(), WNText::readTokenV2(), FWGraph::sendGraphic(), WNParser::sendPicture(), MWProParser::sendPicture(), MWParser::sendWindow(), and MWAWPictBasic::startODG().

## Friends And Related Function Documentation

template<class T>
template<class U >

Vec2<T> operator* | ( | U | scale,
|  | Vec2< T > const & | p1
| ) |  |

friend

generic operator*

template<class T>

Vec2<T> operator+ | ( | Vec2< T > const & | p1,
|  | Vec2< T > const & | p2
| ) |  |

friend

operator+

template<class T>

Vec2<T> operator- | ( | Vec2< T > const & | p1,
|  | Vec2< T > const & | p2
| ) |  |

friend

operator-

template<class T>

std::ostream& operator<< | ( | std::ostream & | o,
|  | Vec2< T > const & | f
| ) |  |

friend

operator<<: prints data in form "XxY"

## Member Data Documentation

template<class T>

T Vec2< T >::m_x

protected

first element

Referenced by Vec2< int >::add(), Vec2< int >::cmp(), Vec2< int >::cmpY(), Vec2< int >::operator*=(), Vec2< int >::operator+=(), Vec2< int >::operator-=(), Vec2< int >::operator[](), Vec2< int >::set(), Vec2< int >::setX(), and Vec2< int >::x().

template<class T>

T Vec2< T >::m_y

protected

second element

Referenced by Vec2< int >::add(), Vec2< int >::cmp(), Vec2< int >::cmpY(), Vec2< int >::operator*=(), Vec2< int >::operator+=(), Vec2< int >::operator-=(), Vec2< int >::operator[](), Vec2< int >::set(), Vec2< int >::setY(), and Vec2< int >::y().

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

- libmwaw_internal.hxx