peiyongz 2002/11/05 09:42:40 Modified: c/src/xercesc/util XMLString.hpp Log: equals( const char* const, const char* const) Revision Changes Path 1.8 +37 -2 xml-xerces/c/src/xercesc/util/XMLString.hpp Index: XMLString.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLString.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- XMLString.hpp 4 Nov 2002 15:22:05 -0000 1.7 +++ XMLString.hpp 5 Nov 2002 17:42:39 -0000 1.8 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.8 2002/11/05 17:42:39 peiyongz + * equals( const char* const, const char* const) + * * Revision 1.7 2002/11/04 15:22:05 tng * C++ Namespace Support. * @@ -613,10 +616,16 @@ */ static bool equals ( - const XMLCh* const str1 + const XMLCh* const str1 , const XMLCh* const str2 ); + static bool equals + ( + const char* const str1 + , const char* const str2 + ); + /** Lexicographically compares <code>str1</code> and <code>str2</code> * regions and returns true if they are equal, otherwise false. * @@ -1460,11 +1469,37 @@ return true; } -inline bool XMLString::equals( const XMLCh* const str1 +inline bool XMLString::equals( const XMLCh* const str1 , const XMLCh* const str2) { const XMLCh* psz1 = str1; const XMLCh* psz2 = str2; + + if (psz1 == 0 || psz2 == 0) { + if ((psz1 != 0 && *psz1) || (psz2 != 0 && *psz2)) + return false; + else + return true; + } + + while (*psz1 == *psz2) + { + // If either has ended, then they both ended, so equal + if (!*psz1) + return true; + + // Move upwards for the next round + psz1++; + psz2++; + } + return false; +} + +inline bool XMLString::equals( const char* const str1 + , const char* const str2) +{ + const char* psz1 = str1; + const char* psz2 = str2; if (psz1 == 0 || psz2 == 0) { if ((psz1 != 0 && *psz1) || (psz2 != 0 && *psz2))
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]