kernel/eka/euser/unicode/CompareImp.inl
changeset 281 13fbfa31d2ba
parent 0 a41df078684a
equal deleted inserted replaced
266:0008ccd16016 281:13fbfa31d2ba
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    51 		{
    51 		{
    52 		aUTF32It.Next();
    52 		aUTF32It.Next();
    53 		}
    53 		}
    54 	}
    54 	}
    55 
    55 
       
    56 /**
       
    57 @internalComponent
       
    58 */
       
    59 inline TChar UTF16ToChar(const TText16* a)
       
    60 	{
       
    61 	if (0xD800 <= a[0])
       
    62 		{
       
    63 		if (a[0] < 0xE000)
       
    64 			{
       
    65             if (a[0] < 0xDC00 && ::IsLowSurrogate(a[1]))
       
    66 				{
       
    67                 TChar c = ::PairSurrogates(a[0], a[1]);
       
    68 				if ((c & 0xFFFE) != 0xFFFE)
       
    69 					return c;
       
    70 				}
       
    71 			return 0xFFFF;
       
    72 			}
       
    73 		if (a[0] == 0xFFFE)
       
    74 			return 0xFFFF;
       
    75 		}
       
    76 	return a[0];
       
    77 	}
       
    78 
       
    79 
    56 ////////////////////////////////////////////////////////////////////////////////////////////
    80 ////////////////////////////////////////////////////////////////////////////////////////////
    57 // TUTF32Iterator
    81 // TUTF32Iterator
    58 ////////////////////////////////////////////////////////////////////////////////////////////
    82 ////////////////////////////////////////////////////////////////////////////////////////////
    59 
    83 
    60 /**
    84 /**
   159 	}
   183 	}
   160 
   184 
   161 /**
   185 /**
   162 @internalComponent
   186 @internalComponent
   163 */
   187 */
       
   188 inline void TUTF32Iterator::Next()
       
   189 	{
       
   190 	ASSERT(iStart != iEnd);
       
   191 	while (++iStart != iEnd)
       
   192 		{
       
   193         iCurrent = ::UTF16ToChar(iStart);
       
   194 		if (iCurrent != 0xFFFF)
       
   195 			return;
       
   196 		}
       
   197 	}
       
   198 
       
   199 /**
       
   200 @internalComponent
       
   201 */
   164 inline const TText16* TUTF32Iterator::CurrentPosition() const
   202 inline const TText16* TUTF32Iterator::CurrentPosition() const
   165 	{
   203 	{
   166 	return iStart;
   204 	return iStart;
   167 	}
   205 	}
   168 
   206 
   210 	}
   248 	}
   211 
   249 
   212 /**
   250 /**
   213 @internalComponent
   251 @internalComponent
   214 */
   252 */
       
   253 TBool TFoldedDecompIterator::AtEnd() const
       
   254     {
       
   255     return iOriginal.AtEnd();
       
   256     }
       
   257 
       
   258 /**
       
   259 @internalComponent
       
   260 */
   215 inline TBool TFoldedDecompIterator::IsInFoldedSequence() const
   261 inline TBool TFoldedDecompIterator::IsInFoldedSequence() const
   216 	{
   262 	{
   217 	return !iFolded.AtEnd();
   263 	return !iFolded.AtEnd();
   218 	}
   264 	}
   219 
   265 
       
   266 /**
       
   267 @internalComponent
       
   268 */
       
   269 inline TChar TFoldedDecompIterator::Current() const
       
   270     {
       
   271     ASSERT(!AtEnd());
       
   272     return IsInFoldedSequence()? iFolded.Current() : iOriginal.Current();
       
   273     }
       
   274 
   220 ////////////////////////////////////////////////////////////////////////////////////////////
   275 ////////////////////////////////////////////////////////////////////////////////////////////
   221 // TFoldedSortedDecompIterator
   276 // TFoldedSortedDecompIterator
   222 ////////////////////////////////////////////////////////////////////////////////////////////
   277 ////////////////////////////////////////////////////////////////////////////////////////////
   223 
   278 
   224 /**
   279 /**
   226 */
   281 */
   227 inline TFoldedSortedDecompIterator::TFoldedSortedDecompIterator() 
   282 inline TFoldedSortedDecompIterator::TFoldedSortedDecompIterator() 
   228 	{
   283 	{
   229 	}
   284 	}
   230 
   285 
       
   286 /** 
       
   287 @internalComponent
       
   288 */
       
   289 inline TBool TFoldedSortedDecompIterator::AtEnd() const
       
   290     {
       
   291     return iRemaining == 0;
       
   292     }
       
   293 
       
   294 /** 
       
   295 @internalComponent
       
   296 */
       
   297 inline TChar TFoldedSortedDecompIterator::Current() const
       
   298     {
       
   299     ASSERT(!AtEnd());
       
   300     return iCurrent.Current();
       
   301     }
       
   302 
       
   303 ////////////////////////////////////////////////////////////////////////////////////////////
       
   304 // TFoldedCanonicalIterator
       
   305 ////////////////////////////////////////////////////////////////////////////////////////////
       
   306 
       
   307 /** 
       
   308 @internalComponent
       
   309 */
       
   310 inline TBool TFoldedCanonicalIterator::AtEnd() const
       
   311     {
       
   312     return iSorted.AtEnd() && iBase.AtEnd();
       
   313     }
       
   314 
       
   315 /** 
       
   316 @internalComponent
       
   317 */
       
   318 inline TChar TFoldedCanonicalIterator::Current() const
       
   319     {
       
   320     ASSERT(!iBase.AtEnd() || !iSorted.AtEnd());
       
   321     return iSorted.AtEnd() ? iBase.Current() : iSorted.Current();
       
   322     }
       
   323 
   231 ////////////////////////////////////////////////////////////////////////////////////////////
   324 ////////////////////////////////////////////////////////////////////////////////////////////
   232 // TDecompositionIterator
   325 // TDecompositionIterator
   233 ////////////////////////////////////////////////////////////////////////////////////////////
   326 ////////////////////////////////////////////////////////////////////////////////////////////
   234 
   327 
   235 /**
   328 /**
   237 */
   330 */
   238 inline TDecompositionIterator::TDecompositionIterator() 
   331 inline TDecompositionIterator::TDecompositionIterator() 
   239 	{
   332 	{
   240 	}
   333 	}
   241 
   334 
       
   335 /** 
       
   336 @internalComponent
       
   337 */
       
   338 inline TBool TDecompositionIterator::AtEnd() const
       
   339     {
       
   340     return iBase.AtEnd();
       
   341     }
       
   342 
       
   343 /** 
       
   344 @internalComponent
       
   345 */
       
   346 inline TChar TDecompositionIterator::Current() const
       
   347     {
       
   348     return iDecomposition.Current();
       
   349     }
       
   350 
   242 ////////////////////////////////////////////////////////////////////////////////////////////
   351 ////////////////////////////////////////////////////////////////////////////////////////////
   243 // TCanonicalDecompositionIterator
   352 // TCanonicalDecompositionIterator
   244 ////////////////////////////////////////////////////////////////////////////////////////////
   353 ////////////////////////////////////////////////////////////////////////////////////////////
   245 
   354 
   246 /**
   355 /**
   248 */
   357 */
   249 inline TCanonicalDecompositionIterator::TCanonicalDecompositionIterator() 
   358 inline TCanonicalDecompositionIterator::TCanonicalDecompositionIterator() 
   250 	{
   359 	{
   251 	}
   360 	}
   252 
   361 
       
   362 /** 
       
   363 @internalComponent
       
   364 */
       
   365 inline TBool TCanonicalDecompositionIterator::AtEnd() const
       
   366     {
       
   367     return iBase.AtEnd();
       
   368     }
       
   369 
       
   370 /** 
       
   371 @internalComponent
       
   372 */
       
   373 inline TChar TCanonicalDecompositionIterator::Current() const
       
   374     {
       
   375     return iCurrentCombiningClass? iCurrent.Current() : iBase.Current();
       
   376     }
       
   377 
       
   378 ////////////////////////////////////////////////////////////////////////////////////////////
       
   379 // TCanonicalDecompositionIteratorCached
       
   380 ////////////////////////////////////////////////////////////////////////////////////////////
       
   381 
       
   382 /** 
       
   383 @internalComponent
       
   384 */
       
   385 inline TBool TCanonicalDecompositionIteratorCached::AtEnd() const
       
   386     {
       
   387     return iCacheSize == 0 && iBase.AtEnd();
       
   388     }
       
   389 
       
   390 
       
   391