Electroneum
Canvas Class Reference

Public Member Functions

 Canvas ()
 
 ~Canvas ()
 
void Clear ()
 
void AddShape (Shape *shape)
 
void Print (std::ostream &os)
 

Friends

template<typename Archiver >
Archiveroperator & (Archiver &ar, Canvas &c)
 

Detailed Description

Definition at line 202 of file archivertest.cpp.

Constructor & Destructor Documentation

◆ Canvas()

Canvas::Canvas ( )
inline

Definition at line 204 of file archivertest.cpp.

204 : shapes_() {}

◆ ~Canvas()

Canvas::~Canvas ( )
inline

Definition at line 205 of file archivertest.cpp.

205 { Clear(); }
void Clear()
Here is the call graph for this function:

Member Function Documentation

◆ AddShape()

void Canvas::AddShape ( Shape shape)
inline

Definition at line 212 of file archivertest.cpp.

212 { shapes_.push_back(shape); }
Here is the caller graph for this function:

◆ Clear()

void Canvas::Clear ( )
inline

Definition at line 207 of file archivertest.cpp.

207  {
208  for (std::vector<Shape*>::iterator itr = shapes_.begin(); itr != shapes_.end(); ++itr)
209  delete *itr;
210  }
Here is the caller graph for this function:

◆ Print()

void Canvas::Print ( std::ostream &  os)
inline

Definition at line 214 of file archivertest.cpp.

214  {
215  for (std::vector<Shape*>::iterator itr = shapes_.begin(); itr != shapes_.end(); ++itr) {
216  (*itr)->Print(os);
217  std::cout << std::endl;
218  }
219  }
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator &

template<typename Archiver >
Archiver& operator& ( Archiver ar,
Canvas c 
)
friend

Definition at line 245 of file archivertest.cpp.

245  {
246  size_t shapeCount = c.shapes_.size();
247  ar.StartArray(&shapeCount);
248  if (ar.IsReader) {
249  c.Clear();
250  c.shapes_.resize(shapeCount);
251  }
252  for (size_t i = 0; i < shapeCount; i++)
253  ar & c.shapes_[i];
254  return ar.EndArray();
255 }
void Clear()

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