From 24bdf39e6c21ab846f6c86803761d78a094e05c0 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 26 May 2022 20:31:26 +0300 Subject: Added files from project 1 (mirror) --- .../Project 1/docs/html/Toolbox_8hpp.html | 750 +++++++++++++++++++++ 1 file changed, 750 insertions(+) create mode 100644 Year 1/Object-oriented Programming/Project 1/docs/html/Toolbox_8hpp.html (limited to 'Year 1/Object-oriented Programming/Project 1/docs/html/Toolbox_8hpp.html') diff --git a/Year 1/Object-oriented Programming/Project 1/docs/html/Toolbox_8hpp.html b/Year 1/Object-oriented Programming/Project 1/docs/html/Toolbox_8hpp.html new file mode 100644 index 0000000..3c48890 --- /dev/null +++ b/Year 1/Object-oriented Programming/Project 1/docs/html/Toolbox_8hpp.html @@ -0,0 +1,750 @@ + + + + + + + +FMI Ticket System: src/Generic/ConsoleInterface/Toolbox.hpp File Reference + + + + + + + + + +
+
+ + + + + + +
+
FMI Ticket System +
+
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 1 | Project Topic 4 |
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+ +
Toolbox.hpp File Reference
+
+
+ +

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)
 
+

Detailed Description

+

Stores a wide range of functions for simpler/more automated printing.

+

Adds a lot of functions for printing.

+
Remarks
iostream is included by necessity (templated functions), you should only use the provided functions, if you can.
+

Function Documentation

+ +

◆ _printInputBoxLabel()

+ +
+
+ + + + + + + + +
void _printInputBoxLabel (const char * label)
+
+ +

Semi-internal function that prints the label of an input box.

+
Parameters
+ + +
labelC-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.

+
Remarks
Semi-internal means the function is defined in the header out of necessity (for templated functions)
+ +
+
+ +

◆ _printOrderedListBeginning()

+ +
+
+ + + + + + + +
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.

+
Remarks
There are no size checks, so list index could overflow.
+
+Semi-internal means the function is defined in the header out of necessity (for templated functions)
+ +
+
+ +

◆ _printSubBoxSpacing()

+ +
+
+ + + + + + + +
void _printSubBoxSpacing ()
+
+ +

Semi-internal function that prints the spacing for sub boxes.

+

Sub boxes are like normal boxes, but indented with 4 spaces.

+ +
+
+ +

◆ clear()

+ +
+
+ + + + + + + +
void clear ()
+
+ +

Clears the console screen.

+

Erases display and moves cursor to top left corner via ANSI escape sequences: ESC[2J ESC[1;1H

+
Warning
Not all terminals support any or all ANSI escape sequences
+
Note
Source: https://stackoverflow.com/a/52895729/12036073
+ +
+
+ +

◆ errorBox()

+ +
+
+ + + + + + + + +
void errorBox (const char * message)
+
+ +

Prints an error box.

+
Parameters
+ + +
messageC-style string, there are no size checks so it could wrap
+
+
+

Error boxes start with "<E>" and print the message.

+
Remarks
Success/Warning/Error boxes start with "<C>" where C is an appropriate character.
+ +
+
+ +

◆ errorSubBox()

+ +
+
+ + + + + + + + +
void errorSubBox (const char * message)
+
+ +

Prints an error box as a sub box.

+
Parameters
+ + +
messageC-style string, there are no size checks so it could wrap
+
+
+

Error boxes start with "<E>" and print the message.

+
Remarks
Success/Warning/Error boxes start with "<C>" where C is an appropriate character.
+
See also
_printSubBoxSpacing()
+ +
+
+ +

◆ inputLineBox()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void inputLineBox (const char * label,
char * output,
unsigned maxWidth,
bool ignore 
)
+
+ +

Prints label, gets a whole line of input and stores it to output.

+
Parameters
+ + + + + +
labelC-style string, there are no size check so it could wrap
outputPointer to a char array
maxWidthMaximum count of characters to read from user input. output MUST be able to hold that many characters!
ignoreWhether 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.

+ +
+
+ +

◆ inputLineSubBox()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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.

+
Parameters
+ + + + + +
labelC-style string, there are no size check so it could wrap
outputPointer to a char array
maxWidthMaximum count of characters to read from user input. output MUST be able to hold that many characters!
ignoreWhether 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.

See also
_printSubBoxSpacing()
+ +
+
+ +

◆ inputSubBox()

+ +
+
+
+template<typename T >
+ + + + + + + + + + + + + + + + + + +
void inputSubBox (const char * label,
T * output 
)
+
+

Prints a label with sub box spacing and then reads user input and stores it

See also
_printSubBoxSpacing()
+ +
+
+ +

◆ pressEnterToContinue()

+ +
+
+ + + + + + + + +
void pressEnterToContinue (bool ignore)
+
+ +

Waits for user to press enter.

+
Parameters
+ + +
ignoreWhether 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

+ +
+
+ +

◆ resetOrderedList()

+ +
+
+ + + + + + + + +
void resetOrderedList (int starter)
+
+ +

Resets the ordered list starting number.

+
Parameters
+ + +
starterSets the starting number by which ordered list will enumerate
+
+
+
Remarks
Although starter can be a negative number, ordered list will always increment up the number.
+ +
+
+ +

◆ subTitleBox()

+ +
+
+ + + + + + + + +
void subTitleBox (const char * title)
+
+ +

Prints a title sub box.

+
Parameters
+ + +
titleC-style string, there are no size checks so it could wrap
+
+
+

Prints the title, surrounded by "---".

+ +
+
+ +

◆ successBox()

+ +
+
+ + + + + + + + +
void successBox (const char * message)
+
+ +

Prints a success box.

+
Parameters
+ + +
messageC-style string, there are no size checks so it could wrap
+
+
+

Success boxes start with "<S>" and print the message.

+
Remarks
Success/Warning/Error boxes start with "<C>" where C is an appropriate character.
+ +
+
+ +

◆ successSubBox()

+ +
+
+ + + + + + + + +
void successSubBox (const char * message)
+
+ +

Prints a success box as a sub box.

+
Parameters
+ + +
messageC-style string, there are no size checks so it could wrap
+
+
+

Success boxes start with "<S>" and print the message.

+
Remarks
Success/Warning/Error boxes start with "<C>" where C is an appropriate character.
+
See also
_printSubBoxSpacing()
+ +
+
+ +

◆ table()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void table (unsigned startNumber,
unsigned columns,
const char * items 
)
+
+ +

Prints a string as a table.

+
Parameters
+ + + + +
startNumberThe number by which column and row enumeration begins
columnsHow many columns the table should have
itemsC-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.

+ +
+
+ +

◆ titleBox()

+ +
+
+ + + + + + + + +
void titleBox (const char * title)
+
+ +

Prints a title box.

+
Parameters
+ + +
titleC-style string, there are no size checks so it could wrap
+
+
+

Prints the title, surrounded by "===".

+ +
+
+ +

◆ warningBox()

+ +
+
+ + + + + + + + +
void warningBox (const char * message)
+
+ +

Prints a warning box.

+
Parameters
+ + +
messageC-style string, there are no size checks so it could wrap
+
+
+

Warning boxes start with "<W>" and print the message.

+
Remarks
Success/Warning/Error boxes start with "<C>" where C is an appropriate character.
+ +
+
+ +

◆ warningSubBox()

+ +
+
+ + + + + + + + +
void warningSubBox (const char * message)
+
+ +

Prints a warning box as a sub box.

+
Parameters
+ + +
messageC-style string, there are no size checks so it could wrap
+
+
+

Warning boxes start with "<W>" and print the message.

+
Remarks
Success/Warning/Error boxes start with "<C>" where C is an appropriate character.
+
See also
_printSubBoxSpacing()
+ +
+
+
+ + + + -- cgit v1.3.1-23-gd82d