Е
Size: a a a
Е
VS
VS
VS
D
RN
VS
LA
VS
LA
W
MN
MN
class Screen {
//friend class frs;
friend void frs::clear(Screen t);
friend void test(Screen t) {
cout << "call from object" << endl;
}
public:
typedef string::size_type pos;
//constructors
Screen() = default;
Screen(pos ht , pos wd , char c) : height(ht) , width(wd) , contents(ht * wd , c) {}
Screen( pos ht , pos wd , initializer_list<char> pixels , char def = ' '):height(ht) , width(wd) , contents(ht*wd , def) {
int y = 0 , x = 0;
if(pixels.size() <= (width * height)) {
for(const char *beg = begin(pixels); beg != end(pixels); ++beg) {
contents[y * width + x] = *beg;
// cout << "was imported in:" << (y*width + x) << endl;
++x;
if(x == width) {
x = 0;
++y;
}
if(y == height) {
break;
}
}
}
}
void t_m() {
test(*this);
}
//methods
Screen& display() {
print(cout);
return *this;
}
const Screen& display() const {
print(cout);
return *this;
}
Screen& display(ostream &os) {
print(os);
return *this;
}
const Screen& display(ostream& os) const {
print(os);
return *this;
}
char get() const {
return contents[cursor];
}
inline Screen& set(char c) {
contents[cursor] = c;
return *this;
}
inline char get(pos , pos ) const;
inline Screen& set(pos ht , pos wd , char c);
Screen &move(pos r, pos c);
private:
void print(ostream &os) const {
int c = 0;
os << " "<< string(width , '_') << endl;
os << '|';
for(string::const_iterator cb = contents.cbegin(); cb != contents.cend(); ++cb ) {
os << *cb;
if(++c == width) {
os << '|';
os << endl;
if((cb+1) != contents.cend())
os << '|';
c = 0;
}
}
os <<" " << string(width , '-') << endl;
}
pos cursor = 0;
pos height = 0;
pos width = 0;
string contents;
};
MN
r
warning: the frame size of 2064 bytes is larger than 2048 bytes [-Wframe-larger-than=]
. Что читать?VD
warning: the frame size of 2064 bytes is larger than 2048 bytes [-Wframe-larger-than=]
. Что читать?r
RN
NI