Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ONE::gui::PlainTextModel< Traits > Class Template Reference

Inheritance diagram for ONE::gui::PlainTextModel< Traits >:

Inheritance graph
[legend]
List of all members.

Detailed Description

template<class Traits = AcceptAll>
class ONE::gui::PlainTextModel< Traits >

TextModel implementation that handles a plain text string

The Traits template argument may be used to modify the inserted string. That class must have a legalize function that converts the input string into an accepted one.

Parameters:
Traits the text acceptance policy. The default is AcceptAll which accepts any input passed to it.
Author:
Daniel Seibert


Public Types

typedef std::string::size_type index
typedef TextModelListenerLPtr

Public Member Functions

void addTextModelListener (const LPtr &l)
 EventDispatcher ()
void fireEvent (TextModelEvent &e) const
 notifies all registered listeners
virtual std::string getText (const index &from=0, const index &to=std::string::npos) const =0
 retrieves the stored data from from, inclusively to to, exclusively
std::string getText (const index &, const index &) const
virtual std::string insert (const std::string &s, const index &pos)=0
 inserts the given text into the model
std::string insert (const std::string &, const index &)
bool isMuted () const
 reflects this dispatcher's muted state.
virtual void remove (const index &from, const index &to)=0
 removes the content from from, inclusively to to, exclusively
void remove (const index &, const index &)
void removeTextModelListener (const LPtr &l)
void setMuted (bool mute)
 mutes or un-mutes the dispatcher

Protected Member Functions

void add (const LPtr &l)
 registers a listener
void remove (const LPtr &l)
 de-registers a listener.


Member Typedef Documentation

typedef std::string::size_type ONE::gui::TextModel::index [inherited]
 

typedef TextModelListener * ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::LPtr [inherited]
 


Member Function Documentation

void ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::add const LPtr l  )  [protected, inherited]
 

registers a listener

Parameters:
l a listener

void ONE::gui::TextModelDispatcher::addTextModelListener const LPtr l  )  [inline, inherited]
 

ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::EventDispatcher  )  [inherited]
 

void ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::fireEvent TextModelEvent &  e  )  const [inherited]
 

notifies all registered listeners

The listeners are called in the order in which they were added.
This function is provided primarily for use by subclasses. However, it may also be called from the outside in order to inject events into the system. Note that great care should be taken when doing so. For example, listeners generally rely on the event's source being identical to the instance that passes them around, i.e. this event dispatcher.

Parameters:
e the event to forward to each listener

virtual std::string ONE::gui::TextModel::getText const index from = 0,
const index to = std::string::npos
const [pure virtual, inherited]
 

retrieves the stored data from from, inclusively to to, exclusively

If called without parameters, this function returns the complete text.

Parameters:
from the index of the first character returned
to the index one past the last character returned
Returns:
the stored data between from and to

template<class Traits>
std::string ONE::gui::PlainTextModel< Traits >::getText const index ,
const index
const [inline]
 

virtual std::string ONE::gui::TextModel::insert const std::string &  s,
const index pos
[pure virtual, inherited]
 

inserts the given text into the model

Implementations may reject, modify or simply insert s into the existing data.

Parameters:
s new data
pos the insertion position
Returns:
the data that was actually inserted

template<class Traits>
std::string ONE::gui::PlainTextModel< Traits >::insert const std::string &  ,
const index
 

bool ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::isMuted  )  const [inherited]
 

reflects this dispatcher's muted state.

Returns:
true if the dispatcher is muted, false otherwise

void ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::remove const LPtr l  )  [protected, inherited]
 

de-registers a listener.

This listener will no longer notify l of events, unless l is registered more than once. If so, a call to this function will only remove the first occurence of l.

Parameters:
l a listener

virtual void ONE::gui::TextModel::remove const index from,
const index to
[pure virtual, inherited]
 

removes the content from from, inclusively to to, exclusively

template<class Traits>
void ONE::gui::PlainTextModel< Traits >::remove const index ,
const index
 

void ONE::gui::TextModelDispatcher::removeTextModelListener const LPtr l  )  [inline, inherited]
 

void ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::setMuted bool  mute  )  [inherited]
 

mutes or un-mutes the dispatcher

Muted dispatchers no longer notify their listeners.


Generated on Wed Sep 7 19:03:19 2005 for ONEngine by  doxygen 1.4.3