Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JROOT::JCanvas Class Reference

Data structure for size of TCanvas. More...

#include <JCanvas.hh>

Public Member Functions

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

Public Attributes

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

Static Public Attributes

static const char SEPARATOR = 'x'
 

Friends

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

Detailed Description

Data structure for size of TCanvas.

Definition at line 26 of file JCanvas.hh.

Constructor & Destructor Documentation

◆ JCanvas() [1/2]

JROOT::JCanvas::JCanvas ( )
inline

Default constructor.

Definition at line 31 of file JCanvas.hh.

31 :
32 x(500),
33 y(500)
34 {}
int y
number of pixels in Y
Definition JCanvas.hh:99
int x
number of pixels in X
Definition JCanvas.hh:98

◆ JCanvas() [2/2]

JROOT::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 Symbol 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 if (!(istringstream(buffer.substr(0,pos)) >> cv.x)) { in.setstate(ios::badbit); }
70 if (!(istringstream(buffer.substr(pos+1)) >> cv.y)) { in.setstate(ios::badbit); }
71
72 } else {
73
74 THROW(JParseError, "JCanvas error parsing " << buffer);
75 }
76
77 return in;
78 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
static const char SEPARATOR
Definition JCanvas.hh:96
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition JString.hh:478

◆ 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 JROOT::JCanvas::SEPARATOR = 'x'
static

Definition at line 96 of file JCanvas.hh.

◆ x

int JROOT::JCanvas::x

number of pixels in X

Definition at line 98 of file JCanvas.hh.

◆ y

int JROOT::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: