Update contrib.
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 inline TBool IsSurrogate(TText a)
21 return 0xD800 == (a & 0xF800);
27 inline TBool IsHighSurrogate(TText a)
29 return 0xD800 == (a & 0xFC00);
35 inline TBool IsLowSurrogate(TText a)
37 return 0xDC00 == (a & 0xFC00);
43 inline TChar PairSurrogates(TText aHigh, TText aLow)
45 return ((aHigh - 0xd7f7) << 10) + aLow;
48 inline void SkipCombiningCharacters(TUTF32Iterator& aUTF32It)
50 while(!aUTF32It.AtEnd() && !::IsBaseCharacter(aUTF32It.Current()))
56 ////////////////////////////////////////////////////////////////////////////////////////////
58 ////////////////////////////////////////////////////////////////////////////////////////////
63 inline TUTF32Iterator::TUTF32Iterator() :
72 inline TUTF32Iterator::TUTF32Iterator(const TText16* aSingleton) :
77 ASSERT((iCurrent & 0xFFFE) != 0xFFFE);
78 ASSERT(!::IsSurrogate(*aSingleton));
84 inline TUTF32Iterator::TUTF32Iterator(const TText16* aStart, const TText16* aEnd) :
91 Sets the iteration to begin at aStart.
92 @param aStart New starting point of iteration.
95 inline void TUTF32Iterator::SetStart(const TText16* aStart)
100 if(::IsSurrogate(iEnd[-1]))
108 iCurrent = ::UTF16ToChar(iStart);
109 if(iCurrent == 0xFFFF)
119 inline TUTF32Iterator::TUTF32Iterator(const TText16* aStart, const TText16* aEnd, TStartsWithValidCharacter) :
123 ASSERT(iStart < iEnd);
124 if(::IsSurrogate(iEnd[-1]))
128 iCurrent = ::UTF16ToChar(iStart);
129 ASSERT(iCurrent != 0xFFFF);
135 inline TUTF32Iterator TUTF32Iterator::CurrentAsIterator() const
137 TUTF32Iterator retval(*this);
138 ASSERT(iStart != iEnd);
139 retval.iEnd = iStart + 1;
146 inline TBool TUTF32Iterator::AtEnd() const
148 return iEnd == iStart;
154 inline TChar TUTF32Iterator::Current() const
156 ASSERT(iStart != iEnd);
157 ASSERT(iCurrent != 0xFFFF);
164 inline const TText16* TUTF32Iterator::CurrentPosition() const
172 inline TInt TUTF32Iterator::Length() const
174 return iEnd - iStart;
180 inline TInt TUTF32Iterator::operator[](TInt a) const
185 ////////////////////////////////////////////////////////////////////////////////////////////
186 // TFoldedDecompIterator
187 ////////////////////////////////////////////////////////////////////////////////////////////
192 inline TFoldedDecompIterator::TFoldedDecompIterator()
199 inline TUTF32Iterator TFoldedDecompIterator::BaseIterator() const
207 inline void TFoldedDecompIterator::Set(const TUTF32Iterator& a)
215 inline TBool TFoldedDecompIterator::IsInFoldedSequence() const
217 return !iFolded.AtEnd();
220 ////////////////////////////////////////////////////////////////////////////////////////////
221 // TFoldedSortedDecompIterator
222 ////////////////////////////////////////////////////////////////////////////////////////////
227 inline TFoldedSortedDecompIterator::TFoldedSortedDecompIterator()
231 ////////////////////////////////////////////////////////////////////////////////////////////
232 // TDecompositionIterator
233 ////////////////////////////////////////////////////////////////////////////////////////////
238 inline TDecompositionIterator::TDecompositionIterator()
242 ////////////////////////////////////////////////////////////////////////////////////////////
243 // TCanonicalDecompositionIterator
244 ////////////////////////////////////////////////////////////////////////////////////////////
249 inline TCanonicalDecompositionIterator::TCanonicalDecompositionIterator()