diff --git a/src/xercesc/util/XMLString.hpp b/src/xercesc/util/XMLString.hpp index 32e4da3a7c87d2d1c68dfa5770d15baa4bc14608..ce78cf8ea4a66b3add298c287390b781ae7898b3 100644 --- a/src/xercesc/util/XMLString.hpp +++ b/src/xercesc/util/XMLString.hpp @@ -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 @@ public: */ 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,7 +1469,7 @@ inline bool XMLString::validateRegion(const XMLCh* const str1, 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; @@ -1486,6 +1495,32 @@ inline bool XMLString::equals( const XMLCh* const str1 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)) + 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; +} + XERCES_CPP_NAMESPACE_END #endif