15 #ifndef Om_Source_CodePointStringFrontSource_
21 #ifndef Om_Macro_Precompilation_
23 #include "boost/test/unit_test.hpp"
31 BOOST_AUTO_TEST_SUITE(CodePointStringFrontSourceTest)
33 BOOST_AUTO_TEST_CASE(ValidTest) {
34 std::string theString(
43 CodePointStringFrontSource<std::string::const_iterator> theSource(
114 BOOST_AUTO_TEST_CASE(InvalidNoTrailingTest) {
115 std::string theString(
120 CodePointStringFrontSource<std::string::const_iterator> theSource(
151 BOOST_AUTO_TEST_CASE(InvalidInsufficientTrailingTest) {
152 std::string theString(
157 CodePointStringFrontSource<std::string::const_iterator> theSource(
188 BOOST_AUTO_TEST_CASE(InvalidExtraTrailingTest) {
189 std::string theString(
195 CodePointStringFrontSource<std::string::const_iterator> theSource(
236 BOOST_AUTO_TEST_CASE(InvalidMissingLeadingTest) {
237 std::string theString(
242 CodePointStringFrontSource<std::string::const_iterator> theSource(
273 BOOST_AUTO_TEST_CASE(InvalidEarlyTerminationTest) {
274 std::string theString(
278 CodePointStringFrontSource<std::string::const_iterator> theSource(
299 BOOST_AUTO_TEST_SUITE_END()
311 #ifndef Om_Macro_Precompilation_
313 #include "boost/swap.hpp"
320 template <typename ThisStringIterator>
323 Om::Source::CodePointStringFrontSource<ThisStringIterator>
328 inline Type_::CodePointStringFrontSource(
329 ThisStringIterator theStringStart,
330 ThisStringIterator
const theStringEnd
332 thisStringIterator(theStringStart),
333 thisStringEnd(theStringEnd),
339 inline Type_ & Type_::operator =(CodePointStringFrontSource theCodePointStringFrontSource) {
340 this->Swap(theCodePointStringFrontSource);
345 inline bool Type_::operator !()
const {
346 return this->thisCodePoint.empty();
350 inline std::string & Type_::operator *()
const {
351 return this->thisCodePoint;
355 inline bool Type_::Equals(CodePointStringFrontSource
const & theCodePointStringFrontSource)
const {
356 return this->thisStringIterator == theCodePointStringFrontSource.thisStringIterator;
360 inline void Type_::Pop() {
361 this->thisCodePoint.clear();
366 inline void Type_::Swap(CodePointStringFrontSource & theCodePointStringFrontSource) {
368 this->thisStringIterator,
369 theCodePointStringFrontSource.thisStringIterator
373 theCodePointStringFrontSource.thisStringEnd
377 theCodePointStringFrontSource.thisCodePoint
384 inline void Type_::Update() {
386 this->thisCodePoint.empty()
388 if (this->thisStringEnd == this->thisStringIterator) {
391 char theCodeUnit = *this->thisStringIterator;
392 ++this->thisStringIterator;
394 Utf8::is_lead(theCodeUnit)
396 this->thisCodePoint.push_back(theCodeUnit);
398 int theTrailCount = Utf8::trail_length(theCodeUnit);
402 if (!theTrailCount) {
406 this->thisStringEnd == this->thisStringIterator ||
407 !Utf8::is_trail(theCodeUnit = *this->thisStringIterator)
411 this->thisCodePoint.push_back(theCodeUnit);
412 ++this->thisStringIterator;
415 this->thisCodePoint =
"\xEF\xBF\xBD" ;
424 template <typename TheStringIterator>
427 Om::Source::CodePointStringFrontSource<TheStringIterator>
431 Type_
const & theFirst,
432 Type_
const & theSecond
434 return theFirst.Equals(theSecond);
439 Type_
const & theFirst,
440 Type_
const & theSecond
442 return !theFirst.Equals(theSecond);
452 theFirst.Swap(theSecond);
bool operator==(CodePointSource< TheCodeUnitIterator > const &, CodePointSource< TheCodeUnitIterator > const &)
bool operator!=(CodePointSource< TheCodeUnitIterator > const &, CodePointSource< TheCodeUnitIterator > const &)
void swap(Om::Language::Expression &, Om::Language::Expression &)