casa
$Rev:20696$
|
Class to ask a user a choice. More...
#include <Choice.h>
Public Types | |
typedef String | ChoiceFunc (const String &descriptiveText, const Vector< String > &choices) |
Define the signature of the choice function. | |
Static Public Member Functions | |
static String | choice (const String &descriptiveText, const Vector< String > &choices) |
Get a choice from the user. | |
static ChoiceFunc * | setChoiceFunc (ChoiceFunc *func) |
Set the choice function. | |
static String | stderrChoice (const String &descriptiveText, const Vector< String > &choices) |
A choice function asking on stderr. | |
static String | stdoutChoice (const String &descriptiveText, const Vector< String > &choices) |
A choice function asking on stdout. | |
Static Private Member Functions | |
static String | ostreamChoice (std::ostream &, const String &descriptiveText, const Vector< String > &choices) |
Ask on an ostream. | |
Static Private Attributes | |
static ChoiceFunc * | theirChoiceFunc |
Class to ask a user a choice.
typedef String casa::Choice::ChoiceFunc(const String &descriptiveText, const Vector< String > &choices) |
static String casa::Choice::choice | ( | const String & | descriptiveText, |
const Vector< String > & | choices | ||
) | [static] |
Get a choice from the user.
The choice function to be used can be set using setChoiceFunc. It can, for instance, be done by ObjectController. Initially no choice function is set. In that case it returns the first choice (so that should be the default choice). If choices is zero length, an empty string is returned.
static String casa::Choice::ostreamChoice | ( | std::ostream & | , |
const String & | descriptiveText, | ||
const Vector< String > & | choices | ||
) | [static, private] |
Ask on an ostream.
Referenced by stderrChoice(), and stdoutChoice().
static ChoiceFunc* casa::Choice::setChoiceFunc | ( | ChoiceFunc * | func | ) | [static] |
Set the choice function.
It returns the old choice function.
static String casa::Choice::stderrChoice | ( | const String & | descriptiveText, |
const Vector< String > & | choices | ||
) | [inline, static] |
A choice function asking on stderr.
Definition at line 79 of file Choice.h.
References ostreamChoice().
static String casa::Choice::stdoutChoice | ( | const String & | descriptiveText, |
const Vector< String > & | choices | ||
) | [inline, static] |
A choice function asking on stdout.
It outputs the descriptiveText followed by a blank, the options (enclosed in parentheses) and a colon. The default option is shown in square brackets.
Definition at line 87 of file Choice.h.
References ostreamChoice().
ChoiceFunc* casa::Choice::theirChoiceFunc [static, private] |