~ubuntu-branches/ubuntu/gutsy/icu/gutsy

« back to all changes in this revision

Viewing changes to source/i18n/ucol_elm.cpp

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2005-05-21 22:44:31 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: package-import@ubuntu.com-20050521224431-r7rktfhnu1n4tf1g
Tags: 2.1-2.1
Rename icu-doc to icu21-doc. icu-doc is built by the icu28 package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "unicode/uchar.h"
28
28
#include "unormimp.h"
29
29
#include "cmemory.h"
 
30
#include "unicode/unistr.h"
 
31
#include "caniter.h"
30
32
 
31
33
U_NAMESPACE_BEGIN
32
34
 
997
999
    uprv_free(composed);
998
1000
  }
999
1001
 
1000
 
  CE = uprv_uca_finalizeAddition(t, element, status);
1001
 
 
 
1002
  // We need to use the canonical iterator here
 
1003
  // the way we do it is to generate the canonically equivalent strings 
 
1004
  // for the contraction and then add the sequences that pass FCD check
1002
1005
  if(element->cSize > 1 && !(element->cSize==2 && UTF16_IS_LEAD(element->cPoints[0]) && UTF16_IS_TRAIL(element->cPoints[1]))) { // this is a contraction, we should check whether a composed form should also be included
 
1006
    UnicodeString source(element->cPoints, element->cSize);
 
1007
    CanonicalIterator it(source, *status);
 
1008
    source = it.next();
 
1009
    while(source.length() > 0) {
 
1010
      if(Normalizer::quickCheck(source, UNORM_FCD, *status) != UNORM_NO) {
 
1011
        element->cSize = source.extract(element->cPoints, 128, *status);
 
1012
        uprv_uca_finalizeAddition(t, element, status);
 
1013
      }
 
1014
      source = it.next();
 
1015
    }
 
1016
#if 0
 
1017
    CE = uprv_uca_finalizeAddition(t, element, status);  
1003
1018
    UChar composed[256];
1004
1019
    uint32_t compLen = unorm_normalize(element->cPoints, element->cSize, UNORM_NFC, 0, composed, 256, status);;
1005
1020
 
1013
1028
      uprv_memcpy(element->cPoints, composed, element->cSize*sizeof(UChar));
1014
1029
      uprv_uca_finalizeAddition(t, element, status);
1015
1030
    }
 
1031
#else
 
1032
    CE = element->mapCE;
 
1033
#endif
 
1034
  } else {
 
1035
      CE = uprv_uca_finalizeAddition(t, element, status);  
1016
1036
  }
1017
1037
 
1018
1038
  return CE;