Jpp
Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
JGIZMO::JCanvas Class Reference

Data structure for size of TCanvas. More...

#include <JCanvas.hh>

Public Member Functions

 JCanvas ()
 Default constructor. More...
 
 JCanvas (const int __x, const int __y)
 Constructor. More...
 

Public Attributes

int x
 number of pixels in X More...
 
int y
 number of pixels in Y More...
 

Static Public Attributes

static const char SEPARATOR = 'x'
 

Friends

std::istream & operator>> (std::istream &in, JCanvas &cv)
 Read canvas from input stream. More...
 
std::ostream & operator<< (std::ostream &out, const JCanvas &cv)
 Write canvas to output stream. More...
 

Detailed Description

Data structure for size of TCanvas.

Definition at line 26 of file JCanvas.hh.

Constructor & Destructor Documentation

◆ JCanvas() [1/2]

JGIZMO::JCanvas::JCanvas ( )
inline

Default constructor.

Definition at line 31 of file JCanvas.hh.

31  :
32  x(500),
33  y(500)
34  {}

◆ JCanvas() [2/2]

JGIZMO::JCanvas::JCanvas ( const int  __x,
const int  __y 
)
inline

Constructor.

Parameters
__xwidth
__yheight

Definition at line 43 of file JCanvas.hh.

44  :
45  x(__x),
46  y(__y)
47  {}

Friends And Related Function Documentation

◆ operator>>

std::istream& operator>> ( std::istream &  in,
JCanvas cv 
)
friend

Read canvas from input stream.

Parameters
ininput stream
cvcanvas
Returns
input stream

Definition at line 57 of file JCanvas.hh.

58  {
59  using namespace std;
60 
61  string buffer;
62 
63  getline(in,buffer);
64 
65  size_t pos = buffer.find(SEPARATOR);
66 
67  if (pos != string::npos) {
68 
69  istringstream(buffer.substr(0,pos)) >> cv.x;
70  istringstream(buffer.substr(pos+1)) >> cv.y;
71 
72  } else {
73 
74  throw JParseError("JRootObjectID error parsing " + buffer);
75  }
76 
77  return in;
78  }

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const JCanvas cv 
)
friend

Write canvas to output stream.

Parameters
outoutput stream
cvcanvas
Returns
output stream

Definition at line 88 of file JCanvas.hh.

89  {
90  out << cv.x << SEPARATOR << cv.y;
91 
92  return out;
93  }

Member Data Documentation

◆ SEPARATOR

const char JGIZMO::JCanvas::SEPARATOR = 'x'
static

Definition at line 96 of file JCanvas.hh.

◆ x

int JGIZMO::JCanvas::x

number of pixels in X

Definition at line 98 of file JCanvas.hh.

◆ y

int JGIZMO::JCanvas::y

number of pixels in Y

Definition at line 99 of file JCanvas.hh.


The documentation for this class was generated from the following file:
JGIZMO::JCanvas::y
int y
number of pixels in Y
Definition: JCanvas.hh:99
JGIZMO::JCanvas::x
int x
number of pixels in X
Definition: JCanvas.hh:98
JGIZMO::JCanvas::SEPARATOR
static const char SEPARATOR
Definition: JCanvas.hh:96
std
Definition: jaanetDictionary.h:36
JLANG::getline
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:468