#include <hex.h>
Definition at line 174 of file hex.h.
Public Member Functions | |
Point | offset (Distance dx, Distance dy) const |
Point () | |
Point (Distance x_, Distance y_) | |
Point (const std::string s) throw (out_of_range,invalid_argument) | |
Point & | operator+= (const Point &p) |
Point & | operator-= (const Point &p) |
Point | operator+ (const Point &p) const |
Point | operator- (const Point &p) const |
Point | operator * (double v) const |
Point | operator/ (double v) const |
bool | operator== (const Point &p) const |
bool | operator!= (const Point &p) const |
std::string | str (void) const |
Public Attributes | |
Distance | x |
Distance | y |
hex::Point::Point | ( | const std::string | s | ) | throw (out_of_range,invalid_argument) |
Definition at line 38 of file grid.cc.
00039 { 00040 // Parse strings like: / *[-+]?\d+_ *[-+]?\d+([^\d].*)?/ 00041 // E.g. '1_2' ' +2_ 4' '2_4 # comment' 00042 const char* buf =s.c_str(); 00043 char* endptr =NULL; 00044 errno=0; 00045 this->x = ::strtod(buf,&endptr); 00046 if(endptr==buf || *endptr!=',') 00047 throw hex::invalid_argument(s); 00048 buf =endptr+1; 00049 this->y = ::strtod(buf,&endptr); 00050 if(endptr==buf) 00051 throw hex::invalid_argument(s); 00052 if(ERANGE==errno) 00053 throw hex::out_of_range(s); 00054 }
Point hex::Point::operator * | ( | double | v | ) | const [inline] |
Point hex::Point::operator/ | ( | double | v | ) | const [inline] |
bool hex::Point::operator== | ( | const Point & | p | ) | const [inline] |
bool hex::Point::operator!= | ( | const Point & | p | ) | const [inline] |
std::string hex::Point::str | ( | void | ) | const |
Definition at line 176 of file hex.h.
Referenced by hex::Hex::centre(), hex::move::_Route::distance(), hex::svg::Document::header(), operator+(), operator+=(), operator-(), operator-=(), hex::svg::operator<<(), operator==(), str(), and hex::svg::Document::T().
Definition at line 176 of file hex.h.
Referenced by hex::Hex::centre(), hex::move::_Route::distance(), hex::svg::Document::header(), operator+(), operator+=(), operator-(), operator-=(), hex::svg::operator<<(), operator==(), str(), and hex::svg::Document::T().