The SKIRT project
advanced radiative transfer for astrophysics
Console Class Referencefinal

#include <Console.hpp>

Static Public Member Functions

static void error (string message)
static void info (string message)
static bool promptForBool (string message, bool hasDef, bool def)
static int promptForChoice (string message, const vector< string > &choices, bool hasDef=false, int defIndex=-1, bool allowNoChoice=false, string noChoiceMessage=string())
static int promptForInt (string message, int min, int max, bool hasDef, int def)
static string promptForString (string message, bool hasDef, string def)
static void success (string message)
static void warning (string message)

Detailed Description

The Console class offers facilities for interacting with the user through the console on a higher level than the basic functions in the System class. There is a seperate function to log a message at each log level, and there are functions to prompt for various data types, including a choice from a list, with proper validation.

Member Function Documentation

◆ error()

void Console::error ( string message)
static

Logs an informational message (i.e. at level Error).

◆ info()

void Console::info ( string message)
static

Logs an informational message (i.e. at level Info).

◆ promptForBool()

bool Console::promptForBool ( string message,
bool hasDef,
bool def )
static

Prompts the console for a yes/no reply within the specified default value, and returns the user's response.

◆ promptForChoice()

int Console::promptForChoice ( string message,
const vector< string > & choices,
bool hasDef = false,
int defIndex = -1,
bool allowNoChoice = false,
string noChoiceMessage = string() )
static

Prompts the console for a choice from the specified list, with the specified default, and returns the user's response. The function returns a zero-based index into the choices list. If allowNoChoice is true, the function returns -1 to indicate that no choice was made.

◆ promptForInt()

int Console::promptForInt ( string message,
int min,
int max,
bool hasDef,
int def )
static

Prompts the console for an integer number within the specified range and with the specified default value, and returns the user's response.

◆ promptForString()

string Console::promptForString ( string message,
bool hasDef,
string def )
static

Prompts the console for a non-empty string with the specified default value, and returns the user's response.

◆ success()

void Console::success ( string message)
static

Logs an informational message (i.e. at level Success).

◆ warning()

void Console::warning ( string message)
static

Logs a warning message (i.e. at level Warning).


The documentation for this class was generated from the following file: