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 
57 namespace door {
58 
59 extern bool unicode;
60 extern bool full_cp437;
61 extern bool debug_capture;
62 extern std::list<char> pushback;
63 
64 /*
65 Translate CP437 strings to unicode for output.
66 
67 if (door::unicode) {
68  // perform translation
69 }
70 
71  */
72 void cp437toUnicode(std::string input, std::string &out);
73 void cp437toUnicode(const char *input, std::string &out);
74 
75 /*
76 door 2.0
77  */
78 
86 enum class COLOR : std::int8_t {
88  BLACK,
90  RED,
92  GREEN,
94  BROWN,
96  YELLOW = 3,
98  BLUE,
100  MAGENTA,
102  CYAN,
104  WHITE
105 };
106 
110 enum class ATTR : std::int8_t {
112  RESET,
114  BOLD,
116  BRIGHT = 1,
118  BLINK = 5,
120  INVERSE = 7
121 };
122 
133 class ANSIColor {
138  // Track attributes (ATTR)
140  unsigned int reset : 1;
142  unsigned int bold : 1;
144  unsigned int blink : 1;
146  unsigned int inverse : 1;
147 
148 public:
149  ANSIColor();
150  ANSIColor(ATTR a);
151  ANSIColor(COLOR f);
152  ANSIColor(COLOR f, ATTR a);
153  ANSIColor(COLOR f, ATTR a1, ATTR a2);
154  ANSIColor(COLOR f, COLOR b);
155  ANSIColor(COLOR f, COLOR b, ATTR a);
156  ANSIColor(COLOR f, COLOR b, ATTR a1, ATTR a2);
157  ANSIColor &Attr(ATTR a);
158  bool operator==(const ANSIColor &c) const;
159  bool operator!=(const ANSIColor &c) const;
160  void setFg(COLOR f);
161  void setFg(COLOR f, ATTR a);
162  void setBg(COLOR b);
167  COLOR getFg() { return fg; };
172  COLOR getBg() { return bg; };
173  void attr(ATTR a);
174 
175  std::string output(void) const;
176  std::string debug(void);
177  std::string output(ANSIColor &previous) const;
178  friend std::ostream &operator<<(std::ostream &os, const ANSIColor &c);
179 };
180 
186 class Door : public std::ostream, private std::streambuf {
187 
188 private:
189  std::streamsize xsputn(const char *s, std::streamsize n) override;
190  int overflow(int c) override;
192  std::string doorname;
193  void parse_dropfile(const char *filepath);
194  void init(void);
195  std::time_t startup;
197  struct termios tio_default;
198  signed int getch(void);
199  signed int getkey_or_pushback(void);
202  bool debugging;
204  std::string dropfilename;
206  vector<std::string> dropfilelines;
208  ofstream logf;
209  void detect_unicode_and_screen(void);
211  std::promise<void> stop_thread;
212 
215  void time_thread_run(std::future<void> future);
217  std::thread time_thread;
218 
219 public:
220  Door(std::string dname, int argc, char *argv[]);
221  Door(Door &) = delete;
222  virtual ~Door();
223  ofstream &log(void);
225  AnyOption opt;
227  std::string debug_buffer;
228 
236  bool track;
238  int cx;
240  int cy;
242  int width;
244  int height;
253  std::string username;
255  std::string handle;
257  std::string location;
259  std::string sysop;
260  // std::string bbsname;
262  int node;
264  atomic<int> time_left;
266  atomic<int> time_used;
267 
268  signed int getkey(void);
269  bool haskey(void);
270  signed int sleep_key(int secs);
271  std::string input_string(int max);
272  int get_one_of(const char *keys);
273 };
274 
275 // Use this to define the deprecated colorizer [POC]
276 // typedef std::function<void(Door &, std::string &)> colorFunction;
277 
286 class ColorOutput {
287 public:
288  ColorOutput();
289  void reset(void);
290 
294  int pos;
296  int len;
297 };
298 
299 /*
300 No, don't do this.
301 
302 Instead, return an iterator/generator.
303  */
304 
314 class Render {
315 public:
316  Render(const std::string txt);
318  const std::string text;
320  std::vector<ColorOutput> outputs;
321  void append(ANSIColor color, int len = 1);
322  void output(std::ostream &os);
323 };
324 
348 typedef std::function<Render(const std::string &)> renderFunction;
349 
367 typedef std::function<std::string(void)> updateFunction;
368 
374 class Clrscr {
375 public:
376  Clrscr(void);
377  friend std::ostream &operator<<(std::ostream &os, const Clrscr &clr);
378 };
379 
384 extern Clrscr cls;
385 
391 class NewLine {
392 public:
393  NewLine(void);
394  friend std::ostream &operator<<(std::ostream &os, const NewLine &nl);
395 };
396 
400 extern NewLine nl;
401 
408 
410 enum class Justify { NONE, LEFT, RIGHT, CENTER };
411 
418 class Goto {
420  int x;
422  int y;
423 
424 public:
425  Goto(int xpos, int ypos);
429  Goto(const Goto &) = default;
430  void set(int xpos, int ypos);
431  friend std::ostream &operator<<(std::ostream &os, const Goto &g);
432 };
433 
434 extern const char SaveCursor[];
435 extern const char RestoreCursor[];
436 
437 #ifdef EXPERIMENTAL
438 
439 /* should we try to derive a base class, so you can have multilines of
440  * multilines? */
441 
442 class LineBase {
443 public:
444  virtual ~LineBase() = default;
445  virtual bool update(void) = 0;
446  // friend std::ostream &operator<<(std::ostream &os, const LineBase &lb) = 0;
447 };
448 
449 class BasicLine {
450 private:
451  std::string text;
452  bool hasColor;
453  ANSIColor color;
455  renderFunction render;
457  updateFunction updater;
458 
459 public:
460  BasicLine(std::string txt);
461  BasicLine(std::string txt, ANSIColor c);
462  BasicLine(const BasicLine &rhs) = default;
463  virtual ~BasicLine() = default;
464 
465  bool hasRender(void);
466  void setText(std::string txt);
467  void setColor(ANSIColor c);
468  void setRender(renderFunction rf);
469  void setUpdater(updateFunction uf);
470  bool update(void);
471 
472  friend std::ostream &operator<<(std::ostream &os, const BasicLine &l);
473 };
474 
475 class MultiLine {
476 private:
477  std::vector<std::shared_ptr<BasicLine>> lines;
478 
479 public:
480  MultiLine();
481  void append(std::shared_ptr<BasicLine> bl);
482 
483  bool update(void);
484  friend std::ostream &operator<<(std::ostream &os, const MultiLine &l);
485 };
486 
487 #endif
488 
495 class Line {
496 private:
498  std::string text;
499 
501  bool hasColor;
505  std::string padding;
508 
513 
514  int width;
515 
519  // void makeWidth(int width);
520 
521 public:
522  Line(const std::string &txt, int width = 0);
523  Line(const char *txt, int width = 0);
524  Line(const std::string &txt, int width, ANSIColor c);
525  Line(const char *txt, int width, ANSIColor c);
526  Line(const std::string &txt, int width, renderFunction rf);
527  Line(const char *txt, int width, renderFunction rf);
528  Line(const Line &rhs);
529  Line(Line &&rhs);
530  // ~Line();
531 
532  bool hasRender(void);
533  int length(void); // const;
534  void fit(void);
539  void setPadding(std::string &padstring, ANSIColor padColor);
544  void setPadding(const char *padstring, ANSIColor padcolor);
545  void setText(std::string &txt);
546  void setText(const char *txt);
547  const char *getText(void) { return text.c_str(); };
548  void setColor(ANSIColor c);
549  void setRender(renderFunction rf);
550  void setUpdater(updateFunction uf);
551  bool update(void);
552 
553  std::string debug(void);
554 
567  friend std::ostream &operator<<(std::ostream &os, const Line &l);
568 };
569 
572 
577 enum class BorderStyle {
579  NONE,
581  SINGLE,
583  DOUBLE,
589  BLANK
590 };
591 
592 class Panel {
593 protected:
594  int x;
595  int y;
596  int width; // or padding ?
597  BorderStyle border_style;
598  ANSIColor border_color;
605  std::vector<std::unique_ptr<Line>> lines;
606  bool hidden;
607  // when you show panel, should it mark it as
608  // redisplay everything?? maybe??
609  bool shown_once; // ?? maybe shown_once_already ?
610  std::unique_ptr<Line> title;
611  int offset;
612 
613 public:
614  Panel(int x, int y, int width);
615  Panel(int width);
616 
617  // Panel(const Panel &);
618  Panel(Panel &) = delete; // default;
619  Panel(Panel &&ref);
620 
621  void set(int x, int y);
622  /*
623  void get(int &x, int &y) {
624  x = this->x;
625  y = this->y;
626  }; */
627  void setTitle(std::unique_ptr<Line> T, int off = 1);
628  void setStyle(BorderStyle bs);
629  void setColor(ANSIColor c);
630  int getWidth(void) { return width; };
631  int getHeight(void) {
632  if (border_style == BorderStyle::NONE)
633  return lines.size();
634  else
635  return lines.size() + 2;
636  };
637  void hide(void);
638  void show(void);
639  void addLine(std::unique_ptr<Line> l);
640  // bool delLine(std::shared_ptr<Line> l); // ?
641  /*
642  void display(void);
643  void update(void);
644  */
645 
656  bool update(Door &d);
657  void update(Door &d, int line);
658  void update(void);
659  door::Goto gotoEnd(void);
660  std::unique_ptr<Line> spacer_line(bool single);
661  void lineSetBack(ANSIColor back);
662  friend std::ostream &operator<<(std::ostream &os, const Panel &p);
663 };
664 
665 /*
666 Menu - defaults to double lines.
667 Has colorize for selected item / non-selected.
668 Arrow keys + ENTER, or keypress to select an item.
669 [O] Option Displayed Here
670 
671 [ + ] = c1
672 O = c2
673 Remaining UC TEXT = c3
674 Remaining LC text = c4
675 
676 // Colors for CS and CU (color selected, color unselected)
677  */
678 
679 class Menu : public Panel {
680 private:
681  unsigned int chosen;
682  std::vector<char> options;
683  renderFunction selectedRender;
684  renderFunction unselectedRender;
685  /*
686  std::function<void(Door &d, std::string &)> selectedColorizer;
687  std::function<void(Door &d, std::string &)> unselectedColorizer;
688  */
689 
690 public:
691  static renderFunction defaultSelectedRender;
692  static renderFunction defaultUnselectedRender;
693  /*
694  static std::function<void(Door &d, std::string &)> defaultSelectedColorizer;
695  static std::function<void(Door &d, std::string &)> defaultUnselectedColorizer;
696  */
697 
698  Menu(int x, int y, int width);
699  Menu(int width);
700  // Menu(const Menu &);
701  Menu(const Menu &) = delete;
702  Menu(Menu &&);
703 
704  void addSelection(char c, const char *line);
705  void addSelection(char c, const char *line, updateFunction update);
706  void defaultSelection(int d);
707  void setRender(bool selected, renderFunction render);
708 
709  int choose(Door &door);
710  char which(int d);
711 
713  ANSIColor c4);
714 };
715 
716 class Screen {
717 private:
718  // bool hidden;
722  std::vector<std::unique_ptr<Panel>> panels;
723 
724 public:
725  Screen(void);
726  Screen(Screen &) = default;
727  void addPanel(std::unique_ptr<Panel> p);
728  /*
729 bool delPanel(std::shared_ptr<Panel> p);
730 
731 void hide(void);
732 void show(void);
733 */
734  bool update(Door &d);
735  void update(void);
736 
737  friend std::ostream &operator<<(std::ostream &os, const Screen &s);
738 };
739 
740 /*
741 screen - contains panels.
742  - default to 1,1 X 80,24
743  - refresh(style) could redraw panels by order they were added,
744  or could redraw panels from top to bottom, left to right.
745 
746 crazy ideas:
747  hide panels / z-order
748  how to handle panel on top of other panels?
749  Can I have you win + show animated final score calculations?
750 
751 panel - has X,Y and width, optional length. contains lines.
752  length could be simply number of "lines".
753  - has optional border. double/single/Ds/Sd TOPbottom
754  - has optional title.
755  - has optional footer.
756 
757  addLine()
758  append() - Appends another line to current line.
759 
760  set(X,Y) - set a "line" at a given X,Y position.
761 
762 menu - another type of panel, contains menu options/lines.
763 
764 lightmenu - like above, but allows arrow keys to select menu options.
765 
766 line - contains text.
767  (Maybe a "dirty" flag is needed here?)
768  - has optional (width)
769  - has optional (justify - L, R, Center)
770  - has optional padding (# of blank chars)
771  - has color (of text)
772  - has formatter/coloring function (to colorize the text)
773  Example would be one that sets capital letters to one color, lower to another.
774  Another example would be one that displays Score: XXX, where Score is one
775  color, : is another, and XXX is yet another. Properly padded, of course.
776  - has "lambda" function to update the value? (Maybe?)
777  Idea would be that I could update the score, and panel.update(). It would
778  call all the line.update() functions and only update anything that has
779  changed.
780 
781  Crazy ideas:
782  Can I delete a line, and have it automatically removed from a panel?
783 
784 lightline - text, changes format/coloring if focus/nofocus is set?
785 
786  */
787 
788 } // namespace door
789 #endif
door::Goto
ANSI Goto X, Y position.
Definition: door.h:418
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:186
door::Door::getkey_or_pushback
signed int getkey_or_pushback(void)
Definition: door.cpp:726
door::NewLine
CR+LF.
Definition: door.h:391
door::COLOR::BROWN
@ BROWN
BROWN (3)
door::Line::paddingColor
ANSIColor paddingColor
Padding color.
Definition: door.h:507
door::Door::username
std::string username
Definition: door.h:253
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:1192
door::ColorOutput::ColorOutput
ColorOutput()
Definition: door.cpp:1160
door::ANSIColor::Attr
ANSIColor & Attr(ATTR a)
Definition: ansicolor.cpp:112
door::Line::updater
updateFunction updater
updateFunction to use when updating.
Definition: door.h:512
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:614
door::Clrscr::Clrscr
Clrscr(void)
Definition: door.cpp:1235
door::ColorOutput::c
ANSIColor c
Color to use for this fragment.
Definition: door.h:292
door::Door::Door
Door(std::string dname, int argc, char *argv[])
Construct a new Door:: Door object.
Definition: door.cpp:229
door::ANSIColor::operator==
bool operator==(const ANSIColor &c) const
Definition: ansicolor.cpp:138
door::Door::cx
int cx
Definition: door.h:238
door::Door::doorname
std::string doorname
Definition: door.h:192
door::Goto::x
int x
X-Position.
Definition: door.h:420
door::Door::time_used
atomic< int > time_used
Definition: door.h:266
door::Render::append
void append(ANSIColor color, int len=1)
Definition: door.cpp:1207
door::Door::previous
ANSIColor previous
Definition: door.h:234
door::full_cp437
bool full_cp437
Was full CP437 detected?
Definition: door.cpp:214
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:135
door::cp437toUnicode
void cp437toUnicode(std::string input, std::string &out)
Convert from CP437 to unicode.
Definition: door.cpp:179
door::Door::node
int node
Definition: door.h:262
door::Door::sleep_key
signed int sleep_key(int secs)
Waits secs seconds for a keypress.
Definition: door.cpp:985
door::ANSIColor::inverse
unsigned int inverse
Definition: door.h:146
door::Render::outputs
std::vector< ColorOutput > outputs
Vector of ColorOutput object.
Definition: door.h:320
door::ATTR::BRIGHT
@ BRIGHT
BRIGHT is the same as BOLD.
door::Door::dropfilelines
vector< std::string > dropfilelines
Definition: door.h:206
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:1269
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:294
door::Goto::operator<<
friend std::ostream & operator<<(std::ostream &os, const Goto &g)
Definition: door.cpp:1320
door::COLOR
COLOR
The colors available under ANSI-BBS.
Definition: door.h:86
door::ANSIColor
Foreground, Background and Attributes.
Definition: door.h:133
door::Door::stop_thread
std::promise< void > stop_thread
Definition: door.h:211
door::Door::input_string
std::string input_string(int max)
Input a string of requested max length.
Definition: door.cpp:1034
door::Door::get_one_of
int get_one_of(const char *keys)
Get one of these keys.
Definition: door.cpp:1085
door::Menu
Definition: door.h:679
door::Door::location
std::string location
Definition: door.h:257
door::ANSIColor::getFg
COLOR getFg()
Definition: door.h:167
door::Door::tio_default
struct termios tio_default
Definition: door.h:197
door::Line::render
renderFunction render
renderFunction to use when rendering Line.
Definition: door.h:510
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:240
door::Door::dropfilename
std::string dropfilename
Definition: door.h:204
door::Goto::y
int y
Y-Position.
Definition: door.h:422
door::renderFunction
std::function< Render(const std::string &)> renderFunction
Render output function.
Definition: door.h:348
door::Door::logf
ofstream logf
Definition: door.h:208
door::BorderStyle::DOUBLE_SINGLE
@ DOUBLE_SINGLE
DOUBLE top SINGLE side (4)
door::Line::color
ANSIColor color
Line color.
Definition: door.h:503
door::Render::Render
Render(const std::string txt)
Definition: door.cpp:1181
door::ANSIColor::getBg
COLOR getBg()
Definition: door.h:172
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:144
door::cls
Clrscr cls
Definition: door.cpp:1263
door::Line::setPadding
void setPadding(std::string &padstring, ANSIColor padColor)
Definition: lines.cpp:256
door::ANSIColor::reset
unsigned int reset
Definition: door.h:140
door::Line
Text and ANSIColor.
Definition: door.h:495
door::Line::operator<<
friend std::ostream & operator<<(std::ostream &os, const Line &l)
Definition: lines.cpp:354
door::Render::text
const std::string text
Complete text to be rendered.
Definition: door.h:318
door::Door::opt
AnyOption opt
Definition: door.h:225
door::Clrscr::operator<<
friend std::ostream & operator<<(std::ostream &os, const Clrscr &clr)
Definition: door.cpp:1247
door::Door::time_thread
std::thread time_thread
Definition: door.h:217
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:925
door::BorderStyle::DOUBLE
@ DOUBLE
DOUBLE (2)
door::Panel::lines
std::vector< std::unique_ptr< Line > > lines
Definition: door.h:605
door::updateFunction
std::function< std::string(void)> updateFunction
Definition: door.h:367
door::nl
NewLine nl
Definition: door.cpp:1291
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:1354
door::Line::text
std::string text
Text of the line.
Definition: door.h:498
door::COLOR::YELLOW
@ YELLOW
YELLOW (3)
door::ATTR
ATTR
ANSI-BBS text attributes.
Definition: door.h:110
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:407
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:430
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:251
door::Door::track
bool track
Definition: door.h:236
door::Door::has_dropfile
bool has_dropfile
Definition: door.h:201
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:722
door::Door::height
int height
Definition: door.h:244
door::Line::padding
std::string padding
Padding characters.
Definition: door.h:505
door::BorderStyle::SINGLE
@ SINGLE
SINGLE (1)
door::SaveCursor
const char SaveCursor[]
ANSI Save Cursor position command.
Definition: door.cpp:1345
door::Door::handle
std::string handle
Definition: door.h:255
door::Door::xsputn
std::streamsize xsputn(const char *s, std::streamsize n) override
Definition: door.cpp:1113
door::BorderStyle
BorderStyle
Definition: door.h:577
door::unicode
bool unicode
Was unicode detected?
Definition: door.cpp:206
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:227
door::Door::overflow
int overflow(int c) override
Definition: door.cpp:1140
door::ColorOutput::len
int len
Length.
Definition: door.h:296
door::Justify
Justify
Definition: door.h:410
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:242
door::COLOR::BLUE
@ BLUE
BLUE (4)
door::pushback
std::list< char > pushback
pushback buffer for keys.
Definition: door.cpp:58
door::Clrscr
Clear the screen.
Definition: door.h:374
door::debug_capture
bool debug_capture
Capture the output for debugging.
Definition: door.cpp:220
door::ColorOutput::reset
void reset(void)
Definition: door.cpp:1168
door::ANSIColor::bg
COLOR bg
Definition: door.h:137
door::Screen
Definition: door.h:716
door::Door::getch
signed int getch(void)
low level read key.
Definition: door.cpp:671
door::Door::getkey
signed int getkey(void)
Get a key routine.
Definition: door.cpp:747
door::Goto::Goto
Goto(int xpos, int ypos)
Definition: door.cpp:1299
door::Door::haskey
bool haskey(void)
Are there any keys in STDIN?
Definition: door.cpp:629
door::Door::seconds_elapsed
int seconds_elapsed
Definition: door.h:214
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:1349
door::COLOR::BLACK
@ BLACK
BLACK (0)
door::Door::time_left
atomic< int > time_left
Definition: door.h:264
door::Render
Rendering a string with ANSIColor.
Definition: door.h:314
door::Line::hasColor
bool hasColor
Do we have color?
Definition: door.h:501
door::Door::sysop
std::string sysop
Definition: door.h:259
door::Panel
Definition: door.h:592
door::NewLine::operator<<
friend std::ostream & operator<<(std::ostream &os, const NewLine &nl)
Definition: door.cpp:1277
door::Line::setUpdater
void setUpdater(updateFunction uf)
Definition: lines.cpp:298
door::ColorOutput
This holds an ANSIColor and text position + length.
Definition: door.h:286
door::ANSIColor::bold
unsigned int bold
Definition: door.h:142
door::Line::setRender
void setRender(renderFunction rf)
Definition: lines.cpp:289