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 &)
 
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 &)
 Takes each Element of the argument. More...
 
virtual void TakeElements (Producer 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::DefaultConsumer< ThisImplementation, ThisInterface >
virtual ~DefaultConsumer ()=0
 
virtual void TakeElement (Operand &)
 Takes a non-empty Element, which gets copied or swapped. More...
 
virtual void TakeElement (Operand const &)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
virtual void TakeElement (Operator &)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
virtual void TakeElement (Operator const &)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
virtual void TakeElement (Separator &)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
virtual void TakeElement (Separator const &)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
virtual void TakeQuotedElements (Producer &)
 Constructs and takes an Operand, which takes each Element from the argument Producer. More...
 
virtual void TakeQuotedElements (Producer 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::Taker< ThisImplementation >
virtual ~Taker ()=0
 
void Take (ThisImplementation &)
 Swaps. More...
 
void Take (ThisImplementation 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
 

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

◆ 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

◆ GiveElements() [1/3]

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

◆ 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: