Choice.h

Classes

Choice -- (full description)

class Choice

Interface

Public Members
typedef String ChoiceFunc (const String& descriptiveText, const String<String>& choices)
static String choice (const String& descriptiveText, const Vector<String>& choices)
static ChoiceFunc* setChoiceFunc (ChoiceFunc* func)
static String stderrChoice (const String& descriptiveText, const Vector<String>& choices)
static String stdoutChoice (const String& descriptiveText, const Vector<String>& choices)
Private Members
static String ostreamChoice (std::ostream&, const String& descriptiveText, const ostream<String>& choices)

Description

Member Description

typedef String ChoiceFunc (const String& descriptiveText, const String<String>& choices)

Define the signature of the choice function.

static String choice (const String& descriptiveText, const Vector<String>& choices)

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 ChoiceFunc* setChoiceFunc (ChoiceFunc* func)

Set the choice function. It returns the old 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. It outputs the descriptiveText followed by a blank, the options (enclosed in parentheses) and a colon. The default option is shown in square brackets.

static String ostreamChoice (std::ostream&, const String& descriptiveText, const ostream<String>& choices)

Ask on an ostream.