(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.2 and 1.4

version 1.2, 2001/02/11 05:42:33 version 1.4, 2001/02/26 04:33:28
Line 23 
Line 23 
 // Author: // Author:
 // //
 // $Log$ // $Log$
   // Revision 1.4  2001/02/26 04:33:28  mike
   // Fixed many places where cim names were be compared with operator==(String,String).
   // Changed all of these to use CIMName::equal()
   //
   // Revision 1.3  2001/02/11 17:19:30  mike
   // added reverseFind() method
   //
 // Revision 1.2  2001/02/11 05:42:33  mike // Revision 1.2  2001/02/11 05:42:33  mike
 // new // new
 // //
Line 235 
Line 242 
         _rep.remove(pos, size);         _rep.remove(pos, size);
 } }
  
 Boolean operator==(const String& x, const String& y)  int String::compare(const Char16* s1, const Char16* s2, Uint32 n)
   {
       while (n--)
       {
           int r = *s1++ - *s2++;
   
           if (r)
               return r;
       }
   
       return 0;
   }
   
   Boolean String::equal(const String& x, const String& y)
 { {
     if (x.getLength() != y.getLength())     if (x.getLength() != y.getLength())
         return false;         return false;
Line 243 
Line 263 
     return String::compare(x.getData(), y.getData(), x.getLength()) == 0;     return String::compare(x.getData(), y.getData(), x.getLength()) == 0;
 } }
  
 Boolean operator==(const String& x, const Char16* y)  Boolean String::equal(const String& x, const Char16* y)
 { {
     if (x.getLength() != StrLen(y))     if (x.getLength() != StrLen(y))
         return false;         return false;
Line 251 
Line 271 
     return String::compare(x.getData(), y, x.getLength()) == 0;     return String::compare(x.getData(), y, x.getLength()) == 0;
 } }
  
 inline Boolean operator==(const Char16* x, const String& y)  Boolean String::equal(const Char16* x, const String& y)
 { {
     return operator==(y, x);      return equal(y, x);
 } }
  
 int String::compare(const Char16* s1, const Char16* s2, Uint32 n)  Boolean String::equal(const String& x, const char* y)
 {  
     while (n--)  
     {     {
         int r = *s1++ - *s2++;      return equal(x, String(y));
   
         if (r)  
             return r;  
     }     }
  
     return 0;  Boolean String::equal(const char* x, const String& y)
   {
       return equal(String(x), y);
 } }
  
   
 String String::subString(Uint32 pos, Uint32 length) const String String::subString(Uint32 pos, Uint32 length) const
 { {
     if (pos < getLength())     if (pos < getLength())
Line 295 
Line 313 
     return Uint32(-1);     return Uint32(-1);
 } }
  
   Uint32 String::reverseFind(Char16 c) const
   {
       const Char16* first = getData();
       const Char16* last = getData() + getLength();
   
       while (last != first)
       {
           if (*--last == c)
               return last - first;
       }
   
       return Uint32(-1);
   }
   
 int String::compare(const Char16* s1, const Char16* s2) int String::compare(const Char16* s1, const Char16* s2)
 { {
     while (*s1 && *s2)     while (*s1 && *s2)
Line 321 
Line 353 
     return os;     return os;
 } }
  
 Boolean operator==(const String& x, const char* y)  
 {  
     return operator==(x, String(y));  
 }  
   
 Boolean operator==(const char* x, const String& y)  
 {  
     return operator==(String(x), y);  
 }  
   
 void String::toLower(char* str) void String::toLower(char* str)
 { {
     while (*str)     while (*str)


Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2