Programming Reference:Speller Class

From BCI2000 Wiki
Jump to: navigation, search

Location

src/shared/modules/application/speller

Synopsis

The Speller class provides an abstract interface for "Spellers". A "Speller" is an object that responds to an OnEnter event, and holds a set of SpellerTarget objects. Holding a set of SpellerTarget objects allows to suggest a "next target" based on a desired text output, and an existing text output.

A SpellerTarget is a Target that is linked to a Speller such that selecting the target results in entering text into the speller.

Speller Class

Methods

Enter(string)

Prompts the speller to react to the information provided in the argument string. The Speller class interface makes no assumption about the encoding used, i.e. it does not interpret the argument string in any way.

Add(SpellerTarget pointer)

Adds the specified SpellerTarget to the speller's set of targets.

Remove(SpellerTarget pointer)

Removes the specified SpellerTarget from the speller's set of targets.

DeleteObjects()

Deletes all SpellerTarget objects that are part of the speller's set of targets.

SpellerTarget pointer SuggestTarget(string from, string to)

Returns a pointer to a target from the speller object's set of targets. The suggested target is chosen such that it minimizes the string distance between the modified "from" argument to the "to" argument after application of the target's entry text. This is a virtual function, and should be overridden by spellers that use encoded commands in targets' entry texts.

Events

OnEnter(string)

In its OnEnter event handler, a Speller descendant should perform actions that correspond to entering the text given as an argument.

SpellerTarget Class

Methods

SpellerTarget(Speller)

When constructing a speller target, specify the Speller object it is associated with. The SpellerTarget object will add itself to the Speller object's set of targets, and may be deleted using Speller::DeleteObjects() when appropriate.

Select()

Will enter the text contained in the EntryText property into the speller specified when creating the object.

Properties

string EntryText (rw)

The text entered into the speller object when the target is selected.

See also

Programming Reference:Target Class, Programming Reference:SpellerCommand Class