15 #ifndef Om_Source_CodePointSource_
21 #ifndef Om_Macro_Precompilation_
23 #include "boost/test/unit_test.hpp"
31 BOOST_AUTO_TEST_SUITE(CodePointSourceTest)
33 BOOST_AUTO_TEST_CASE(GeneralTest) {
34 std::string theString(
38 CodePointSource<std::string::const_iterator> theSource(
66 BOOST_AUTO_TEST_SUITE_END()
78 #ifndef Om_Macro_Precompilation_
80 #include "boost/swap.hpp"
87 template <typename ThisCodeUnitIterator>
90 Om::Source::CodePointSource<ThisCodeUnitIterator>
95 inline Type_::CodePointSource(
96 ThisCodeUnitIterator theInputStart,
97 ThisCodeUnitIterator
const theInputEnd
99 thisInputIterator(theInputStart),
100 thisInputEnd(theInputEnd),
106 inline Type_ & Type_::operator =(CodePointSource theCodePointSource) {
107 this->Swap(theCodePointSource);
112 inline bool Type_::operator !()
const {
113 return !this->thisCodePoint;
118 assert(this->thisCodePoint);
119 return this->thisCodePoint;
123 inline bool Type_::Equals(CodePointSource
const & theCodePointSource)
const {
124 return this->thisInputIterator == theCodePointSource.thisInputIterator;
128 inline void Type_::Pop() {
129 if (this->thisInputEnd == this->thisInputIterator) {
130 this->thisCodePoint = 0;
132 this->thisCodePoint = Utf8::decode(
133 this->thisInputIterator,
136 switch (this->thisCodePoint) {
139 case boost::locale::utf::incomplete:
141 case boost::locale::utf::illegal:
142 this->thisCodePoint = 0xFFFD ;
149 inline void Type_::Swap(CodePointSource & theCodePointSource) {
151 this->thisInputIterator,
152 theCodePointSource.thisInputIterator
156 theCodePointSource.thisInputEnd
160 theCodePointSource.thisCodePoint
170 Om::Source::CodePointSource<char const *>
174 inline Type_::CodePointSource(
175 char const theCodeUnitIterator[]
177 CodePointSource<CodeUnitSource>(
178 CodeUnitSource(theCodeUnitIterator),
187 template <typename TheCodeUnitIterator>
190 Om::Source::CodePointSource<TheCodeUnitIterator>
194 Type_
const & theFirst,
195 Type_
const & theSecond
197 return theFirst.Equals(theSecond);
202 Type_
const & theFirst,
203 Type_
const & theSecond
205 return !theFirst.Equals(theSecond);
215 theFirst.Swap(theSecond);
bool operator==(CodePointSource< TheCodeUnitIterator > const &, CodePointSource< TheCodeUnitIterator > const &)
bool operator!=(CodePointSource< TheCodeUnitIterator > const &, CodePointSource< TheCodeUnitIterator > const &)
boost::locale::utf::code_point CodePoint
A UTF-8 code point.
void swap(Om::Language::Expression &, Om::Language::Expression &)