boxes.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef BOXES_H
  2. #define BOXES_H
  3. #include <string>
  4. #include <array>
  5. /*
  6. I'm not sure if I want to try to store the color information in this or not.
  7. It might be easier to let this do boxes, and let something else do colors.
  8. */
  9. class Boxes {
  10. struct box_style {
  11. const char top_left;
  12. const char top_right;
  13. const char top;
  14. const char side;
  15. const char bottom_left;
  16. const char bottom_right;
  17. const char middle_left;
  18. const char middle_right;
  19. } boxes[4] = {
  20. {'\xda', '\xbf', '\xc4', '\xb3', '\xc0', '\xd9', '\xc3', '\xb4'},
  21. {'\xc9', '\xbb', '\xcd', '\xba', '\xc8', '\xbc', '\xcc', '\xb9'},
  22. {'\xd6', '\xb8', '\xcd', '\xb3', '\xd4', '\xbe', '\xc6', '\xb5'},
  23. {'\xd6', '\xb7', '\xc4', '\xba', '\xd3', '\xbd', '\xc7', '\xb6'}};
  24. int style_;
  25. int width_;
  26. bool newline_;
  27. const char *nl = "\n\r";
  28. const char *reset = "\x1b[0m";
  29. public:
  30. std::string boxcolor;
  31. std::string textcolor;
  32. Boxes(int width, int style = 1, bool newline = true);
  33. std::string top(void);
  34. std::string middle(void);
  35. std::string row(std::string &line);
  36. std::string bottom(void);
  37. static std::array<std::string, 3>
  38. alert(std::string message, std::string bcolor, std::string tcolor, int width, int style=1, bool newline=true);
  39. };
  40. #endif