You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2005/12/16 20:44:38 UTC
svn commit: r357214 - in /xalan/c/trunk/src/xalanc/XPath: XalanQName.cpp
XalanQName.hpp XalanQNameByValue.cpp
Author: dbertoni
Date: Fri Dec 16 11:44:34 2005
New Revision: 357214
URL: http://svn.apache.org/viewcvs?rev=357214&view=rev
Log:
Fixes for XALANC-592.
Modified:
xalan/c/trunk/src/xalanc/XPath/XalanQName.cpp
xalan/c/trunk/src/xalanc/XPath/XalanQName.hpp
xalan/c/trunk/src/xalanc/XPath/XalanQNameByValue.cpp
Modified: xalan/c/trunk/src/xalanc/XPath/XalanQName.cpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/XPath/XalanQName.cpp?rev=357214&r1=357213&r2=357214&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XalanQName.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XalanQName.cpp Fri Dec 16 11:44:34 2005
@@ -403,7 +403,12 @@
int theLineNumber,
int theColumnNumber,
XalanDOMString& theResult) :
-XSLException(format(theQName, theQNameLength,theResult), theURI, theLineNumber, theColumnNumber, theResult.getMemoryManager())
+ XSLException(
+ format(theQName, theQNameLength, theResult),
+ theURI,
+ theLineNumber,
+ theColumnNumber,
+ theResult.getMemoryManager())
{
}
@@ -414,7 +419,10 @@
const XalanDOMChar* theQName,
XalanDOMString::size_type theQNameLength,
XalanDOMString& theResult) :
- XSLException(theLocator, format(theQName, theQNameLength, theResult), theResult.getMemoryManager())
+ XSLException(
+ theLocator,
+ format(theQName, theQNameLength, theResult),
+ theResult.getMemoryManager())
{
}
@@ -424,7 +432,33 @@
const XalanDOMChar* theQName,
XalanDOMString::size_type theQNameLength,
XalanDOMString& theResult) :
- XSLException(format(theQName, theQNameLength, theResult), theResult.getMemoryManager())
+ XSLException(
+ format(theQName, theQNameLength, theResult),
+ theResult.getMemoryManager())
+{
+}
+
+
+
+XalanQName::InvalidQNameException::InvalidQNameException(
+ const XalanDOMString& theMessage,
+ MemoryManager& theManager) :
+ XSLException(
+ theMessage,
+ theManager)
+{
+}
+
+
+
+XalanQName::InvalidQNameException::InvalidQNameException(
+ const Locator& theLocator,
+ const XalanDOMString& theMessage,
+ MemoryManager& theManager) :
+ XSLException(
+ theLocator,
+ theMessage,
+ theManager)
{
}
@@ -442,11 +476,14 @@
XalanDOMString::size_type theQNameLength,
XalanDOMString& theResult )
{
- theResult.append(theQName, theQNameLength);
+ XalanDOMString theParameter(theResult.getMemoryManager());
+
+ theParameter.append(theQName, theQNameLength);
return XalanMessageLoader::getMessage(
theResult,
- XalanMessages::IsNotValidQName_1Param);
+ XalanMessages::IsNotValidQName_1Param,
+ theParameter);
}
Modified: xalan/c/trunk/src/xalanc/XPath/XalanQName.hpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/XPath/XalanQName.hpp?rev=357214&r1=357213&r2=357214&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XalanQName.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XalanQName.hpp Fri Dec 16 11:44:34 2005
@@ -69,388 +69,410 @@
{
public:
- typedef XalanDeque<NameSpace, ConstructWithMemoryManagerTraits<NameSpace> >
- NamespaceVectorType;
- typedef XalanDeque<NamespaceVectorType, ConstructWithMemoryManagerTraits<NamespaceVectorType> >
- NamespacesStackType;
-
- /**
- * Construct an empty XalanQName.
- *
- */
- explicit
- XalanQName()
- {
- }
-
- virtual
- ~XalanQName()
- {
- }
-
- /**
- * Retrieve the local part of qualified name.
- *
- * @return local part string
- */
- virtual const XalanDOMString&
- getLocalPart() const = 0;
-
- /**
- * Retrieve the namespace of qualified name.
- *
- * @return namespace string
- */
- virtual const XalanDOMString&
- getNamespace() const = 0;
-
- /**
- * Determine if the qualified name is valid.
- *
- * @return true if the instance is a valid QName, false if not.
- */
- bool
- isValid() const
- {
- return isValidNCName(getLocalPart());
- }
-
- /**
- * Whether the qualified name is empty.
- *
- * @return true if namespace and local part are both empty
- */
- bool
- isEmpty() const
- {
- return getNamespace().empty() && getLocalPart().empty();
- }
-
- /**
- * Override equals and agree that we're equal if the passed object is a
- * string and it matches the name of the arg.
- *
- * @param theRHS namespace to compare
- * @return true if namespace and local part are both empty
- */
- bool
- equals(const XalanQName& theRHS) const
- {
- // Note that we do not use our member variables here. See
- // class QNameReference for details...
- return getLocalPart() == theRHS.getLocalPart() &&
- getNamespace() == theRHS.getNamespace();
- }
-
- XalanDOMString::size_type
- hash() const
- {
- return getLocalPart().hash() % (getNamespace().hash() + 1);
- }
-
- class XALAN_XPATH_EXPORT PrefixResolverProxy : public PrefixResolver
- {
- public:
-
- /**
- * Construct a PrefixResolver from a NamespacesStackType
- * instance.
- *
- * @param theStack The stack to use for prefix resolution
- * @param theURI The namespace URI of the resolver, if any. Only a reference is kept, so this cannot be a temporary
- * @return pointer to the string value if found, otherwise 0.
- */
- PrefixResolverProxy(
- const NamespacesStackType& theStack,
- const XalanDOMString& theURI);
-
- virtual
- ~PrefixResolverProxy();
-
- virtual const XalanDOMString*
- getNamespaceForPrefix(const XalanDOMString& prefix) const;
-
- virtual const XalanDOMString&
- getURI() const;
-
- private:
-
- const NamespacesStackType& m_stack;
-
- const XalanDOMString& m_uri;
- };
-
- /**
- * Get the namespace for a prefix by searching a vector of namespaces.
- *
- * @param namespaces vector of namespaces to search
- * @param prefix namespace prefix to find
- * @return pointer to the string value if found, otherwise null.
- */
- static const XalanDOMString*
- getNamespaceForPrefix(
- const NamespaceVectorType& namespaces,
- const XalanDOMString& prefix);
-
- /**
- * Get the namespace for a prefix by searching a stack of namespace
- * vectors.
- *
- * @param nsStack stack of namespace vectors to search
- * @param prefix namespace prefix to find
- * @return pointer to the string value if found, otherwise null.
- */
- static const XalanDOMString*
- getNamespaceForPrefix(
- const NamespacesStackType& nsStack,
- const XalanDOMString& prefix);
+ typedef XalanDeque<NameSpace, ConstructWithMemoryManagerTraits<NameSpace> >
+ NamespaceVectorType;
+ typedef XalanDeque<NamespaceVectorType, ConstructWithMemoryManagerTraits<NamespaceVectorType> >
+ NamespacesStackType;
+
+ /**
+ * Construct an empty XalanQName.
+ *
+ */
+ explicit
+ XalanQName()
+ {
+ }
+
+ virtual
+ ~XalanQName()
+ {
+ }
+
+ /**
+ * Retrieve the local part of qualified name.
+ *
+ * @return local part string
+ */
+ virtual const XalanDOMString&
+ getLocalPart() const = 0;
+
+ /**
+ * Retrieve the namespace of qualified name.
+ *
+ * @return namespace string
+ */
+ virtual const XalanDOMString&
+ getNamespace() const = 0;
+
+ /**
+ * Determine if the qualified name is valid.
+ *
+ * @return true if the instance is a valid QName, false if not.
+ */
+ bool
+ isValid() const
+ {
+ return isValidNCName(getLocalPart());
+ }
+
+ /**
+ * Whether the qualified name is empty.
+ *
+ * @return true if namespace and local part are both empty
+ */
+ bool
+ isEmpty() const
+ {
+ return getNamespace().empty() && getLocalPart().empty();
+ }
+
+ /**
+ * Override equals and agree that we're equal if the passed object is a
+ * string and it matches the name of the arg.
+ *
+ * @param theRHS namespace to compare
+ * @return true if namespace and local part are both empty
+ */
+ bool
+ equals(const XalanQName& theRHS) const
+ {
+ // Note that we do not use our member variables here. See
+ // class QNameReference for details...
+ return getLocalPart() == theRHS.getLocalPart() &&
+ getNamespace() == theRHS.getNamespace();
+ }
+
+ XalanDOMString::size_type
+ hash() const
+ {
+ return getLocalPart().hash() % (getNamespace().hash() + 1);
+ }
+
+ class XALAN_XPATH_EXPORT PrefixResolverProxy : public PrefixResolver
+ {
+ public:
+
+ /**
+ * Construct a PrefixResolver from a NamespacesStackType
+ * instance.
+ *
+ * @param theStack The stack to use for prefix resolution
+ * @param theURI The namespace URI of the resolver, if any. Only a reference is kept, so this cannot be a temporary
+ * @return pointer to the string value if found, otherwise 0.
+ */
+ PrefixResolverProxy(
+ const NamespacesStackType& theStack,
+ const XalanDOMString& theURI);
+
+ virtual
+ ~PrefixResolverProxy();
+
+ virtual const XalanDOMString*
+ getNamespaceForPrefix(const XalanDOMString& prefix) const;
+
+ virtual const XalanDOMString&
+ getURI() const;
+
+ private:
+
+ const NamespacesStackType& m_stack;
+
+ const XalanDOMString& m_uri;
+ };
+
+ /**
+ * Get the namespace for a prefix by searching a vector of namespaces.
+ *
+ * @param namespaces vector of namespaces to search
+ * @param prefix namespace prefix to find
+ * @return pointer to the string value if found, otherwise null.
+ */
+ static const XalanDOMString*
+ getNamespaceForPrefix(
+ const NamespaceVectorType& namespaces,
+ const XalanDOMString& prefix);
+
+ /**
+ * Get the namespace for a prefix by searching a stack of namespace
+ * vectors.
+ *
+ * @param nsStack stack of namespace vectors to search
+ * @param prefix namespace prefix to find
+ * @return pointer to the string value if found, otherwise null.
+ */
+ static const XalanDOMString*
+ getNamespaceForPrefix(
+ const NamespacesStackType& nsStack,
+ const XalanDOMString& prefix);
+
+ static const XalanDOMString*
+ getNamespaceForPrefix(
+ const NamespacesStackType& nsStack,
+ const XalanDOMChar* prefix);
+ /**
+ * Get the namespace for a prefix by searching a range of iterators.
+ * The search is done in reverse, from the end of the range to the
+ * beginning.
+ *
+ * @param theBegin The beginning iterator for the range
+ * @param theBegin The ending iterator for the range
+ * @param prefix namespace prefix to find
+ * @return pointer to the string value if found, otherwise null.
+ */
+ static const XalanDOMString*
+ getNamespaceForPrefix(
+ NamespacesStackType::const_iterator theBegin,
+ NamespacesStackType::const_iterator theEnd,
+ const XalanDOMString& prefix);
+
+ /**
+ * Get the prefix for a namespace by searching a vector of namespaces.
+ *
+ * @param namespaces vector of namespaces to search
+ * @param uri URI string for namespace to find
+ * @param reverse true to search vector from last to first, default true
+ * @return pointer to the string value if found, otherwise null.
+ */
static const XalanDOMString*
- getNamespaceForPrefix(
- const NamespacesStackType& nsStack,
- const XalanDOMChar* prefix);
-
- /**
- * Get the namespace for a prefix by searching a range of iterators.
- * The search is done in reverse, from the end of the range to the
- * beginning.
- *
- * @param theBegin The beginning iterator for the range
- * @param theBegin The ending iterator for the range
- * @param prefix namespace prefix to find
- * @return pointer to the string value if found, otherwise null.
- */
- static const XalanDOMString*
- getNamespaceForPrefix(
- NamespacesStackType::const_iterator theBegin,
- NamespacesStackType::const_iterator theEnd,
- const XalanDOMString& prefix);
-
- /**
- * Get the prefix for a namespace by searching a vector of namespaces.
- *
- * @param namespaces vector of namespaces to search
- * @param uri URI string for namespace to find
- * @param reverse true to search vector from last to first, default true
- * @return pointer to the string value if found, otherwise null.
- */
- static const XalanDOMString*
- getPrefixForNamespace(
- const NamespaceVectorType& namespaces,
- const XalanDOMString& uri);
+ getPrefixForNamespace(
+ const NamespaceVectorType& namespaces,
+ const XalanDOMString& uri);
static const XalanDOMString*
getNamespaceForPrefix(
- const NamespaceVectorType& namespaces,
- const XalanDOMChar* prefix);
+ const NamespaceVectorType& namespaces,
+ const XalanDOMChar* prefix);
- /**
- * Get the prefix for a namespace by searching a stack of namespace
- * vectors.
- *
- * @param nsStack stack of namespace vectors to search
- * @param uri URI string for namespace to find
- * @return pointer to the string value if found, otherwise null.
- */
- static const XalanDOMString*
- getPrefixForNamespace(
- const NamespacesStackType& nsStack,
- const XalanDOMString& uri);
-
- /**
- * Get the prefix for a namespace by searching a range of iterators.
- * The search is done in reverse, from the end of the range to the
- * beginning.
- *
- * @param theBegin The beginning iterator for the range to search
- * @param theBegin The ending iterator for the range to search
- * @param uri URI string for namespace to find
- * @return pointer to the string value if found, otherwise null.
- */
- static const XalanDOMString*
- getPrefixForNamespace(
- NamespacesStackType::const_iterator theBegin,
- NamespacesStackType::const_iterator theEnd,
- const XalanDOMString& uri);
+ /**
+ * Get the prefix for a namespace by searching a stack of namespace
+ * vectors.
+ *
+ * @param nsStack stack of namespace vectors to search
+ * @param uri URI string for namespace to find
+ * @return pointer to the string value if found, otherwise null.
+ */
+ static const XalanDOMString*
+ getPrefixForNamespace(
+ const NamespacesStackType& nsStack,
+ const XalanDOMString& uri);
+
+ /**
+ * Get the prefix for a namespace by searching a range of iterators.
+ * The search is done in reverse, from the end of the range to the
+ * beginning.
+ *
+ * @param theBegin The beginning iterator for the range to search
+ * @param theBegin The ending iterator for the range to search
+ * @param uri URI string for namespace to find
+ * @return pointer to the string value if found, otherwise null.
+ */
+ static const XalanDOMString*
+ getPrefixForNamespace(
+ NamespacesStackType::const_iterator theBegin,
+ NamespacesStackType::const_iterator theEnd,
+ const XalanDOMString& uri);
static const XalanDOMString*
getNamespaceForPrefix(
- NamespacesStackType::const_iterator theBegin,
- NamespacesStackType::const_iterator theEnd,
- const XalanDOMChar* prefix);
- /**
- * Determine if the string supplied satisfies the grammar for
- * an XML NCName.
- *
- * @param theNCName The string to check
- * @return bool true if the string is a valid NCName, false if not.
- */
- static bool
- isValidNCName(const XalanDOMString& theNCName);
-
- /**
- * Determine if the string supplied satisfies the grammar for
- * an XML NCName.
- *
- * @param theNCName The string to check
- * @param theLength The length of the string
- * @return bool true if the string is a valid NCName, false if not
- */
- static bool
- isValidNCName(
- const XalanDOMChar* theNCName,
- XalanDOMString::size_type theLength = XalanDOMString::npos);
-
- /**
- * Determine if the string supplied satisfies the grammar for
- * an XML QName. Note that this function does not determine
- * if any supplied prefix is bound to a namespace URI
- *
- * @param theQName The string to check
- * @return bool true if the string is a valid QName, false if not
- */
- static bool
- isValidQName(const XalanDOMString& theQName);
-
- /**
- * Determine if the string supplied satisfies the grammar for
- * an XML QName. Note that this function does not determine
- * if any supplied prefix is bound to a namespace URI
- *
- * @param theQName The string to check
- * @param theLength The length of the string
- * @return bool true if the string is a valid QName, false if not
- */
- static bool
- isValidQName(
- const XalanDOMChar* theQName,
- XalanDOMString::size_type theLength = XalanDOMString::npos);
-
- class InvalidQNameException : public XSLException
- {
- public:
-
- /**
- * Constructor
- *
- * @param theQName The QName string that is not valid.
- * @param theQNameLength The length of the string.
- * @param theURI the URI of the related document, if known
- * @param theLineNumber the line number of the related document.
- * @param theColumnNumber the column number of the related document.
- * @param theType type of exception, default is "XSLException"
- */
- InvalidQNameException(
- const XalanDOMChar* theQName,
- XalanDOMString::size_type theQNameLength,
- const XalanDOMString& theURI,
- int theLineNumber,
- int theColumnNumber,
- XalanDOMString& theResult);
-
- /**
- * Constructor
- *
- * @param theLocator The locator instance for error reporting.
- * @param theQName The QName string that is not valid.
- * @param theQNameLength The length of the string.
- * @param theType type of exception, default is "XSLException"
- */
- InvalidQNameException(
- const LocatorType& theLocator,
- const XalanDOMChar* theQName,
- XalanDOMString::size_type theQNameLength,
- XalanDOMString& theResult);
-
- /**
- * Constructor
- *
- * @param theQName The QName string that is not valid.
- * @param theQNameLength The length of the string.
- * @param theType type of exception, default is "XSLException"
- */
- InvalidQNameException(
- const XalanDOMChar* theQName,
- XalanDOMString::size_type theQNameLength,
- XalanDOMString& theResult);
-
- virtual
- ~InvalidQNameException();
-
- virtual const XalanDOMChar*
- getType() const
- {
- return m_type;
- }
-
- private:
-
- static const XalanDOMChar m_type[];
-
- static const XalanDOMString&
- format(
- const XalanDOMChar* theQName,
- XalanDOMString::size_type theQNameLength,
- XalanDOMString& theResult);
- };
+ NamespacesStackType::const_iterator theBegin,
+ NamespacesStackType::const_iterator theEnd,
+ const XalanDOMChar* prefix);
+ /**
+ * Determine if the string supplied satisfies the grammar for
+ * an XML NCName.
+ *
+ * @param theNCName The string to check
+ * @return bool true if the string is a valid NCName, false if not.
+ */
+ static bool
+ isValidNCName(const XalanDOMString& theNCName);
+
+ /**
+ * Determine if the string supplied satisfies the grammar for
+ * an XML NCName.
+ *
+ * @param theNCName The string to check
+ * @param theLength The length of the string
+ * @return bool true if the string is a valid NCName, false if not
+ */
+ static bool
+ isValidNCName(
+ const XalanDOMChar* theNCName,
+ XalanDOMString::size_type theLength = XalanDOMString::npos);
+
+ /**
+ * Determine if the string supplied satisfies the grammar for
+ * an XML QName. Note that this function does not determine
+ * if any supplied prefix is bound to a namespace URI
+ *
+ * @param theQName The string to check
+ * @return bool true if the string is a valid QName, false if not
+ */
+ static bool
+ isValidQName(const XalanDOMString& theQName);
+
+ /**
+ * Determine if the string supplied satisfies the grammar for
+ * an XML QName. Note that this function does not determine
+ * if any supplied prefix is bound to a namespace URI
+ *
+ * @param theQName The string to check
+ * @param theLength The length of the string
+ * @return bool true if the string is a valid QName, false if not
+ */
+ static bool
+ isValidQName(
+ const XalanDOMChar* theQName,
+ XalanDOMString::size_type theLength = XalanDOMString::npos);
+
+ class InvalidQNameException : public XSLException
+ {
+ public:
+
+ /**
+ * Constructor
+ *
+ * @param theQName The QName string that is not valid.
+ * @param theQNameLength The length of the string.
+ * @param theURI the URI of the related document, if known
+ * @param theLineNumber the line number of the related document.
+ * @param theColumnNumber the column number of the related document.
+ * @param theResult A temporary string for loading the error message.
+ */
+ InvalidQNameException(
+ const XalanDOMChar* theQName,
+ XalanDOMString::size_type theQNameLength,
+ const XalanDOMString& theURI,
+ int theLineNumber,
+ int theColumnNumber,
+ XalanDOMString& theResult);
+
+ /**
+ * Constructor
+ *
+ * @param theLocator The locator instance for error reporting.
+ * @param theQName The QName string that is not valid.
+ * @param theQNameLength The length of the string.
+ * @param theResult A temporary string for loading the error message.
+ */
+ InvalidQNameException(
+ const LocatorType& theLocator,
+ const XalanDOMChar* theQName,
+ XalanDOMString::size_type theQNameLength,
+ XalanDOMString& theResult);
+
+ /**
+ * Constructor
+ *
+ * @param theQName The QName string that is not valid.
+ * @param theQNameLength The length of the string.
+ * @param theResult A temporary string for loading the error message.
+ */
+ InvalidQNameException(
+ const XalanDOMChar* theQName,
+ XalanDOMString::size_type theQNameLength,
+ XalanDOMString& theResult);
+
+ /**
+ * Constructor
+ *
+ * @param theMessage The message for the exception
+ * @param theManager The MemoryManager instance to use when constructing the exception
+ */
+ InvalidQNameException(
+ const XalanDOMString& theMessage,
+ MemoryManager& theManager);
+
+ /**
+ * Constructor
+ *
+ * @param theLocator The Locator to use when constructing the exception.
+ * @param theMessage The message for the exception
+ * @param theManager The MemoryManager instance to use when constructing the exception
+ */
+ InvalidQNameException(
+ const Locator& theLocator,
+ const XalanDOMString& theMessage,
+ MemoryManager& theManager);
+
+ virtual
+ ~InvalidQNameException();
+
+ virtual const XalanDOMChar*
+ getType() const
+ {
+ return m_type;
+ }
+
+ private:
+
+ static const XalanDOMChar m_type[];
+
+ static const XalanDOMString&
+ format(
+ const XalanDOMChar* theQName,
+ XalanDOMString::size_type theQNameLength,
+ XalanDOMString& theResult);
+ };
protected:
- static const XalanDOMString s_emptyString;
+ static const XalanDOMString s_emptyString;
};
inline bool
operator==(
- const XalanQName& theLHS,
- const XalanQName& theRHS)
+ const XalanQName& theLHS,
+ const XalanQName& theRHS)
{
- return theLHS.equals(theRHS);
+ return theLHS.equals(theRHS);
}
inline bool
operator!=(
- const XalanQName& theLHS,
- const XalanQName& theRHS)
+ const XalanQName& theLHS,
+ const XalanQName& theRHS)
{
- return !(theLHS == theRHS);
+ return !(theLHS == theRHS);
}
inline bool
operator<(
- const XalanQName& theLHS,
- const XalanQName& theRHS)
+ const XalanQName& theLHS,
+ const XalanQName& theRHS)
{
- if (theLHS.getNamespace() < theRHS.getNamespace())
- {
- return true;
- }
- else if (equals(theLHS.getNamespace(), theRHS.getNamespace()))
- {
- return theLHS.getLocalPart() < theRHS.getLocalPart();
- }
- else
- {
- return false;
- }
+ if (theLHS.getNamespace() < theRHS.getNamespace())
+ {
+ return true;
+ }
+ else if (equals(theLHS.getNamespace(), theRHS.getNamespace()))
+ {
+ return theLHS.getLocalPart() < theRHS.getLocalPart();
+ }
+ else
+ {
+ return false;
+ }
}
template<>
struct XalanMapKeyTraits<XalanQName>
{
- typedef XalanHashMemberReference<XalanQName> Hasher;
- typedef XALAN_STD_QUALIFIER equal_to<XalanQName> Comparator;
+ typedef XalanHashMemberReference<XalanQName> Hasher;
+ typedef XALAN_STD_QUALIFIER equal_to<XalanQName> Comparator;
};
template<>
struct XalanMapKeyTraits<const XalanQName*>
{
- typedef XalanHashMemberPointer<XalanQName> Hasher;
- typedef pointer_equal<XalanQName> Comparator;
+ typedef XalanHashMemberPointer<XalanQName> Hasher;
+ typedef pointer_equal<XalanQName> Comparator;
};
@@ -458,4 +480,4 @@
-#endif // XALANQNAME_HEADER_GUARD_1357924680
+#endif // XALANQNAME_HEADER_GUARD_1357924680
Modified: xalan/c/trunk/src/xalanc/XPath/XalanQNameByValue.cpp
URL: http://svn.apache.org/viewcvs/xalan/c/trunk/src/xalanc/XPath/XalanQNameByValue.cpp?rev=357214&r1=357213&r2=357214&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XalanQNameByValue.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XalanQNameByValue.cpp Fri Dec 16 11:44:34 2005
@@ -36,7 +36,7 @@
-XalanQNameByValue::XalanQNameByValue(MemoryManagerType& theManager) :
+XalanQNameByValue::XalanQNameByValue(MemoryManager& theManager) :
XalanQName(),
m_namespace(theManager),
m_localpart(theManager)
@@ -45,9 +45,10 @@
-XalanQNameByValue::XalanQNameByValue(const XalanQNameByValue& theSource,
- MemoryManagerType& theManager) :
- XalanQName(),
+XalanQNameByValue::XalanQNameByValue(
+ const XalanQNameByValue& theSource,
+ MemoryManager& theManager) :
+ XalanQName(theSource),
m_namespace(theSource.m_namespace, theManager),
m_localpart(theSource.m_localpart, theManager)
{
@@ -55,8 +56,9 @@
-XalanQNameByValue::XalanQNameByValue(const XalanQName& theSource,
- MemoryManagerType& theManager) :
+XalanQNameByValue::XalanQNameByValue(
+ const XalanQName& theSource,
+ MemoryManager& theManager) :
XalanQName(),
m_namespace(theSource.getNamespace(), theManager),
m_localpart(theSource.getLocalPart(), theManager)
@@ -68,18 +70,20 @@
XalanQNameByValue::XalanQNameByValue(
const XalanDOMString& theNamespace,
const XalanDOMString& theLocalPart,
- MemoryManagerType& theManager) :
+ MemoryManager& theManager) :
XalanQName(),
m_namespace(theNamespace, theManager),
m_localpart(theLocalPart, theManager)
{
}
+
+
XalanQNameByValue*
XalanQNameByValue::create(
const XalanDOMString& theNamespace,
const XalanDOMString& theLocalPart,
- MemoryManagerType& theManager)
+ MemoryManager& theManager)
{
typedef XalanQNameByValue ThisType;
@@ -98,12 +102,15 @@
return theResult;
}
+
+
XalanQNameByValue::XalanQNameByValue(
const XalanDOMString& qname,
const NamespacesStackType& namespaces,
- MemoryManagerType& theManager,
- const LocatorType* locator,
+ MemoryManager& theManager,
+ const Locator* locator,
bool fUseDefault) :
+ XalanQName(),
m_namespace(theManager),
m_localpart(theManager)
{
@@ -120,9 +127,10 @@
XalanQNameByValue::XalanQNameByValue(
const XalanDOMChar* qname,
const NamespacesStackType& namespaces,
- MemoryManagerType& theManager,
- const LocatorType* locator,
+ MemoryManager& theManager,
+ const Locator* locator,
bool fUseDefault) :
+ XalanQName(),
m_namespace(theManager),
m_localpart(theManager)
{
@@ -143,8 +151,9 @@
const XalanElement* namespaceContext,
const XPathEnvSupport& envSupport,
const DOMSupport& domSupport,
- MemoryManagerType& theManager,
- const LocatorType* locator) :
+ MemoryManager& theManager,
+ const Locator* locator) :
+ XalanQName(),
m_namespace(theManager),
m_localpart(theManager)
{
@@ -161,9 +170,10 @@
XalanQNameByValue::XalanQNameByValue(
const XalanDOMString& qname,
- MemoryManagerType& theManager,
+ MemoryManager& theManager,
const PrefixResolver* theResolver,
const LocatorType* locator) :
+ XalanQName(),
m_namespace(theManager),
m_localpart(theManager)
{
@@ -268,22 +278,62 @@
static void
throwException(
- const XalanDOMString& theMessage,
- const XalanQNameByValue::LocatorType* theLocator,
- XalanDOMString& theResult)
-{
+ MemoryManager& theMemoryManager,
+ XalanMessages::Codes theCode,
+ const XalanDOMString& theParameter,
+ const Locator* theLocator)
+{
+ XalanDOMString theMessage(theMemoryManager);
+
+ XalanMessageLoader::getMessage(
+ theMessage,
+ theCode,
+ theParameter);
+
if (theLocator == 0)
{
- throw XalanQName::InvalidQNameException(theMessage.c_str(), theMessage.length(), theResult);
+ throw XalanQName::InvalidQNameException(
+ theMessage,
+ theMemoryManager);
}
else
{
- throw XalanQName::InvalidQNameException(*theLocator,theMessage.c_str(), theMessage.length(), theResult);
+ throw XalanQName::InvalidQNameException(
+ *theLocator,
+ theMessage,
+ theMemoryManager);
}
}
+static void
+throwException(
+ MemoryManager& theMemoryManager,
+ const XalanDOMChar* theQName,
+ XalanDOMString::size_type theLength,
+ const Locator* theLocator)
+{
+ XalanDOMString theBuffer(theMemoryManager);
+
+ if (theLocator == 0)
+ {
+ throw XalanQName::InvalidQNameException(
+ theQName,
+ theLength,
+ theBuffer);
+ }
+ else
+ {
+ throw XalanQName::InvalidQNameException(
+ *theLocator,
+ theQName,
+ theLength,
+ theBuffer);
+ }
+}
+
+
void
XalanQNameByValue::initialize(
@@ -297,15 +347,11 @@
if (indexOfNSSep == 0)
{
- XalanDOMString msg(getMemoryManager());
-
- XalanMessageLoader::getMessage(
- msg,
- XalanMessages::PrefixOfLengthZeroDetected);
-
- XalanDOMString theBuffer(getMemoryManager());
-
- throwException(msg, locator, theBuffer);
+ throwException(
+ getMemoryManager(),
+ XalanMessages::PrefixOfLengthZeroDetected,
+ m_localpart, // This is a dummy parameter...
+ locator);
}
else if(indexOfNSSep < len)
{
@@ -332,19 +378,11 @@
if(theNamespace == 0 || 0 == length(*theNamespace))
{
- XalanDOMString msg(getMemoryManager());
-
- XalanDOMString theBuffer(getMemoryManager());
-
- XalanMessageLoader::getMessage(
- msg,
- XalanMessages::PrefixIsNotDeclared_1Param,
- m_localpart);
-
throwException(
- msg,
- locator,
- theBuffer);
+ getMemoryManager(),
+ XalanMessages::PrefixIsNotDeclared_1Param,
+ m_localpart,
+ locator);
}
else
{
@@ -390,15 +428,11 @@
if (indexOfNSSep == 0)
{
- XalanDOMString msg(getMemoryManager());
-
- XalanDOMString theBuffer(getMemoryManager());
-
- XalanMessageLoader::getMessage(
- msg,
- XalanMessages::PrefixOfLengthZeroDetected);
-
- throwException(msg, locator, theBuffer);
+ throwException(
+ getMemoryManager(),
+ XalanMessages::PrefixOfLengthZeroDetected,
+ m_localpart, // This is a dummy parameter...
+ locator);
}
else if(indexOfNSSep >= theLength)
{
@@ -426,16 +460,11 @@
}
else if (theResolver == 0)
{
- XalanDOMString msg(getMemoryManager());
-
- XalanDOMString theBuffer(getMemoryManager());
-
- XalanMessageLoader::getMessage(
- msg,
+ throwException(
+ getMemoryManager(),
XalanMessages::PrefixIsNotDeclared_1Param,
- m_localpart);
-
- throwException(msg, locator, theBuffer);
+ m_localpart,
+ locator);
}
else
{
@@ -450,20 +479,16 @@
if(0 == length(m_namespace))
{
- XalanDOMString msg(getMemoryManager());
-
- XalanDOMString theBuffer(getMemoryManager());
-
- XalanMessageLoader::getMessage(
- msg,
+ throwException(
+ getMemoryManager(),
XalanMessages::PrefixIsNotDeclared_1Param,
- m_localpart);
-
- throwException(msg,locator, theBuffer);
-
+ m_localpart,
+ locator);
}
- m_localpart.assign(qname + indexOfNSSep + 1, theLength - (indexOfNSSep + 1));
+ m_localpart.assign(
+ qname + indexOfNSSep + 1,
+ theLength - (indexOfNSSep + 1));
}
validate(qname, theLength, locator);
@@ -473,22 +498,17 @@
void
XalanQNameByValue::validate(
- const XalanDOMChar* qname,
+ const XalanDOMChar* theQName,
XalanDOMString::size_type theLength,
- const LocatorType* locator)
+ const Locator* theLocator)
{
if (isValid() == false)
{
- XalanDOMString theBuffer(getMemoryManager());
-
- if (locator != 0)
- {
- throw InvalidQNameException(*locator, qname, theLength, theBuffer);
- }
- else
- {
- throw InvalidQNameException(qname, theLength, theBuffer);
- }
+ throwException(
+ getMemoryManager(),
+ theQName,
+ theLength,
+ theLocator);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org