KnownState (State &state, const char* name);This constructor adds an entry to the state type list. For example,
static IntState proto;permits IntStates to be produced by cloning. The
static KnownState entry(proto,"INT");
type
argument must be in upper case, because of the way find
works (see below). The second type of constructor takes three arguments:
KnownState (State &state, const char* name, const char* value);This constructor permits names to be added to the global state symbol list, for use in state expressions. For example, we have
static FloatState pi;
KnownState k_pi(pi,"PI","3.14159265358979323846");
static const State* find (const char* type);The
find
method returns a pointer the appropriate prototype state in the state type list. The argument is always changed to upper case. A null pointer is returned if there is no match.
static const State* lookup (const char* name);The lookup method returns a pointer to the appropriate state in the global state list, or null if there is no match.
static State* clone (const char* type);The clone method takes a string, finds the appropriate state using
find,
and returns a clone of that block. A null pointer is returned if there is no match, and Error::error
is also called.
static StringList nameList();Return the names of all the known state types, separated by newlines.
static int nKnown();Return the number of known states.