(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.48 and 1.51

version 1.48, 2002/08/17 00:59:36 version 1.51, 2002/08/27 01:36:32
Line 235 
Line 235 
     return _rep->c16a.getData();     return _rep->c16a.getData();
 } }
  
 char* String::allocateCString(Uint32 extraBytes, Boolean noThrow) const  char* String::allocateCString(Uint32 extraBytes, Boolean& truncatedCharacters) const
 { {
       truncatedCharacters = false;
     Uint32 n = size() + 1;     Uint32 n = size() + 1;
     char* str = new char[n + extraBytes];     char* str = new char[n + extraBytes];
     char* p = str;     char* p = str;
Line 247 
Line 248 
         Uint16 c = *q++;         Uint16 c = *q++;
         *p++ = char(c);         *p++ = char(c);
  
         if ((c & 0xff00) && !noThrow)          if (c & 0xff00)
             throw TruncatedCharacter();              truncatedCharacters = true;
     }     }
  
     return str;     return str;
 } }
  
   char* String::allocateCString(Uint32 extraBytes) const
   {
       Boolean truncatedCharacters = false;
       return allocateCString(extraBytes, truncatedCharacters);
   }
   
 Char16& String::operator[](Uint32 i) Char16& String::operator[](Uint32 i)
 { {
     if (i > size())     if (i > size())
         throw OutOfBounds();          throw IndexOutOfBoundsException();
  
     return _rep->c16a[i];     return _rep->c16a[i];
 } }
Line 265 
Line 272 
 const Char16 String::operator[](Uint32 i) const const Char16 String::operator[](Uint32 i) const
 { {
     if (i > size())     if (i > size())
         throw OutOfBounds();          throw IndexOutOfBoundsException();
  
     return _rep->c16a[i];     return _rep->c16a[i];
 } }
Line 312 
Line 319 
         size = this->size() - pos;         size = this->size() - pos;
  
     if (pos + size > this->size())     if (pos + size > this->size())
         throw OutOfBounds();          throw IndexOutOfBoundsException();
  
     if (size)     if (size)
         _rep->c16a.remove(pos, size);         _rep->c16a.remove(pos, size);
Line 450 
Line 457 
     return 0;     return 0;
 } }
  
 int String::compareNoCase(const char* s1, const char* s2, Uint32 n)  
 {  
     while (n--)  
     {  
         int r = tolower(*s1++) - tolower(*s2++);  
   
         if (r)  
             return r;  
     }  
   
     return 0;  
 }  
   
 int String::compareNoCase(const char* s1, const char* s2)  
 {  
     while (*s1 && *s2)  
     {  
         int r = tolower(*s1++) - tolower(*s2++);  
   
         if (r)  
             return r;  
     }  
   
     if (*s2)  
         return -1;  
     else if (*s1)  
         return 1;  
   
     return 0;  
 }  
   
 int String::compareNoCase(const String& s1, const String& s2) int String::compareNoCase(const String& s1, const String& s2)
 { {
     const Char16* _s1 = s1.getData();     const Char16* _s1 = s1.getData();
Line 707 
Line 683 
 PEGASUS_STD(ostream)& operator<<(PEGASUS_STD(ostream)& os, const String& str) PEGASUS_STD(ostream)& operator<<(PEGASUS_STD(ostream)& os, const String& str)
 { {
     for (Uint32 i = 0, n = str.size(); i < n; i++)     for (Uint32 i = 0, n = str.size(); i < n; i++)
         os << str[i];      {
           Uint16 code = str[i];
   
           if (code > 0 && code <= PEGASUS_MAX_PRINTABLE_CHAR)
           {
               os << char(code);
           }
           else
           {
               // Print in hex format:
               char buffer[8];
               sprintf(buffer, "\\x%04X", code);
               os << buffer;
           }
       }
  
     return os;     return os;
 } }


Legend:
Removed from v.1.48  
changed lines
  Added in v.1.51

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2