Bugz Door Project
door.h
1 #ifndef DOOR_H
2 #define DOOR_H
3 
4 #include "anyoption.h"
5 #include <cstdint>
6 #include <ctime>
7 #include <fstream>
8 #include <functional>
9 #include <future>
10 #include <iostream>
11 #include <list>
12 #include <memory>
13 #include <ostream>
14 #include <vector>
15 
16 // raw mode
17 #include <termios.h>
18 #include <unistd.h>
19 
20 #define CSI "\x1b["
21 
22 // getkey definitions
23 #define XKEY_START 0x1000
24 
25 #define XKEY_UP_ARROW 0x1001
26 #define XKEY_DOWN_ARROW 0x1002
27 #define XKEY_RIGHT_ARROW 0x1003
28 #define XKEY_LEFT_ARROW 0x1004
29 
30 #define XKEY_HOME 0x1010
31 #define XKEY_END 0x1011
32 #define XKEY_PGUP 0x1012
33 #define XKEY_PGDN 0x1023
34 #define XKEY_INSERT 0x1024
35 #define XKEY_DELETE 0x7f
36 
37 #define XKEY_F1 0x1021
38 #define XKEY_F2 0x1022
39 #define XKEY_F3 0x1023
40 #define XKEY_F4 0x1024
41 #define XKEY_F5 0x1025
42 #define XKEY_F6 0x1026
43 #define XKEY_F7 0x1027
44 #define XKEY_F8 0x1028
45 #define XKEY_F9 0x1029
46 #define XKEY_F10 0x102a
47 #define XKEY_F11 0x102b
48 #define XKEY_F12 0x102c
49 
50 #define XKEY_UNKNOWN 0x1111
51 
52 #define TIMEOUT -1
53 #define HANGUP -2
54 #define OUTOFTIME -3
55 
61 namespace door {
62 
63 extern bool unicode;
64 extern bool full_cp437;
65 extern bool debug_capture;
66 extern std::list<char> pushback;
67 
68 /*
69 Translate CP437 strings to unicode for output.
70 
71 if (door::unicode) {
72  // perform translation
73 }
74 
75  */
76 void cp437toUnicode(std::string input, std::string &out);
77 void cp437toUnicode(const char *input, std::string &out);
78 
79 /*
80 door 2.0
81  */
82 
90 enum class COLOR : std::int8_t {
92  BLACK,
94  RED,
96  GREEN,
98  BROWN,
100  YELLOW = 3,
102  BLUE,
104  MAGENTA,
106  CYAN,
108  WHITE
109 };
110 
114 enum class ATTR : std::int8_t {
116  RESET,
118  BOLD,
120  BRIGHT = 1,
122  BLINK = 5,
124  INVERSE = 7
125 };
126 
137 class ANSIColor {
142  // Track attributes (ATTR)
144  unsigned int reset : 1;
146  unsigned int bold : 1;
148  unsigned int blink : 1;
150  unsigned int inverse : 1;
151 
152 public:
153  ANSIColor();
154  ANSIColor(ATTR a);
155  ANSIColor(COLOR f);
156  ANSIColor(COLOR f, ATTR a);
157  ANSIColor(COLOR f, ATTR a1, ATTR a2);
158  ANSIColor(COLOR f, COLOR b);
159  ANSIColor(COLOR f, COLOR b, ATTR a);
160  ANSIColor(COLOR f, COLOR b, ATTR a1, ATTR a2);
161  ANSIColor &Attr(ATTR a);
162  bool operator==(const ANSIColor &c) const;
163  bool operator!=(const ANSIColor &c) const;
164  void setFg(COLOR f);
165  void setFg(COLOR f, ATTR a);
166  void setBg(COLOR b);
171  COLOR getFg() { return fg; };
176  COLOR getBg() { return bg; };
177  void attr(ATTR a);
178 
179  std::string output(void) const;
180  std::string debug(void);
181  std::string output(ANSIColor &previous) const;
182  friend std::ostream &operator<<(std::ostream &os, const ANSIColor &c);
183 };
184 
190 class Door : public std::ostream, private std::streambuf {
191 
192 private:
193  std::streamsize xsputn(const char *s, std::streamsize n) override;
194  int overflow(int c) override;
196  std::string doorname;
197  void parse_dropfile(const char *filepath);
198  void init(void);
199  std::time_t startup;
201  struct termios tio_default;
202  signed int getch(void);
203  signed int getkey_or_pushback(void);
206  bool debugging;
208  std::string dropfilename;
210  vector<std::string> dropfilelines;
212  ofstream logf;
213  void detect_unicode_and_screen(void);
215  std::promise<void> stop_thread;
216 
219  void time_thread_run(std::future<void> future);
221  std::thread time_thread;
222 
223 public:
224  Door(std::string dname, int argc, char *argv[]);
225  Door(Door &) = delete;
226  virtual ~Door();
227  ofstream &log(void);
229  AnyOption opt;
231  std::string debug_buffer;
232 
240  bool track;
242  int cx;
244  int cy;
246  int width;
248  int height;
257  std::string username;
259  std::string handle;
261  std::string location;
263  std::string sysop;
264  // std::string bbsname;
266  int node;
268  atomic<int> time_left;
270  atomic<int> time_used;
271 
272  signed int getkey(void);
273  bool haskey(void);
274  signed int sleep_key(int secs);
275  signed int sleep_ms_key(int msecs);
276  std::string input_string(int max);
277  int get_one_of(const char *keys);
278 };
279 
280 // Use this to define the deprecated colorizer [POC]
281 // typedef std::function<void(Door &, std::string &)> colorFunction;
282 
291 class ColorOutput {
292 public:
293  ColorOutput();
294  void reset(void);
295 
299  int pos;
301  int len;
302 };
303 
304 /*
305 No, don't do this.
306 
307 Instead, return an iterator/generator.
308  */
309 
319 class Render {
321  std::string text;
322 
323 public:
324  Render(const std::string txt);
325 
327  std::vector<ColorOutput> outputs;
328  void append(ANSIColor color, int len = 1);
329  void output(std::ostream &os);
330 };
331 
355 typedef std::function<Render(const std::string &)> renderFunction;
356 
374 typedef std::function<std::string(void)> updateFunction;
375 
381 class Clrscr {
382 public:
383  Clrscr(void);
384  friend std::ostream &operator<<(std::ostream &os, const Clrscr &clr);
385 };
386 
391 extern Clrscr cls;
392 
398 class NewLine {
399 public:
400  NewLine(void);
401  friend std::ostream &operator<<(std::ostream &os, const NewLine &nl);
402 };
403 
407 extern NewLine nl;
408 
415 
417 enum class Justify { NONE, LEFT, RIGHT, CENTER };
418 
425 class Goto {
427  int x;
429  int y;
430 
431 public:
432  Goto(int xpos, int ypos);
436  Goto(const Goto &) = default;
437  void set(int xpos, int ypos);
438  friend std::ostream &operator<<(std::ostream &os, const Goto &g);
439 };
440 
441 extern const char SaveCursor[];
442 extern const char RestoreCursor[];
443 
444 #ifdef EXPERIMENTAL
445 
446 /* should we try to derive a base class, so you can have multilines of
447  * multilines? */
448 
449 class LineBase {
450 public:
451  virtual ~LineBase() = default;
452  virtual bool update(void) = 0;
453  // friend std::ostream &operator<<(std::ostream &os, const LineBase &lb) = 0;
454 };
455 
456 class BasicLine {
457 private:
458  std::string text;
459  bool hasColor;
460  ANSIColor color;
462  renderFunction render;
464  updateFunction updater;
465 
466 public:
467  BasicLine(std::string txt);
468  BasicLine(std::string txt, ANSIColor c);
469  BasicLine(const BasicLine &rhs) = default;
470  virtual ~BasicLine() = default;
471 
472  bool hasRender(void);
473  void setText(std::string txt);
474  void setColor(ANSIColor c);
475  void setRender(renderFunction rf);
476  void setUpdater(updateFunction uf);
477  bool update(void);
478 
479  friend std::ostream &operator<<(std::ostream &os, const BasicLine &l);
480 };
481 
482 class MultiLine {
483 private:
484  std::vector<std::shared_ptr<BasicLine>> lines;
485 
486 public:
487  MultiLine();
488  void append(std::shared_ptr<BasicLine> bl);
489 
490  bool update(void);
491  friend std::ostream &operator<<(std::ostream &os, const MultiLine &l);
492 };
493 
494 #endif
495 
502 class Line {
503 private:
505  std::string text;
506 
508  bool hasColor;
512  std::string padding;
515 
520 
521  int width;
522 
526  // void makeWidth(int width);
527 
528 public:
529  Line(const std::string &txt, int width = 0);
530  Line(const char *txt, int width = 0);
531  Line(const std::string &txt, int width, ANSIColor c);
532  Line(const char *txt, int width, ANSIColor c);
533  Line(const std::string &txt, int width, renderFunction rf);
534  Line(const char *txt, int width, renderFunction rf);
535  Line(const Line &rhs);
536  Line(Line &&rhs);
537  // ~Line();
538 
539  bool hasRender(void);
540  int length(void); // const;
541  void fit(void);
546  void setPadding(std::string &padstring, ANSIColor padColor);
551  void setPadding(const char *padstring, ANSIColor padcolor);
552  void setText(std::string &txt);
553  void setText(const char *txt);
554  const char *getText(void) { return text.c_str(); };
555  void setColor(ANSIColor c);
556  void setRender(renderFunction rf);
557  void setUpdater(updateFunction uf);
558  bool update(void);
559 
560  std::string debug(void);
561 
574  friend std::ostream &operator<<(std::ostream &os, const Line &l);
575 };
576 
579 
584 enum class BorderStyle {
586  NONE,
588  SINGLE,
590  DOUBLE,
596  BLANK
597 };
598 
599 class Panel {
600 protected:
601  int x;
602  int y;
603  int width; // or padding ?
604  BorderStyle border_style;
605  ANSIColor border_color;
612  std::vector<std::unique_ptr<Line>> lines;
613  bool hidden;
614  // when you show panel, should it mark it as
615  // redisplay everything?? maybe??
616  bool shown_once; // ?? maybe shown_once_already ?
617  std::unique_ptr<Line> title;
618  int offset;
619 
620 public:
621  Panel(int x, int y, int width);
622  Panel(int width);
623 
624  // Panel(const Panel &);
625  Panel(Panel &) = delete; // default;
626  Panel(Panel &&ref);
627 
628  void set(int x, int y);
629  void get(int &x, int &y) {
630  x = this->x;
631  y = this->y;
632  };
633 
634  void setTitle(std::unique_ptr<Line> T, int off = 1);
635  void setStyle(BorderStyle bs);
636  void setColor(ANSIColor c);
637  int getWidth(void) { return width; };
638  int getHeight(void) {
639  if (border_style == BorderStyle::NONE)
640  return lines.size();
641  else
642  return lines.size() + 2;
643  };
644  void hide(void);
645  void show(void);
646  void addLine(std::unique_ptr<Line> l);
647  // bool delLine(std::shared_ptr<Line> l); // ?
648  /*
649  void display(void);
650  void update(void);
651  */
652 
663  bool update(Door &d);
664  void update(Door &d, int line);
665  void update(void);
666  door::Goto gotoEnd(void);
667  std::unique_ptr<Line> spacer_line(bool single);
668  void lineSetBack(ANSIColor back);
669  friend std::ostream &operator<<(std::ostream &os, const Panel &p);
670 };
671 
672 /*
673 Menu - defaults to double lines.
674 Has colorize for selected item / non-selected.
675 Arrow keys + ENTER, or keypress to select an item.
676 [O] Option Displayed Here
677 
678 [ + ] = c1
679 O = c2
680 Remaining UC TEXT = c3
681 Remaining LC text = c4
682 
683 // Colors for CS and CU (color selected, color unselected)
684  */
685 
686 class Menu : public Panel {
687 private:
688  unsigned int chosen;
689  std::vector<char> options;
690  renderFunction selectedRender;
691  renderFunction unselectedRender;
692  /*
693  std::function<void(Door &d, std::string &)> selectedColorizer;
694  std::function<void(Door &d, std::string &)> unselectedColorizer;
695  */
696 
697 public:
698  static renderFunction defaultSelectedRender;
699  static renderFunction defaultUnselectedRender;
700  /*
701  static std::function<void(Door &d, std::string &)> defaultSelectedColorizer;
702  static std::function<void(Door &d, std::string &)> defaultUnselectedColorizer;
703  */
704 
705  Menu(int x, int y, int width);
706  Menu(int width);
707  // Menu(const Menu &);
708  Menu(const Menu &) = delete;
709  Menu(Menu &&);
710 
711  void addSelection(char c, const char *line);
712  void addSelection(char c, const char *line, updateFunction update);
713  void defaultSelection(int d);
714  void setRender(bool selected, renderFunction render);
715 
716  int choose(Door &door);
717  char which(int d);
718 
720  ANSIColor c4);
721 };
722 
723 class Screen {
724 private:
725  // bool hidden;
729  std::vector<std::unique_ptr<Panel>> panels;
730 
731 public:
732  Screen(void);
733  Screen(Screen &) = default;
734  void addPanel(std::unique_ptr<Panel> p);
735  /*
736 bool delPanel(std::shared_ptr<Panel> p);
737 
738 void hide(void);
739 void show(void);
740 */
741  bool update(Door &d);
742  void update(void);
743 
744  friend std::ostream &operator<<(std::ostream &os, const Screen &s);
745 };
746 
747 /*
748 screen - contains panels.
749  - default to 1,1 X 80,24
750  - refresh(style) could redraw panels by order they were added,
751  or could redraw panels from top to bottom, left to right.
752 
753 crazy ideas:
754  hide panels / z-order
755  how to handle panel on top of other panels?
756  Can I have you win + show animated final score calculations?
757 
758 panel - has X,Y and width, optional length. contains lines.
759  length could be simply number of "lines".
760  - has optional border. double/single/Ds/Sd TOPbottom
761  - has optional title.
762  - has optional footer.
763 
764  addLine()
765  append() - Appends another line to current line.
766 
767  set(X,Y) - set a "line" at a given X,Y position.
768 
769 menu - another type of panel, contains menu options/lines.
770 
771 lightmenu - like above, but allows arrow keys to select menu options.
772 
773 line - contains text.
774  (Maybe a "dirty" flag is needed here?)
775  - has optional (width)
776  - has optional (justify - L, R, Center)
777  - has optional padding (# of blank chars)
778  - has color (of text)
779  - has formatter/coloring function (to colorize the text)
780  Example would be one that sets capital letters to one color, lower to another.
781  Another example would be one that displays Score: XXX, where Score is one
782  color, : is another, and XXX is yet another. Properly padded, of course.
783  - has "lambda" function to update the value? (Maybe?)
784  Idea would be that I could update the score, and panel.update(). It would
785  call all the line.update() functions and only update anything that has
786  changed.
787 
788  Crazy ideas:
789  Can I delete a line, and have it automatically removed from a panel?
790 
791 lightline - text, changes format/coloring if focus/nofocus is set?
792 
793  */
794 
795 } // namespace door
796 #endif
door::Goto
ANSI Goto X, Y position.
Definition: door.h:425
door::Line::length
int length(void)
Definition: lines.cpp:203
door::Line::fit
void fit(void)
Definition: lines.cpp:225
door::Door
Definition: door.h:190
door::Door::getkey_or_pushback
signed int getkey_or_pushback(void)
Definition: door.cpp:769
door::NewLine
CR+LF.
Definition: door.h:398
door::COLOR::BROWN
@ BROWN
BROWN (3)
door::Line::paddingColor
ANSIColor paddingColor
Padding color.
Definition: door.h:514
door::Door::username
std::string username
Definition: door.h:257
door::ANSIColor::debug
std::string debug(void)
Output debug string for ANSIColor.
Definition: ansicolor.cpp:249
door::Render::output
void output(std::ostream &os)
Definition: door.cpp:1281
door::ColorOutput::ColorOutput
ColorOutput()
Definition: door.cpp:1249
door::ANSIColor::Attr
ANSIColor & Attr(ATTR a)
Definition: ansicolor.cpp:112
door::Line::updater
updateFunction updater
updateFunction to use when updating.
Definition: door.h:519
door::ATTR::BLINK
@ BLINK
SLOW BLINK.
door::ATTR::BOLD
@ BOLD
BOLD is the same as BRIGHT.
door::Door::log
ofstream & log(void)
Give ofstream handle for logging.
Definition: door.cpp:654
door::Clrscr::Clrscr
Clrscr(void)
Definition: door.cpp:1324
door::ColorOutput::c
ANSIColor c
Color to use for this fragment.
Definition: door.h:297
door::Door::Door
Door(std::string dname, int argc, char *argv[])
Construct a new Door:: Door object.
Definition: door.cpp:231
door::ANSIColor::operator==
bool operator==(const ANSIColor &c) const
Definition: ansicolor.cpp:138
door::Door::cx
int cx
Definition: door.h:242
door::Door::doorname
std::string doorname
Definition: door.h:196
door::Goto::x
int x
X-Position.
Definition: door.h:427
door::Door::time_used
atomic< int > time_used
Definition: door.h:270
door::Render::append
void append(ANSIColor color, int len=1)
Definition: door.cpp:1296
door::Door::previous
ANSIColor previous
Definition: door.h:238
door::full_cp437
bool full_cp437
Was full CP437 detected?
Definition: door.cpp:216
door::Panel::operator<<
friend std::ostream & operator<<(std::ostream &os, const Panel &p)
Output panel to stream.
Definition: panel.cpp:390
door::COLOR::CYAN
@ CYAN
CYAN (6)
door::ATTR::INVERSE
@ INVERSE
INVERSE is Background on Foreground.
door::ANSIColor::attr
void attr(ATTR a)
Set attribute.
Definition: ansicolor.cpp:194
door::ANSIColor::fg
COLOR fg
Definition: door.h:139
door::cp437toUnicode
void cp437toUnicode(std::string input, std::string &out)
Convert from CP437 to unicode.
Definition: door.cpp:181
door::Door::node
int node
Definition: door.h:266
door::Door::sleep_key
signed int sleep_key(int secs)
Waits secs seconds for a keypress.
Definition: door.cpp:1028
door::ANSIColor::inverse
unsigned int inverse
Definition: door.h:150
door::Render::outputs
std::vector< ColorOutput > outputs
Vector of ColorOutput object.
Definition: door.h:327
door::ATTR::BRIGHT
@ BRIGHT
BRIGHT is the same as BOLD.
door::Door::dropfilelines
vector< std::string > dropfilelines
Definition: door.h:210
door::Line::setColor
void setColor(ANSIColor c)
Definition: lines.cpp:277
door::Line::Line
Line(const std::string &txt, int width=0)
Definition: lines.cpp:121
door::NewLine::NewLine
NewLine(void)
Definition: door.cpp:1358
door::operator<<
std::ostream & operator<<(std::ostream &os, const ANSIColor &c)
Definition: ansicolor.cpp:371
door::ANSIColor::operator!=
bool operator!=(const ANSIColor &c) const
Definition: ansicolor.cpp:151
door::ColorOutput::pos
int pos
Starting position of Render.text.
Definition: door.h:299
door::Goto::operator<<
friend std::ostream & operator<<(std::ostream &os, const Goto &g)
Definition: door.cpp:1409
door::COLOR
COLOR
The colors available under ANSI-BBS.
Definition: door.h:90
door::ANSIColor
Foreground, Background and Attributes.
Definition: door.h:137
door::Door::stop_thread
std::promise< void > stop_thread
Definition: door.h:215
door::Door::input_string
std::string input_string(int max)
Input a string of requested max length.
Definition: door.cpp:1123
door::Door::get_one_of
int get_one_of(const char *keys)
Get one of these keys.
Definition: door.cpp:1174
door::Menu
Definition: door.h:686
door::Door::location
std::string location
Definition: door.h:261
door::ANSIColor::getFg
COLOR getFg()
Definition: door.h:171
door::Door::tio_default
struct termios tio_default
Definition: door.h:201
door::Line::render
renderFunction render
renderFunction to use when rendering Line.
Definition: door.h:517
door::COLOR::GREEN
@ GREEN
GREEN (2)
door::COLOR::MAGENTA
@ MAGENTA
MAGENTA (5)
door::ANSIColor::setFg
void setFg(COLOR f)
Set foreground color.
Definition: ansicolor.cpp:161
door::Door::cy
int cy
Definition: door.h:244
door::Door::dropfilename
std::string dropfilename
Definition: door.h:208
door::Goto::y
int y
Y-Position.
Definition: door.h:429
door::renderFunction
std::function< Render(const std::string &)> renderFunction
Render output function.
Definition: door.h:355
door::Door::logf
ofstream logf
Definition: door.h:212
door::BorderStyle::DOUBLE_SINGLE
@ DOUBLE_SINGLE
DOUBLE top SINGLE side (4)
door::Line::color
ANSIColor color
Line color.
Definition: door.h:510
door::Render::Render
Render(const std::string txt)
Definition: door.cpp:1270
door::ANSIColor::getBg
COLOR getBg()
Definition: door.h:176
door::Panel::spacer_line
std::unique_ptr< Line > spacer_line(bool single)
Create a spacer line using block drawing characters.
Definition: panel.cpp:357
door::BorderStyle::NONE
@ NONE
NONE (0)
door::ANSIColor::blink
unsigned int blink
Definition: door.h:148
door::cls
Clrscr cls
Definition: door.cpp:1352
door::Line::setPadding
void setPadding(std::string &padstring, ANSIColor padColor)
Definition: lines.cpp:256
door::ANSIColor::reset
unsigned int reset
Definition: door.h:144
door::Line
Text and ANSIColor.
Definition: door.h:502
door::Line::operator<<
friend std::ostream & operator<<(std::ostream &os, const Line &l)
Definition: lines.cpp:354
door::Door::opt
AnyOption opt
Definition: door.h:229
door::Clrscr::operator<<
friend std::ostream & operator<<(std::ostream &os, const Clrscr &clr)
Definition: door.cpp:1336
door::Door::time_thread
std::thread time_thread
Definition: door.h:221
door::COLOR::RED
@ RED
RED (1)
door::Menu::Menu
Menu(int x, int y, int width)
Construct a new Menu object.
Definition: panel.cpp:579
door::ATTR::RESET
@ RESET
RESET forces all attributes (and Colors) to be sent.
door::Screen::operator<<
friend std::ostream & operator<<(std::ostream &os, const Screen &s)
Outputs screen to stream.
Definition: panel.cpp:926
door::BorderStyle::DOUBLE
@ DOUBLE
DOUBLE (2)
door::Panel::lines
std::vector< std::unique_ptr< Line > > lines
Definition: door.h:612
door::updateFunction
std::function< std::string(void)> updateFunction
Definition: door.h:374
door::nl
NewLine nl
Definition: door.cpp:1380
door::Panel::update
bool update(Door &d)
Updates a panel.
Definition: panel.cpp:273
door::BorderStyle::SINGLE_DOUBLE
@ SINGLE_DOUBLE
SINGLE top DOUBLE side (3)
door::Line::hasRender
bool hasRender(void)
Definition: lines.cpp:188
door::ANSIColor::output
std::string output(void) const
Definition: ansicolor.cpp:207
door::rBlueYellow
renderFunction rBlueYellow
BlueYellow Render example function.
Definition: door.cpp:1443
door::Line::text
std::string text
Text of the line.
Definition: door.h:505
door::COLOR::YELLOW
@ YELLOW
YELLOW (3)
door::ATTR
ATTR
ANSI-BBS text attributes.
Definition: door.h:114
door::Panel::set
void set(int x, int y)
Set the panels X and Y screen position.
Definition: panel.cpp:79
door::reset
ANSIColor reset(ATTR::RESET)
reset colors to normal
Definition: door.h:414
door::ANSIColor::ANSIColor
ANSIColor()
Definition: ansicolor.cpp:16
door::Door::detect_unicode_and_screen
void detect_unicode_and_screen(void)
Detect unicode/CP437, and screen size.
Definition: door.cpp:457
door::ANSIColor::setBg
void setBg(COLOR b)
Set background color.
Definition: ansicolor.cpp:185
door::COLOR::WHITE
@ WHITE
WHITE (7)
door::Line::update
bool update(void)
Definition: lines.cpp:319
door::Door::inactivity
int inactivity
Number of seconds before timing out.
Definition: door.h:255
door::Door::track
bool track
Definition: door.h:240
door::Door::has_dropfile
bool has_dropfile
Definition: door.h:205
door::Panel::lineSetBack
void lineSetBack(ANSIColor back)
Set background of all lines in the panel.
Definition: panel.cpp:344
door::Screen::panels
std::vector< std::unique_ptr< Panel > > panels
vector of panels.
Definition: door.h:729
door::Door::height
int height
Definition: door.h:248
door::Line::padding
std::string padding
Padding characters.
Definition: door.h:512
door::BorderStyle::SINGLE
@ SINGLE
SINGLE (1)
door::SaveCursor
const char SaveCursor[]
ANSI Save Cursor position command.
Definition: door.cpp:1434
door::Door::handle
std::string handle
Definition: door.h:259
door::Door::xsputn
std::streamsize xsputn(const char *s, std::streamsize n) override
Definition: door.cpp:1202
door::BorderStyle
BorderStyle
Definition: door.h:584
door::unicode
bool unicode
Was unicode detected?
Definition: door.cpp:208
door::ANSIColor::operator<<
friend std::ostream & operator<<(std::ostream &os, const ANSIColor &c)
Definition: ansicolor.cpp:371
door
The BBS door project. This is an attempt at writing a C++ BBS door toolkit.
Definition: ansicolor.cpp:9
door::BorderStyle::BLANK
@ BLANK
BLANK (5)
door::Door::debug_buffer
std::string debug_buffer
Definition: door.h:231
door::Door::overflow
int overflow(int c) override
Definition: door.cpp:1229
door::ColorOutput::len
int len
Length.
Definition: door.h:301
door::Justify
Justify
Definition: door.h:417
door::Menu::choose
int choose(Door &door)
Definition: panel.cpp:757
door::Menu::makeRender
static renderFunction makeRender(ANSIColor c1, ANSIColor c2, ANSIColor c3, ANSIColor c4)
Definition: panel.cpp:712
door::Door::width
int width
Definition: door.h:246
door::Door::parse_dropfile
void parse_dropfile(const char *filepath)
Load dropfile into dropfilelines and parse.
Definition: door.cpp:576
door::COLOR::BLUE
@ BLUE
BLUE (4)
door::pushback
std::list< char > pushback
pushback buffer for keys.
Definition: door.cpp:60
door::Clrscr
Clear the screen.
Definition: door.h:381
door::debug_capture
bool debug_capture
Capture the output for debugging.
Definition: door.cpp:222
door::ColorOutput::reset
void reset(void)
Definition: door.cpp:1257
door::ANSIColor::bg
COLOR bg
Definition: door.h:141
door::Screen
Definition: door.h:723
door::Door::getch
signed int getch(void)
low level read key.
Definition: door.cpp:714
door::Door::getkey
signed int getkey(void)
Get a key routine.
Definition: door.cpp:790
door::Goto::Goto
Goto(int xpos, int ypos)
Definition: door.cpp:1388
door::Door::haskey
bool haskey(void)
Are there any keys in STDIN?
Definition: door.cpp:672
door::Door::seconds_elapsed
int seconds_elapsed
Definition: door.h:218
door::Line::setText
void setText(std::string &txt)
Definition: lines.cpp:243
door::RestoreCursor
const char RestoreCursor[]
ANSI Restore Cursor position command.
Definition: door.cpp:1438
door::COLOR::BLACK
@ BLACK
BLACK (0)
door::Door::time_left
atomic< int > time_left
Definition: door.h:268
door::Render
Rendering a string with ANSIColor.
Definition: door.h:319
door::Line::hasColor
bool hasColor
Do we have color?
Definition: door.h:508
door::Render::text
std::string text
Complete text to be rendered.
Definition: door.h:321
door::Door::sysop
std::string sysop
Definition: door.h:263
door::Door::sleep_ms_key
signed int sleep_ms_key(int msecs)
Waits miliseconds for a keypress.
Definition: door.cpp:1074
door::Panel
Definition: door.h:599
door::NewLine::operator<<
friend std::ostream & operator<<(std::ostream &os, const NewLine &nl)
Definition: door.cpp:1366
door::Line::setUpdater
void setUpdater(updateFunction uf)
Definition: lines.cpp:298
door::ColorOutput
This holds an ANSIColor and text position + length.
Definition: door.h:291
door::ANSIColor::bold
unsigned int bold
Definition: door.h:146
door::Line::setRender
void setRender(renderFunction rf)
Definition: lines.cpp:289