15 #ifndef Om_Language_Writer_
21 #ifndef Om_Macro_Precompilation_
23 #include "boost/test/unit_test.hpp"
31 BOOST_AUTO_TEST_SUITE(WriterTest)
33 BOOST_AUTO_TEST_CASE(GeneralTest) {
34 char const theCode[] =
"\n\t {\n\t {\n\t }\n\t }\n\t";
35 std::string theResult;
38 std::back_insert_iterator<std::string>
40 std::back_inserter(theResult)
42 Writer theWriter(theCodePointSink);
45 Reader theReader(theCodePointSource);
46 theWriter.ParseElements(theReader);
49 "\n\t {\n\t {\n\t }\n\t }\n\t",
54 BOOST_AUTO_TEST_SUITE_END()
80 thisCodePointSink(theCodePointSink) {}
82 inline void Type_::ParseElements(Reader & theReader) {
88 this->thisCodePointSink.Push(*theReader);
92 inline void Type_::ParseQuotedElements(Reader & theReader) {
94 this->ParseElements(theReader);
98 template <
typename TheOperand>
99 inline void Type_::TakeOperand(TheOperand & theOperand) {
101 !theOperand.IsEmpty()
103 this->TakeQuotedProducer(
104 *theOperand.GetProgram()
108 template <
typename TheOperator>
109 inline void Type_::TakeOperator(TheOperator & theOperator) {
111 !theOperator.IsEmpty()
113 std::string
const & theString = theOperator.GetString();
120 theCodePointSource.
Pop()
122 switch (
CodePoint const theCodePoint = *theCodePointSource) {
131 this->thisCodePointSink.Push(theCodePoint);
137 template <
typename TheProducer>
138 inline void Type_::TakeQuotedProducer(TheProducer & theProducer) {
140 theProducer.GiveElements(*
this);
144 template <
typename TheSeparator>
145 inline void Type_::TakeSeparator(TheSeparator & theSeparator) {
147 !theSeparator.IsEmpty()
149 std::string
const & theString = theSeparator.GetString();
156 theCodePointSource.
Pop()
158 this->thisCodePointSink.Push(*theCodePointSource);
A CodePoint Sink that pushes each code unit to the iterator.
Any object that items can be pushed to.
A CodePoint Source that reads each code unit from the iterator.
virtual void Pop()
Pops the current item.
@ theEncodeOperatorSymbol
boost::locale::utf::code_point CodePoint
A UTF-8 code point.
#define Om_Language_Symbol_OperandSymbol_GetCases_()
Generates switch cases for each Om::Language::Symbol::OperandSymbol.
#define Om_Language_Symbol_SeparatorSymbol_GetCases_()
Generates switch cases for each Om::Language::Symbol::SeparatorSymbol.