casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
casacore::Choice Class Reference

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. More...
 

Static Public Member Functions

static String choice (const String &descriptiveText, const Vector< String > &choices)
 Get a choice from the user. More...
 
static ChoiceFuncsetChoiceFunc (ChoiceFunc *func)
 Set the choice function. More...
 
static String stderrChoice (const String &descriptiveText, const Vector< String > &choices)
 A choice function asking on stderr. More...
 
static String stdoutChoice (const String &descriptiveText, const Vector< String > &choices)
 A choice function asking on stdout. More...
 

Static Private Member Functions

static String ostreamChoice (std::ostream &, const String &descriptiveText, const Vector< String > &choices)
 Ask on an ostream. More...
 

Static Private Attributes

static ChoiceFunctheirChoiceFunc
 

Detailed Description

Class to ask a user a choice.

Review Status

Date Reviewed:
yyyy/mm/dd

Etymology

Synopsis

Definition at line 59 of file Choice.h.

Member Typedef Documentation

typedef String casacore::Choice::ChoiceFunc(const String &descriptiveText, const Vector< String > &choices)

Define the signature of the choice function.

Definition at line 63 of file Choice.h.

Member Function Documentation

static String casacore::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 casacore::Choice::ostreamChoice ( std::ostream &  ,
const String descriptiveText,
const Vector< String > &  choices 
)
staticprivate

Ask on an ostream.

Referenced by stderrChoice(), and stdoutChoice().

static ChoiceFunc* casacore::Choice::setChoiceFunc ( ChoiceFunc func)
static

Set the choice function.

It returns the old choice function.

static String casacore::Choice::stderrChoice ( const String descriptiveText,
const Vector< String > &  choices 
)
inlinestatic

A choice function asking on stderr.

Definition at line 80 of file Choice.h.

References ostreamChoice().

static String casacore::Choice::stdoutChoice ( const String descriptiveText,
const Vector< String > &  choices 
)
inlinestatic

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 88 of file Choice.h.

References ostreamChoice().

Member Data Documentation

ChoiceFunc* casacore::Choice::theirChoiceFunc
staticprivate

Definition at line 100 of file Choice.h.


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