123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #include "boxes.h"
- Boxes::Boxes(int size, int style, int color, bool newline) {
- size_ = size;
- style_ = style;
- color_ = color;
- newline_ = newline;
- }
- std::string Boxes::top(void) {
- std::string line;
- box_style &bs = boxes[style_];
- const char *clr = colors[color_];
- line.append(clr);
- line.append(bs.top_left);
- for (int x = 0; x < size_; ++x)
- line.append(bs.top);
- line.append(bs.top_right);
- line.append(reset);
- if (newline_)
- line.append(nl);
- return line;
- }
- std::string Boxes::middle(void) {
- std::string line;
- box_style &bs = boxes[style_];
- const char *clr = colors[color_];
- line.append(clr);
- line.append(bs.middle_left);
- for (int x = 0; x < size_; ++x)
- line.append(bs.top);
- line.append(bs.middle_right);
- line.append(reset);
- if (newline_)
- line.append(nl);
- return line;
- }
- std::string Boxes::row(std::string &text) {
- std::string line;
- box_style &bs = boxes[style_];
- const char *clr = colors[color_];
- line.append(clr);
- line.append(bs.side);
- line.append(reset);
- line.append(text);
- line.append(clr);
- line.append(bs.side);
- line.append(reset);
- if (newline_)
- line.append(nl);
- return line;
- }
- std::string Boxes::bottom(void) {
- std::string line;
- box_style &bs = boxes[style_];
- const char *clr = colors[color_];
- line.append(clr);
- line.append(bs.bottom_left);
- for (int x = 0; x < size_; ++x)
- line.append(bs.top);
- line.append(bs.bottom_right);
- line.append(reset);
- if (newline_)
- line.append(nl);
- return line;
- }
- /*
- std::tuple<std::string, std::string, std::string>
- Boxes::alert(std::string message, int size, int color, int style = 1) {}
- */
|