diff options
| author | neksard <[email protected]> | 2022-02-10 16:45:33 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:33 +0300 |
| commit | 1d9c550e7c38e051d7961f576013a482003a70d9 (patch) | |
| tree | b2cc84ee7850122e7ccf51d0ea21e4fa7e7a5685 /contrib/libs/icu/common/chariter.cpp | |
| parent | 8f7cf138264e0caa318144bf8a2c950e0b0a8593 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/icu/common/chariter.cpp')
| -rw-r--r-- | contrib/libs/icu/common/chariter.cpp | 198 |
1 files changed, 99 insertions, 99 deletions
diff --git a/contrib/libs/icu/common/chariter.cpp b/contrib/libs/icu/common/chariter.cpp index 9ebb48a64e9..887119a0eba 100644 --- a/contrib/libs/icu/common/chariter.cpp +++ b/contrib/libs/icu/common/chariter.cpp @@ -1,100 +1,100 @@ // © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -********************************************************************** -* Copyright (C) 1999-2011, International Business Machines -* Corporation and others. All Rights Reserved. -********************************************************************** -*/ - -#include "unicode/chariter.h" - -U_NAMESPACE_BEGIN - -ForwardCharacterIterator::~ForwardCharacterIterator() {} -ForwardCharacterIterator::ForwardCharacterIterator() -: UObject() -{} -ForwardCharacterIterator::ForwardCharacterIterator(const ForwardCharacterIterator &other) -: UObject(other) -{} - - -CharacterIterator::CharacterIterator() -: textLength(0), pos(0), begin(0), end(0) { -} - -CharacterIterator::CharacterIterator(int32_t length) -: textLength(length), pos(0), begin(0), end(length) { - if(textLength < 0) { - textLength = end = 0; - } -} - -CharacterIterator::CharacterIterator(int32_t length, int32_t position) -: textLength(length), pos(position), begin(0), end(length) { - if(textLength < 0) { - textLength = end = 0; - } - if(pos < 0) { - pos = 0; - } else if(pos > end) { - pos = end; - } -} - -CharacterIterator::CharacterIterator(int32_t length, int32_t textBegin, int32_t textEnd, int32_t position) -: textLength(length), pos(position), begin(textBegin), end(textEnd) { - if(textLength < 0) { - textLength = 0; - } - if(begin < 0) { - begin = 0; - } else if(begin > textLength) { - begin = textLength; - } - if(end < begin) { - end = begin; - } else if(end > textLength) { - end = textLength; - } - if(pos < begin) { - pos = begin; - } else if(pos > end) { - pos = end; - } -} - -CharacterIterator::~CharacterIterator() {} - -CharacterIterator::CharacterIterator(const CharacterIterator &that) : -ForwardCharacterIterator(that), -textLength(that.textLength), pos(that.pos), begin(that.begin), end(that.end) -{ -} - -CharacterIterator & -CharacterIterator::operator=(const CharacterIterator &that) { - ForwardCharacterIterator::operator=(that); - textLength = that.textLength; - pos = that.pos; - begin = that.begin; - end = that.end; - return *this; -} - -// implementing first[32]PostInc() directly in a subclass should be faster -// but these implementations make subclassing a little easier -UChar -CharacterIterator::firstPostInc(void) { - setToStart(); - return nextPostInc(); -} - -UChar32 -CharacterIterator::first32PostInc(void) { - setToStart(); - return next32PostInc(); -} - -U_NAMESPACE_END +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2011, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#include "unicode/chariter.h" + +U_NAMESPACE_BEGIN + +ForwardCharacterIterator::~ForwardCharacterIterator() {} +ForwardCharacterIterator::ForwardCharacterIterator() +: UObject() +{} +ForwardCharacterIterator::ForwardCharacterIterator(const ForwardCharacterIterator &other) +: UObject(other) +{} + + +CharacterIterator::CharacterIterator() +: textLength(0), pos(0), begin(0), end(0) { +} + +CharacterIterator::CharacterIterator(int32_t length) +: textLength(length), pos(0), begin(0), end(length) { + if(textLength < 0) { + textLength = end = 0; + } +} + +CharacterIterator::CharacterIterator(int32_t length, int32_t position) +: textLength(length), pos(position), begin(0), end(length) { + if(textLength < 0) { + textLength = end = 0; + } + if(pos < 0) { + pos = 0; + } else if(pos > end) { + pos = end; + } +} + +CharacterIterator::CharacterIterator(int32_t length, int32_t textBegin, int32_t textEnd, int32_t position) +: textLength(length), pos(position), begin(textBegin), end(textEnd) { + if(textLength < 0) { + textLength = 0; + } + if(begin < 0) { + begin = 0; + } else if(begin > textLength) { + begin = textLength; + } + if(end < begin) { + end = begin; + } else if(end > textLength) { + end = textLength; + } + if(pos < begin) { + pos = begin; + } else if(pos > end) { + pos = end; + } +} + +CharacterIterator::~CharacterIterator() {} + +CharacterIterator::CharacterIterator(const CharacterIterator &that) : +ForwardCharacterIterator(that), +textLength(that.textLength), pos(that.pos), begin(that.begin), end(that.end) +{ +} + +CharacterIterator & +CharacterIterator::operator=(const CharacterIterator &that) { + ForwardCharacterIterator::operator=(that); + textLength = that.textLength; + pos = that.pos; + begin = that.begin; + end = that.end; + return *this; +} + +// implementing first[32]PostInc() directly in a subclass should be faster +// but these implementations make subclassing a little easier +UChar +CharacterIterator::firstPostInc(void) { + setToStart(); + return nextPostInc(); +} + +UChar32 +CharacterIterator::first32PostInc(void) { + setToStart(); + return next32PostInc(); +} + +U_NAMESPACE_END |
