Om
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Om::Language::Lexicon Class Reference

The Lexicon Program implementation. More...

#include "lexicon.hpp"

+ Inheritance diagram for Om::Language::Lexicon:
+ Collaboration diagram for Om::Language::Lexicon:

Classes

class  ElementRange
 A Lexicon Element range. More...
 

Public Member Functions

 Lexicon ()
 
 Lexicon (Lexicon const &)
 
Lexiconoperator= (Lexicon)
 
void BackGivePair (Consumer &)
 
virtual void Clear ()
 
Pair const & Find (Operator const &) const
 
void FrontGivePair (Consumer &)
 
virtual std::auto_ptr< Om::Source::Source< Element const > > GetElementRange () const
 
virtual void GiveElements (Consumer &)
 Gives each contained Element to the argument. More...
 
virtual void GiveElements (Consumer &) const
 
virtual bool IsEmpty () const
 
virtual void ParseElements (Reader &)
 
virtual void ParseQuotedElements (Reader &)
 
void Swap (Lexicon &)
 
template<typename TheOperand >
void TakeOperand (TheOperand &)
 
template<typename TheOperator >
void TakeOperator (TheOperator &)
 
template<typename TheProducer >
void TakeQuotedProducer (TheProducer &)
 
template<typename TheSeparator >
void TakeSeparator (TheSeparator &)
 
virtual bool Translate (Evaluation &, Operator const &) const
 Translates the Operator to an object that is then given to the Evaluation. More...
 
- Public Member Functions inherited from Om::Language::DefaultProgram< Lexicon >
virtual ~DefaultProgram ()=0
 
virtual bool Equals (Program const &) const
 
virtual void TakeElements (Producer &)
 
virtual void TakeElements (Producer const &)
 
- Public Member Functions inherited from Om::Language::DefaultConsumer< Lexicon, DefaultGiveable< Lexicon, Om::Language::Program > >
virtual ~DefaultConsumer ()=0
 
virtual void TakeElement (Operand &)
 
virtual void TakeElement (Operand const &)
 
virtual void TakeElement (Operator &)
 
virtual void TakeElement (Operator const &)
 
virtual void TakeElement (Separator &)
 
virtual void TakeElement (Separator const &)
 
virtual void TakeQuotedElements (Producer &)
 
virtual void TakeQuotedElements (Producer const &)
 
- Public Member Functions inherited from Om::DefaultGiveable< Lexicon, Om::Language::Program >
virtual ~DefaultGiveable ()=0
 
- Public Member Functions inherited from Om::DefaultMoveable< Lexicon, DefaultCopyable< Lexicon, Om::Language::Program > >
virtual std::auto_ptr< MoveableMove ()
 
virtual ~DefaultMoveable ()=0
 
- Public Member Functions inherited from Om::DefaultCopyable< Lexicon, Om::Language::Program >
virtual std::auto_ptr< CopyableCopy () const
 
virtual ~DefaultCopyable ()=0
 
- Public Member Functions inherited from Om::Language::Program
virtual ~Program ()=0
 
virtual std::auto_ptr< ProgramGiveProgram ()
 Returns a new Program populated with the contents of this. More...
 
virtual std::auto_ptr< ProgramGiveProgram () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
- Public Member Functions inherited from Om::Language::Consumer
virtual ~Consumer ()=0
 
template<typename TheOperator , typename TheSeparator >
void Parse (Reader &)
 
void TakeElement (Null &)
 Takes a Null Element, which is disregarded. More...
 
void TakeElement (Null const &)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
- Public Member Functions inherited from Om::Giveable
virtual ~Giveable ()=0
 
- Public Member Functions inherited from Om::Copyable
virtual ~Copyable ()=0
 
- Public Member Functions inherited from Om::Moveable
virtual ~Moveable ()=0
 
- Public Member Functions inherited from Om::Language::Producer
virtual ~Producer ()=0
 
- Public Member Functions inherited from Om::Shareable<>
virtual ~Shareable ()=0
 
size_t GetOwnerCount () const
 
- Public Member Functions inherited from Om::Taker< Lexicon >
virtual ~Taker ()=0
 
void Take (Lexicon &)
 Swaps. More...
 
void Take (Lexicon const &)
 Assigns. More...
 
- Public Member Functions inherited from Om::Language::Translator
void Evaluate (Om::Source::Source< CodePoint const > &, Om::Sink::Sink< CodePoint const > &) const
 Evaluates input from the CodePoint Source and pushes it to the CodePoint Sink. More...
 
std::string Evaluate (char const theCodeUnitIterator[]) const
 A convenience overload that evaluates input from the string and returns the output string. More...
 

Static Public Member Functions

static char const * GetName ()
 

Private Types

typedef List< PairPairList
 
typedef boost::ptr_map< std::string, PairList::Node > Map
 

Private Member Functions

PairList::Node & GetOperandTaker ()
 Ensures that there is a last Node with an empty Operand, and with any Operator, and returns a reference to it. More...
 
template<typename TheOperator >
PairList::Node & GetOperandTaker (TheOperator &)
 Ensures that there is a last Node with an empty Operand, and the given Operator, and returns a reference to it. More...
 
void GivePair (PairList::NodeIndex const, Consumer &)
 

Static Private Member Functions

template<typename TheNode >
static void GiveElements (TheNode *theFirstNode, Consumer &theConsumer)
 Gives each Element in the Lexicon. More...
 

Private Attributes

Map thisMap
 
PairList thisPairList
 

Additional Inherited Members

- Protected Member Functions inherited from Om::Shareable<>
 Shareable ()
 
 Shareable (Shareable const &)
 
Shareableoperator= (Shareable const &)
 

Detailed Description

Definition at line 65 of file lexicon.hpp.

Member Typedef Documentation

◆ PairList

Definition at line 130 of file lexicon.hpp.

◆ Map

typedef boost::ptr_map< std::string, PairList::Node > Om::Language::Lexicon::Map
private

Definition at line 135 of file lexicon.hpp.

Constructor & Destructor Documentation

◆ Lexicon() [1/2]

Om::Language::Lexicon::Lexicon ( )

◆ Lexicon() [2/2]

Om::Language::Lexicon::Lexicon ( Lexicon const &  )

Member Function Documentation

◆ GetName()

static char const* Om::Language::Lexicon::GetName ( )
static

◆ operator=()

Lexicon& Om::Language::Lexicon::operator= ( Lexicon  )

◆ BackGivePair()

void Om::Language::Lexicon::BackGivePair ( Consumer )

◆ Clear()

virtual void Om::Language::Lexicon::Clear ( )
virtual

Implements Om::Language::Program.

◆ Find()

Pair const& Om::Language::Lexicon::Find ( Operator const &  ) const
Returns
The Pair containing to the Operator, or empty if none.

◆ FrontGivePair()

void Om::Language::Lexicon::FrontGivePair ( Consumer )

◆ GetElementRange()

virtual std::auto_ptr< Om::Source::Source<Element const> > Om::Language::Lexicon::GetElementRange ( ) const
virtual
Returns
A non-null owner pointer to a new Element range.

Implements Om::Language::Program.

◆ GiveElements() [1/3]

virtual void Om::Language::Lexicon::GiveElements ( Consumer )
virtual
Postcondition
IsEmpty() == true
Remarks
Giving every Element is more efficient than giving a subset and managing incremental state, which is never necessary.

Implements Om::Language::Producer.

◆ GiveElements() [2/3]

virtual void Om::Language::Lexicon::GiveElements ( Consumer ) const
virtual

◆ IsEmpty()

virtual bool Om::Language::Lexicon::IsEmpty ( ) const
virtual

◆ ParseElements()

virtual void Om::Language::Lexicon::ParseElements ( Reader )
virtual

◆ ParseQuotedElements()

virtual void Om::Language::Lexicon::ParseQuotedElements ( Reader )
virtual

◆ Swap()

void Om::Language::Lexicon::Swap ( Lexicon )

◆ TakeOperand()

template<typename TheOperand >
void Om::Language::Lexicon::TakeOperand ( TheOperand &  )

◆ TakeOperator()

template<typename TheOperator >
void Om::Language::Lexicon::TakeOperator ( TheOperator &  )

◆ TakeQuotedProducer()

template<typename TheProducer >
void Om::Language::Lexicon::TakeQuotedProducer ( TheProducer &  )

◆ TakeSeparator()

template<typename TheSeparator >
void Om::Language::Lexicon::TakeSeparator ( TheSeparator &  )

◆ Translate()

virtual bool Om::Language::Lexicon::Translate ( Evaluation ,
Operator const &   
) const
virtual
Returns
True if the Operator was found.

Implements Om::Language::Translator.

◆ GiveElements() [3/3]

template<typename TheNode >
static void Om::Language::Lexicon::GiveElements ( TheNode *  theFirstNode,
Consumer theConsumer 
)
staticprivate
Parameters
theFirstNodeThe first Node in the Lexicon, or null if none.
theConsumerThe Consumer to give them to.

◆ GetOperandTaker() [1/2]

PairList::Node& Om::Language::Lexicon::GetOperandTaker ( )
private
Returns
If there is no last Node, or it has an Operand, appends a new one with an empty Operator and returns a reference to it. Otherwise, returns a reference to the last Node.

◆ GetOperandTaker() [2/2]

template<typename TheOperator >
PairList::Node& Om::Language::Lexicon::GetOperandTaker ( TheOperator &  )
private
Returns
If there is already a Node for this Operator, relinks it to the back and returns a reference to it. Otherwise, constructs a Node with the given Operator, appends it, and returns a reference to it.

◆ GivePair()

void Om::Language::Lexicon::GivePair ( PairList::NodeIndex const  ,
Consumer  
)
private

Member Data Documentation

◆ thisMap

Map Om::Language::Lexicon::thisMap
private

Definition at line 175 of file lexicon.hpp.

◆ thisPairList

PairList Om::Language::Lexicon::thisPairList
private

Definition at line 177 of file lexicon.hpp.


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