|
FMI Ticket System
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 1 | Project Topic 4 |
|
Stores a wide range of functions for simpler/more automated printing. More...
#include <iostream>Go to the source code of this file.
Macros | |
| #define | MAX_LINE_WIDTH 1024 |
Functions | |
| void | clear () |
| Clears the console screen. More... | |
| void | titleBox (const char *title) |
| Prints a title box. More... | |
| void | subTitleBox (const char *title) |
| Prints a title sub box. More... | |
| void | successBox (const char *message) |
| Prints a success box. More... | |
| void | successSubBox (const char *message) |
| Prints a success box as a sub box. More... | |
| void | warningBox (const char *message) |
| Prints a warning box. More... | |
| void | warningSubBox (const char *message) |
| Prints a warning box as a sub box. More... | |
| void | errorBox (const char *message) |
| Prints an error box. More... | |
| void | errorSubBox (const char *message) |
| Prints an error box as a sub box. More... | |
| void | inputLineBox (const char *label, char *output, unsigned maxWidth, bool ignore=true) |
| Prints label, gets a whole line of input and stores it to output. More... | |
| void | inputLineSubBox (const char *label, char *output, unsigned maxWidth, bool ignore=true) |
| Prints label as a sub box, gets a whole line of input and stores it to output. More... | |
| void | pressEnterToContinue (bool ignore=true) |
| Waits for user to press enter. More... | |
| void | resetOrderedList (int starter=1) |
| Resets the ordered list starting number. More... | |
| void | table (unsigned startNumber, unsigned columns, const char *items) |
| Prints a string as a table. More... | |
| void | _printSubBoxSpacing () |
| Semi-internal function that prints the spacing for sub boxes. More... | |
| void | _printInputBoxLabel (const char *label) |
| Semi-internal function that prints the label of an input box. More... | |
| void | _printOrderedListBeginning () |
| Semi-internal function that prints the latest ordered list index. More... | |
| template<typename T > | |
| void | read (T *storage) |
| Reads user input and stores it. | |
| template<typename T > | |
| void | read (T &storage) |
| Reads user input and stores it. | |
| template<typename T > | |
| void | print (const T *item) |
| Prints given item. | |
| template<typename T > | |
| void | print (const T &item) |
| Prints given item. | |
| template<typename T > | |
| void | printLine (const T *item) |
| Prints given item and an endline character. | |
| template<typename T > | |
| void | printLine (const T &item) |
| Prints given item and an endline character. | |
| template<typename T > | |
| void | printOrderedListElem (const T &elem) |
| Prints the element as the latest list item. | |
| template<typename T > | |
| void | inputBox (const char *label, T *output) |
| Prints a label and then reads user input and stores it. | |
| template<typename T > | |
| void | inputSubBox (const char *label, T *output) |
Stores a wide range of functions for simpler/more automated printing.
Adds a lot of functions for printing.
| void _printInputBoxLabel | ( | const char * | label | ) |
Semi-internal function that prints the label of an input box.
| label | C-style string, there are no size checks so it could wrap |
Prints "(+)" and then the given label. It doesn't create spacing after label, so it should exist in the label itself.
| void _printOrderedListBeginning | ( | ) |
Semi-internal function that prints the latest ordered list index.
Prints the latests ordered list index, surrounded by square brackets, and increments the ordered list index.
| void _printSubBoxSpacing | ( | ) |
Semi-internal function that prints the spacing for sub boxes.
Sub boxes are like normal boxes, but indented with 4 spaces.
| void clear | ( | ) |
Clears the console screen.
Erases display and moves cursor to top left corner via ANSI escape sequences: ESC[2J ESC[1;1H
| void errorBox | ( | const char * | message | ) |
Prints an error box.
| message | C-style string, there are no size checks so it could wrap |
Error boxes start with "<E>" and print the message.
| void errorSubBox | ( | const char * | message | ) |
Prints an error box as a sub box.
| message | C-style string, there are no size checks so it could wrap |
Error boxes start with "<E>" and print the message.
| void inputLineBox | ( | const char * | label, |
| char * | output, | ||
| unsigned | maxWidth, | ||
| bool | ignore | ||
| ) |
Prints label, gets a whole line of input and stores it to output.
| label | C-style string, there are no size check so it could wrap |
| output | Pointer to a char array |
| maxWidth | Maximum count of characters to read from user input. output MUST be able to hold that many characters! |
| ignore | Whether or not to ignore the first new-line delimiter. true by default, should be set to false only when an inputLineBox/SubBox has been issued directly prior or when it's the very first issued box command. |
Prints "(+)" before the label.
| void inputLineSubBox | ( | const char * | label, |
| char * | output, | ||
| unsigned | maxWidth, | ||
| bool | ignore | ||
| ) |
Prints label as a sub box, gets a whole line of input and stores it to output.
| label | C-style string, there are no size check so it could wrap |
| output | Pointer to a char array |
| maxWidth | Maximum count of characters to read from user input. output MUST be able to hold that many characters! |
| ignore | Whether or not to ignore the first new-line delimiter. true by default, should be set to false only when an inputLineBox/SubBox has been issued directly prior or when it's the very first issued box command. |
Prints "(+)" before the label.
| void inputSubBox | ( | const char * | label, |
| T * | output | ||
| ) |
Prints a label with sub box spacing and then reads user input and stores it
| void pressEnterToContinue | ( | bool | ignore | ) |
Waits for user to press enter.
| ignore | Whether or not to ignore the first new-line delimiter. true by default, should be set to false only when an inputLineBox/SubBox has been issued directly prior or when it's the very first issued box command. |
Prints a "Press enter to continue" message and waits for the user
| void resetOrderedList | ( | int | starter | ) |
Resets the ordered list starting number.
| starter | Sets the starting number by which ordered list will enumerate |
| void subTitleBox | ( | const char * | title | ) |
Prints a title sub box.
| title | C-style string, there are no size checks so it could wrap |
Prints the title, surrounded by "---".
| void successBox | ( | const char * | message | ) |
Prints a success box.
| message | C-style string, there are no size checks so it could wrap |
Success boxes start with "<S>" and print the message.
| void successSubBox | ( | const char * | message | ) |
Prints a success box as a sub box.
| message | C-style string, there are no size checks so it could wrap |
Success boxes start with "<S>" and print the message.
| void table | ( | unsigned | startNumber, |
| unsigned | columns, | ||
| const char * | items | ||
| ) |
Prints a string as a table.
| startNumber | The number by which column and row enumeration begins |
| columns | How many columns the table should have |
| items | C-style string, each cell is a single character from the string |
Prints a string as a grid/table of characters from top to bottom, left to right. The first character is on the top left, the last one is on the bottom right.
Table is printed until a terminating zero is encountered. The rows are "calculated" from the columns count and the items length.
| void titleBox | ( | const char * | title | ) |
Prints a title box.
| title | C-style string, there are no size checks so it could wrap |
Prints the title, surrounded by "===".
| void warningBox | ( | const char * | message | ) |
Prints a warning box.
| message | C-style string, there are no size checks so it could wrap |
Warning boxes start with "<W>" and print the message.
| void warningSubBox | ( | const char * | message | ) |
Prints a warning box as a sub box.
| message | C-style string, there are no size checks so it could wrap |
Warning boxes start with "<W>" and print the message.