|
Study Dungeon
1.0.0
A group project for COSC345
|
Utilities and helpers for the program. More...
#include "util.h"Functions | |
| bool | enableVirtualTerminal () |
| enables the virtual terminal processing mode More... | |
| std::filesystem::path | getAppPath () |
| bool | timeComplete (const std::chrono::time_point< std::chrono::steady_clock > &start_time, const int &duration_secs) |
| Determines if the number of seconds has elapased since a start time. More... | |
| int | timeRemainingMins (const std::chrono::time_point< std::chrono::steady_clock > &start_time, const int &duration_mins) |
| Used to display the time remaining to users. To determine the actual end the session use timeComplete() More... | |
| std::string | steadyClockToString (const std::chrono::steady_clock::time_point &start_time) |
| Gives the number of seconds past since the time point as "X seconds since start". More... | |
| void | pause () |
| An alternative to system('pause') More... | |
| void | clearScreen () |
| Clears the screen. More... | |
| bool | yesNoPrompt () |
| Prompts the user to enter [Yy] for yes and [Nn] for no. More... | |
| bool | isValidDeckFileName (const std::string &name) |
| Checks if name for deckfile meets naming requirements. More... | |
| void | ShowConsoleCursor (bool showFlag) |
| hides or shows the cursor icon in the console | |
| std::vector< std::vector< int > > | readInANSICodes (std::string filename) |
| reads a file of integers (0-255) that will be used to create ANSI colours More... | |
| std::vector< std::string > | convertAsciiArtToLines (const std::string &asciiArt) |
| Vectorises a string on the newline character. More... | |
| std::string | getFirstPhrase (const std::vector< std::pair< std::string, int >> &phrases) |
| std::string | getRandomPositiveQuote () |
| Get a Random Positive Quote. More... | |
| std::string | getRandomEncouragingQuote () |
| Get a Random Encouraging Quote. More... | |
| std::string | getRandomPhrase () |
| Get a Random Phrase. More... | |
Variables | |
| bool | isTestMode = false |
Utilities and helpers for the program.
| void clearScreen | ( | ) |
Clears the screen.
Credit: SirEnder125 on cplusplus.com
| std::vector<std::string> convertAsciiArtToLines | ( | const std::string & | asciiArt | ) |
Vectorises a string on the newline character.
| asciiArt | String of an ASCII artwork to be vectorised |
| bool enableVirtualTerminal | ( | ) |
enables the virtual terminal processing mode
sets the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag so that virtual terminal sequences will be interpreted by the console to display colour and formatting
| std::string getRandomEncouragingQuote | ( | ) |
Get a Random Encouraging Quote.
| std::string getRandomPhrase | ( | ) |
Get a Random Phrase.
| std::string getRandomPositiveQuote | ( | ) |
Get a Random Positive Quote.
| bool isValidDeckFileName | ( | const std::string & | name | ) |
Checks if name for deckfile meets naming requirements.
Deck filenames should only contain [A-Za-z0-9] characters
| name |
| void pause | ( | ) |
An alternative to system('pause')
implementation based on from https://thelinuxcode.com/system-pause-c/
| std::vector<std::vector<int> > readInANSICodes | ( | std::string | filename | ) |
reads a file of integers (0-255) that will be used to create ANSI colours
| filename | the file containing whitespace separated integers representing ANSI colours |
| std::string steadyClockToString | ( | const std::chrono::steady_clock::time_point & | start_time | ) |
Gives the number of seconds past since the time point as "X seconds since start".
| start_time | a timepoint to turn into a string |
| bool timeComplete | ( | const std::chrono::time_point< std::chrono::steady_clock > & | start_time, |
| const int & | duration_secs | ||
| ) |
Determines if the number of seconds has elapased since a start time.
| start_time | the time to count number of seconds from |
| duration_secs | time period to check has elapsed |
| int timeRemainingMins | ( | const std::chrono::time_point< std::chrono::steady_clock > & | start_time, |
| const int & | duration_mins | ||
| ) |
Used to display the time remaining to users. To determine the actual end the session use timeComplete()
| start_time | The time the timer started |
| duration_mins | the period in minutes to check how much from the start time is remaining |
| bool yesNoPrompt | ( | ) |
Prompts the user to enter [Yy] for yes and [Nn] for no.
| bool isTestMode = false |
used to toggle between simulated input (true) and user input (false)