(file) Return to String.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/String.cpp between version 1.107 and 1.108

version 1.107, 2005/05/13 15:05:52 version 1.108, 2005/05/16 16:50:39
Line 43 
Line 43 
 #include "InternalException.h" #include "InternalException.h"
 #include <iostream> #include <iostream>
 #include <fstream> #include <fstream>
   #include <Pegasus/Common/CommonUTF.h>
  
 #include "CommonUTF.h" #include "CommonUTF.h"
  
Line 542 
Line 543 
 void String::toLower() void String::toLower()
 { {
 #ifdef PEGASUS_HAS_ICU #ifdef PEGASUS_HAS_ICU
       if (InitializeICU::initICUSuccessful())
       {
     // This will do a locale-insensitive, but context-sensitive convert.     // This will do a locale-insensitive, but context-sensitive convert.
     // Context-sensitive prevents any optimizations that try to     // Context-sensitive prevents any optimizations that try to
     // convert just the ascii before calling ICU.     // convert just the ascii before calling ICU.
Line 580 
Line 583 
     }     }
  
     delete [] destbuf;     delete [] destbuf;
 #else      }
       else
   #endif
       {
     for (Char16* p = &_rep->c16a[0]; *p; p++)     for (Char16* p = &_rep->c16a[0]; *p; p++)
     {     {
         if (*p <= PEGASUS_MAX_PRINTABLE_CHAR)         if (*p <= PEGASUS_MAX_PRINTABLE_CHAR)
                 *p = tolower(*p);                 *p = tolower(*p);
     }     }
 #endif      }
 } }
  
 void String::toUpper() void String::toUpper()
 { {
 #ifdef PEGASUS_HAS_ICU #ifdef PEGASUS_HAS_ICU
       if (InitializeICU::initICUSuccessful())
       {
     // This will do a locale-insensitive, but context-sensitive convert.     // This will do a locale-insensitive, but context-sensitive convert.
     // Context-sensitive prevents any optimizations that try to     // Context-sensitive prevents any optimizations that try to
     // convert just the ascii before calling ICU.     // convert just the ascii before calling ICU.
Line 630 
Line 638 
     }     }
  
     delete [] destbuf;     delete [] destbuf;
 #else      }
       else
   #endif
       {
     for (Char16* p = &_rep->c16a[0]; *p; p++)     for (Char16* p = &_rep->c16a[0]; *p; p++)
     {     {
             if (*p <= PEGASUS_MAX_PRINTABLE_CHAR)             if (*p <= PEGASUS_MAX_PRINTABLE_CHAR)
                 *p = toupper(*p);                 *p = toupper(*p);
     }     }
 #endif      }
 } }
  
 int String::compare(const String& s1, const String& s2, Uint32 n) int String::compare(const String& s1, const String& s2, Uint32 n)
Line 679 
Line 690 
 int String::compareNoCase(const String& s1, const String& s2) int String::compareNoCase(const String& s1, const String& s2)
 { {
 #ifdef PEGASUS_HAS_ICU #ifdef PEGASUS_HAS_ICU
       if (InitializeICU::initICUSuccessful())
       {
     return  u_strcasecmp((const UChar*)s1.getChar16Data(),     return  u_strcasecmp((const UChar*)s1.getChar16Data(),
                           (const UChar*)s2.getChar16Data(),                           (const UChar*)s2.getChar16Data(),
                           U_FOLD_CASE_DEFAULT);                           U_FOLD_CASE_DEFAULT);
 #else      }
   #endif
     const Char16* _s1 = s1.getChar16Data();     const Char16* _s1 = s1.getChar16Data();
     const Char16* _s2 = s2.getChar16Data();     const Char16* _s2 = s2.getChar16Data();
  
Line 710 
Line 724 
         return 1;         return 1;
  
     return 0;     return 0;
 #endif  
 } }
  
 Boolean String::equal(const String& str1, const String& str2) Boolean String::equal(const String& str1, const String& str2)
Line 980 
Line 993 
     os << utf8str;     os << utf8str;
  
 #elif defined(PEGASUS_HAS_ICU) #elif defined(PEGASUS_HAS_ICU)
       if (InitializeICU::initICUSuccessful())
       {
         char *buf = NULL;         char *buf = NULL;
         const int size = str.size() * 6;         const int size = str.size() * 6;
         UnicodeString UniStr((const UChar *)str.getChar16Data(), (int32_t)str.size());         UnicodeString UniStr((const UChar *)str.getChar16Data(), (int32_t)str.size());
Line 990 
Line 1005 
         os << buf;         os << buf;
         os.flush();         os.flush();
         delete [] buf;         delete [] buf;
 #else      }
       else
   #endif // End of PEGASUS_HAS_ICU #else leg.
       {
         for (Uint32 i = 0, n = str.size(); i < n; i++)         for (Uint32 i = 0, n = str.size(); i < n; i++)
         {         {
                 Uint16 code = str[i];                 Uint16 code = str[i];
Line 1007 
Line 1025 
                 os << buffer;                 os << buffer;
                 }                 }
         }         }
 #endif // End of PEGASUS_HAS_ICU #else leg.      }
  
     return os;     return os;
 } }


Legend:
Removed from v.1.107  
changed lines
  Added in v.1.108

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2