dbertoni    00/12/20 20:43:15

  Modified:    c/src/XPath QNameByReference.cpp QNameByReference.hpp
  Log:
  Changed references to pointers to allow assignment.
  
  Revision  Changes    Path
  1.2       +19 -6     xml-xalan/c/src/XPath/QNameByReference.cpp
  
  Index: QNameByReference.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/QNameByReference.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- QNameByReference.cpp      2000/11/27 19:46:27     1.1
  +++ QNameByReference.cpp      2000/12/21 04:43:14     1.2
  @@ -61,8 +61,8 @@
   
   QNameByReference::QNameByReference() :
        QName(),
  -     m_namespace(s_emptyString),
  -     m_localpart(s_emptyString)
  +     m_namespace(&s_emptyString),
  +     m_localpart(&s_emptyString)
   {
   }
   
  @@ -72,13 +72,22 @@
                        const XalanDOMString&   theNamespace,
                        const XalanDOMString&   theLocalPart) :
        QName(),
  -     m_namespace(theNamespace),
  -     m_localpart(theLocalPart)
  +     m_namespace(&theNamespace),
  +     m_localpart(&theLocalPart)
   {
   }
   
   
   
  +QNameByReference::QNameByReference(const QName&              theQName) :
  +     QName(),
  +     m_namespace(&theQName.getNamespace()),
  +     m_localpart(&theQName.getLocalPart())
  +{
  +}
  +
  +
  +
   QNameByReference::~QNameByReference()
   {
   }
  @@ -88,7 +97,9 @@
   const XalanDOMString&
   QNameByReference::getLocalPart() const
   {
  -     return m_localpart;
  +     assert(m_localpart != 0);
  +
  +     return *m_localpart;
   }
   
   
  @@ -96,5 +107,7 @@
   const XalanDOMString&
   QNameByReference::getNamespace() const
   {
  -     return m_namespace;
  +     assert(m_namespace != 0);
  +
  +     return *m_namespace;
   }
  
  
  
  1.2       +13 -2     xml-xalan/c/src/XPath/QNameByReference.hpp
  
  Index: QNameByReference.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/QNameByReference.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- QNameByReference.hpp      2000/11/27 19:46:27     1.1
  +++ QNameByReference.hpp      2000/12/21 04:43:14     1.2
  @@ -83,6 +83,7 @@
         * Construct a QNameByReference, with the supplied namespace and local 
part.
         * The instance keeps only a _reference_ to the string, to avoid making 
a
         * copy.
  +      *
         * @param theNamespace namespace string
         * @param theLocalPart local part string
         */
  @@ -90,6 +91,14 @@
                        const XalanDOMString&   theNamespace,
                        const XalanDOMString&   theLocalPart);
   
  +     /**
  +      * Construct a QNameByReference, from the supplied QName.  The instance
  +      * keeps only a _reference_ to the string, to avoid making a copy.
  +      *
  +      * @param theQName The source QName
  +      */
  +     QNameByReference(const QName&   theQName);
  +
        virtual
        ~QNameByReference();
   
  @@ -111,9 +120,11 @@
   
   private:
   
  -     const XalanDOMString&   m_namespace;
  +     // OK, we said reference, but using pointers
  +     // allows for copy and assignment semantics.
  +     const XalanDOMString*   m_namespace;
   
  -     const XalanDOMString&   m_localpart;
  +     const XalanDOMString*   m_localpart;
   };
   
   
  
  
  

Reply via email to