19 : _playing(false), _recording(false), _looping(true), _echo(false), _help(false)
74 _recording = recording;
84 if (userChoice.empty()) {
85 const std::string errMsg =
"User choice cannot be empty";
108 if (userChoice ==
"l" || userChoice ==
"q" || userChoice ==
"esc") {
116 }
else if (userChoice ==
"e") {
123 }
else if (userChoice ==
"h") {
125 }
else if (userChoice ==
"hu") {
131 }
else if (userChoice ==
"i") {
225 _playing = !_playing;
233 _looping = !_looping;
241 _recording = !_recording;
297void Controls::UserControls::_displayHelp()
const
316const std::string Controls::UserControls::_gatherResponse()
const
318 std::string response;
320 while (std::cin.get(c)) {
343const std::string Controls::UserControls::_getUserChoice()
const
347 choice = _gatherResponse();
356 while (_looping ==
true) {
358 std::string resp = _getUserChoice();
362 COLOUR_INFO <<
"User choice: '" << resp <<
"'" << std::endl;
367 catch (
const std::exception &e) {
384 std::string indentation =
"";
385 for (
unsigned int i = 0; i < indent; ++i) {
388 std::string result = indentation +
"User Controls:\n";
#define PRETTY_DEBUG
Debug log with details and colour.
#define COLOUR_INFO
Info log with colour.
#define COLOUR_ERROR
Error log with colour.
#define BACKGROUND_COL
Empty colour codes for unsupported platforms.
This file contains the definition of the UserControls class, which manages user input and control sta...
Manages user input and control states.
void spamUserChoice()
Continuously prompts the user for input and processes it.
const bool getEcho() const
Gets the echo state.
void togglePlaying()
Toggles the playing state.
void setUserChoice(const std::string &userChoice)
Processes the user choice.
const bool getRecording() const
Gets the recording state.
const bool isRecording() const
Checks if recording is enabled.
const bool isPlaying() const
Checks if playing is enabled.
void setRecording(const bool recording)
Sets the recording state.
void toggleLooping()
Toggles the looping state.
const bool getHelp() const
Gets the help state.
void setHelp(const bool help)
Sets the help state.
void setPlaying(const bool playing)
Sets the playing state.
const bool getLooping() const
Gets the looping state.
void setLooping(const bool looping)
Sets the looping state.
const bool hangUpTheCall() const
Checks if the call should be hung up.
void toggleHelp()
Toggles the help state.
const bool isHelp() const
Checks if help is enabled.
const bool getPlaying() const
Gets the playing state.
void setEcho(const bool echo)
Sets the echo state.
void toggleRecording()
Toggles the recording state.
const bool isEcho() const
Checks if echo is enabled.
void toggleEcho()
Toggles the echo state.
const bool isLooping() const
Checks if looping is enabled.
void showPrompt() const
Displays the prompt to the user.
const std::string getInfo(const unsigned int indent=0) const
Dumps the current state of the variables for debugging purposes.
Exception class for invalid operations.
void setLogEnabled(bool enabled)
Enables or disables logging.
static Log & getInstance(const bool debug=false)
Provides access to the singleton instance of the Log class.
const bool getLogEnabled() const
Checks if logging is enabled.
std::ostream & operator<<(std::ostream &os, const ThreadCapsule &network)
Overloads the stream insertion operator for ThreadCapsule.
const std::string myToString(bool value)
Converts a boolean value to its string representation.