[ http://nagoya.apache.org/jira/browse/XERCESC-392?page=history ]
     
Alberto Massari closed XERCESC-392:
-----------------------------------


From: "Jim Van Sciver" <[EMAIL PROTECTED]>
To: "'Alberto Massari \(JIRA\)'" <[EMAIL PROTECTED]>
Subject: RE: [jira] Resolved: (XERCESC-392) Would like DOMString::operator< for 
STL use, code provided

Looks good.  Thank you.

> Would like DOMString::operator< for STL use, code provided
> ----------------------------------------------------------
>
>          Key: XERCESC-392
>          URL: http://nagoya.apache.org/jira/browse/XERCESC-392
>      Project: Xerces-C++
>         Type: Bug
>   Components: DOM
>     Versions: 1.7.0
>  Environment: Operating System: All
> Platform: All
>     Reporter: Jim Van Sciver

>
> You cannot store DOMStrings in STL sorted containers unless they provide
> an operator<() method.  I've added such a method to my local copy of
> Xerces and would like to see it added to the distribution.  Code follows
> in the form of context diff output of dom/DOMString.hpp and dom/DOMString.cpp.
> ===============================================================================
> % diff -c DOMString.hpp.~1~ DOMString.hpp
> *** DOMString.hpp.~1~   Thu Mar 21 14:29:03 2002
> --- DOMString.hpp       Mon Mar 25 09:19:56 2002
> ***************
> *** 454,459 ****
> --- 454,473 ----
>       int         compareString(const DOMString &other) const;
>   
>       /**
> +       * Less than operator.
> +       *
> +       * @param other The object to be compared with.
> +       * @return True if this DOMString is lexically less than the argument
> +       *  DOMString.
> +       *  <p>
> +       * This code simply calls compareString and returns true if it returns
> +       * -1 and false otherwise.  While this method may seem redundant, it
> +       * is required if the DOMString is to be stored in one of the STL
> +       * sorted containers.
> +       */
> +     bool        operator < (const DOMString &other) const;
> + 
> +     /**
>         * Tells if a <code>DOMString</code> contains the same character data
>         * as another.
>         *
> ===============================================================================
> % diff -c DOMString.cpp.~1~ DOMString.cpp
> *** DOMString.cpp.~1~   Thu Mar 21 14:29:35 2002
> --- DOMString.cpp       Mon Mar 25 09:25:44 2002
> ***************
> *** 1158,1163 ****
> --- 1158,1169 ----
>   };
>   
>   
> + bool DOMString::operator < (const DOMString &other) const
> + {
> +     return (compareString(other) < 0);
> + }
> + 
> + 
>   DOMString DOMString::substringData(unsigned int offset, unsigned int count) 
> const
>   {
>       if (count == 0)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to