You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sh...@apache.org on 2012/09/28 22:03:37 UTC

svn commit: r1391625 - /xalan/c/branches/GSoC-2012/src/xalanc/PlatformSupport/XalanLocator.hpp

Author: shathaway
Date: Fri Sep 28 20:03:37 2012
New Revision: 1391625

URL: http://svn.apache.org/viewvc?rev=1391625&view=rev
Log:
Update branch/GSoC-2012/src

Modified:
    xalan/c/branches/GSoC-2012/src/xalanc/PlatformSupport/XalanLocator.hpp

Modified: xalan/c/branches/GSoC-2012/src/xalanc/PlatformSupport/XalanLocator.hpp
URL: http://svn.apache.org/viewvc/xalan/c/branches/GSoC-2012/src/xalanc/PlatformSupport/XalanLocator.hpp?rev=1391625&r1=1391624&r2=1391625&view=diff
==============================================================================
--- xalan/c/branches/GSoC-2012/src/xalanc/PlatformSupport/XalanLocator.hpp (original)
+++ xalan/c/branches/GSoC-2012/src/xalanc/PlatformSupport/XalanLocator.hpp Fri Sep 28 20:03:37 2012
@@ -64,28 +64,48 @@ public:
     virtual XalanFileLoc
     getColumnNumber() const = 0;
 
+    /**
+     * Get the public identifier from a locator object.
+     * @param theLocator  A locator object inherited from Xerces.
+     * @param theAlternateId  A default name for a public identifier.
+     * @return a null terminated XalanDOMChar string.
+     */
     static const XalanDOMChar*
     getPublicId(
             const Locator*          theLocator,
-            const XalanDOMChar*     theAlternateId = 0)
+            const XalanDOMChar*     theAlternateId = getEmptyPtr())
     {
-        return theLocator == 0 ? theAlternateId : theLocator->getPublicId();
+        return theLocator == 0 ? theAlternateId : (theLocator->getPublicId() ?
+            theLocator->getPublicId() : theAlternateId);
     }
 
+    /**
+     * Get the system identifier from a locator object.
+     * @param theLocator  A locator object inherited from Xerces.
+     * @param theAlternateId  A default name for a public identifier.
+     * @return a null terminated XalanDOMChar string.
+     */
     static const XalanDOMChar*
     getSystemId(
             const Locator*          theLocator,
-            const XalanDOMChar*     theAlternateId = 0)
+            const XalanDOMChar*     theAlternateId = getEmptyPtr())
     {
-        return theLocator == 0 ? theAlternateId : theLocator->getSystemId();
+        return theLocator == 0 ? theAlternateId : (theLocator->getSystemId() ?
+            theLocator->getPublicId() : theAlternateId);
     }
 
+    /**
+     * Get the line number from a locator object.
+     */
     static XalanFileLoc
     getLineNumber(const ParentType*     theLocator)
     {
         return theLocator == 0 ? getUnknownValue() : theLocator->getLineNumber();
     }
 
+    /**
+     * Get the column number from a locator object.
+     */
     static XalanFileLoc
     getColumnNumber(const ParentType*   theLocator)
     {
@@ -120,11 +140,24 @@ private:
     // Not defined...
     XalanLocator(const XalanLocator&);
 
-    XalanLocator&
+    XalanLocator& 
     operator=(const XalanLocator&);
-};
-
 
+    /**
+     * Return static pointer to null XalanDOMChar.
+     * This is crafted to overcome issues with compilers/linkers that
+     * have problems initializing static integer members within a class.
+     *
+     * Replaces:    static const int s_zero = 0;
+     * Reference:   &s_zero;
+     */
+    static const XalanDOMChar * getEmptyPtr()
+    {
+        static const XalanDOMChar theZero = 0;
+        static const XalanDOMChar * theEmpty = &theZero;
+        return theEmpty;
+    }
+};
 
 XALAN_CPP_NAMESPACE_END
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org