Om
literal.hpp
Go to the documentation of this file.
1 
26 #ifndef Om_Language_Literal_
27 
28  #define Om_Language_Literal_ \
29  Om::Language::Literal
30 
33 
34  #ifndef Om_Macro_Precompilation_
35 
36  #include "boost/ptr_container/ptr_deque.hpp"
37  #include "boost/swap.hpp"
38 
39  #endif
40 
41  #define Om_Language_Literal_GetName_() \
42  "literal"
43 
44 namespace Om {
45 
46  namespace Language {
47 
48  // MARK: - Om::Language::Literal
49 
54  class Literal:
55  public DefaultProgram<Literal> {
56 
57  public: // MARK: public (static)
58 
63  template <typename ThisLiteral>
64  class ElementRange;
65 
66  static char const * GetName();
67 
68  public: // MARK: public (non-static)
69 
70  virtual ~Literal();
71 
73 
75 
76  template <typename TheElement>
77  void BackGive(Consumer &);
78 
80 
81  virtual void Clear();
82 
83  template <typename TheElement>
85 
87 
88  std::auto_ptr<
91 
92  virtual std::auto_ptr<
94  > GetElementRange() const;
95 
96  virtual void GiveElements(Consumer &);
97 
98  virtual void GiveElements(Consumer &) const;
99 
100  virtual bool IsEmpty() const;
101 
102  virtual void ParseElements(Reader &);
103 
104  virtual void ParseQuotedElements(Reader &);
105 
106  void Swap(Literal &);
107 
108  template <typename TheOperand>
109  void TakeOperand(TheOperand &);
110 
111  template <typename TheOperator>
112  void TakeOperator(TheOperator &);
113 
114  template <typename TheProducer>
115  void TakeQuotedProducer(TheProducer &);
116 
117  template <typename TheSeparator>
118  void TakeSeparator(TheSeparator &);
119 
120  private: // MARK: private (static)
121 
122  typedef boost::ptr_deque<Element> ElementDeque;
123 
132  template <typename TheElementIterator>
133  static void GiveElements(
134  Consumer & theConsumer,
135  TheElementIterator theCurrent,
136  TheElementIterator const theEnd
137  );
138 
139  private: // MARK: private (non-static)
140 
141  template <typename TheAtom>
142  void TakeAtom(TheAtom &);
143 
145 
146  };
147 
148  // MARK: - Om::Language::Literal::ElementRange<Literal>
149 
154  template <>
157  Element,
158  ElementDeque::iterator
159  > {
160 
161  public: // MARK: public (non-static)
162 
163  explicit ElementRange(Literal &);
164 
165  };
166 
167  // MARK: - Om::Language::Literal::ElementRange<Literal const>
168 
173  template <>
176  Element const,
177  ElementDeque::const_iterator
178  > {
179 
180  public: // MARK: public (non-static)
181 
182  explicit ElementRange(Literal const &);
183 
184  };
185 
186  }
187 
188 }
189 
190 namespace boost {
191 
192  // MARK: - boost::
193 
194  template <>
195  void swap(
198  );
199 
200 }
201 
202  #include "om/language/literal.cpp"
203 
204 #endif
An Element taker; takes at the back.
Definition: consumer.hpp:42
A partial implementation of Program.
A Literal Element range.
Definition: literal.hpp:64
The Literal Program implementation.
Definition: literal.hpp:55
virtual void ParseQuotedElements(Reader &)
static char const * GetName()
virtual bool IsEmpty() const
Literal & operator=(Literal)
void TakeSeparator(TheSeparator &)
void Swap(Literal &)
void TakeQuotedProducer(TheProducer &)
virtual void GiveElements(Consumer &) const
void TakeOperator(TheOperator &)
std::auto_ptr< Om::Source::Source< Element > > GetElementRange()
void TakeAtom(TheAtom &)
virtual void GiveElements(Consumer &)
void TakeOperand(TheOperand &)
ElementDeque thisElementDeque
Definition: literal.hpp:144
void FrontGive(Consumer &)
virtual void ParseElements(Reader &)
void BackGive(Consumer &)
virtual void Clear()
static void GiveElements(Consumer &theConsumer, TheElementIterator theCurrent, TheElementIterator const theEnd)
boost::ptr_deque< Element > ElementDeque
Definition: literal.hpp:122
void BackGiveElement(Consumer &)
virtual std::auto_ptr< Om::Source::Source< Element const > > GetElementRange() const
void FrontGiveElement(Consumer &)
Produces each CodePoint until the end of the Source.
Definition: reader.hpp:37
A range over a collection, starting from the front.
Any object that items can be pulled from.
Definition: source.hpp:31
Om header file.
Om source file.
The Om library.
Definition: code_point.hpp:26
void swap(Om::Language::Expression &, Om::Language::Expression &)