Om
null.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_Language_Null_
16 
17  #include "om/language/null.hpp"
18 
19 #else
20 
21  #include "om/language/reader.hpp"
23 
24 // MARK: - Om::Language::Null
25 
26  #define Type_ \
27  Om::Language::Null
28 
29 // MARK: public (static)
30 
31 inline Type_ & Type_::Get() {
32  static Null theNull;
33  return theNull;
34 }
35 
36 inline char const * Type_::GetName() {
38 }
39 
40 // MARK: public (non-static)
41 
42 inline Type_::Null() {}
43 
44 inline Type_::Null(
45  Om::Source::Source<CodePoint const> & theCodePointSource
46 ) {
47  if (theCodePointSource) {
48  theCodePointSource.Pop();
49  }
50 }
51 
52 inline Type_ & Type_::operator =(Null const &) {
53  return *this;
54 }
55 
56 inline Om::Language::Program & Type_::operator *() {
57  return *this;
58 }
59 
60 inline Om::Language::Program const & Type_::operator *() const {
61  return *this;
62 }
63 
64 inline void Type_::Clear() {}
65 
66 inline bool Type_::Equals(Element const & theElement) const {
67  return theElement.IsEmpty();
68 }
69 
70 inline bool Type_::Equals(Program const & theProgram) const {
71  return theProgram.IsEmpty();
72 }
73 
74 inline std::auto_ptr<
76 > Type_::GetElementRange() {
77  return std::auto_ptr<
79  >(
81  );
82 }
83 
84 inline std::auto_ptr<
86 > Type_::GetElementRange() const {
87  return std::auto_ptr<
89  >(
91  );
92 }
93 
94 inline void Type_::GiveElements(Consumer &) {}
95 
96 inline void Type_::GiveElements(Consumer &) const {}
97 
98 inline bool Type_::IsEmpty() const {
99  return true;
100 }
101 
102 inline bool Type_::Merge(Operator &) {
103  return true;
104 }
105 
106 inline bool Type_::Merge(Operator const &) {
107  return true;
108 }
109 
110 inline bool Type_::Merge(Separator &) {
111  return true;
112 }
113 
114 inline bool Type_::Merge(Separator const &) {
115  return true;
116 }
117 
118 inline void Type_::ParseElements(Reader & theReader) {
119  for (
120  ;
121  theReader;
122  theReader.Pop()
123  ) {}
124 }
125 
126 inline void Type_::ParseQuotedElements(Reader & theReader) {
127  for (
128  ;
129  theReader;
130  theReader.Pop()
131  ) {}
132 }
133 
134 inline void Type_::Swap(Null &) {}
135 
136 inline void Type_::TakeElements(Producer &) {}
137 
138 inline void Type_::TakeElements(Producer const &) {}
139 
140 template <typename TheOperand>
141 inline void Type_::TakeOperand(TheOperand &) {}
142 
143 template <typename TheOperator>
144 inline void Type_::TakeOperator(TheOperator &) {}
145 
146 template <typename TheProducer>
147 inline void Type_::TakeQuotedProducer(TheProducer &) {}
148 
149 template <typename TheSeparator>
150 inline void Type_::TakeSeparator(TheSeparator &) {}
151 
152  #undef Type_
153 
154 // MARK: - boost::
155 
156 template <>
157 inline void boost::swap(
158  Om::Language::Null & theFirst,
159  Om::Language::Null & theSecond
160 ) {
161  theFirst.Swap(theSecond);
162 }
163 
164 #endif
The Null Element implementation.
Definition: null.hpp:54
virtual void Swap(Null &)
The Program implementation.
Definition: program.hpp:62
virtual bool IsEmpty() const =0
An empty Source.
Any object that items can be pulled from.
Definition: source.hpp:31
virtual void Pop()=0
Pops the current item.
Om header file.
void swap(Om::Language::Expression &, Om::Language::Expression &)
Om header file.
#define Om_Language_Null_GetName_()
Definition: null.hpp:40
Om header file.