-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCanvas.h
More file actions
44 lines (28 loc) · 932 Bytes
/
Canvas.h
File metadata and controls
44 lines (28 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef CANVAS_H
#define CANVAS_H
#include <vector>
#include <ostream>
class Canvas {
public:
Canvas() = delete;
Canvas(int c, int r, char ch); // default char is blank space
explicit Canvas(const Canvas &) = default;
virtual ~Canvas() = default;
const Canvas &operator=(const Canvas &rhs);
int getRowsM() const;
int getColsN() const;
const std::vector<std::vector<char> > &getGrid() const;
void clear(char ch = '.');
void putChar(char ch, int c, int r);
char getChar(int c, int r) const;
void decorate();
bool valid(int c, int r) const;
protected:
std::vector<std::vector<char> > grid; // maybe should be made pvt and add pub method setChar(int c, int r)
private:
int colsN; // number of columns
int rowsM; // number of rows
static const char BLANK{' '};
};
const std::ostream &operator<<(std::ostream &os, const Canvas &rhs);
#endif // !CANVAS_H