dbertoni 00/04/18 08:29:42
Modified: c/src/XSLT XSLTEngineImpl.cpp XSLTEngineImpl.hpp
Log:
Removed redundant typedef and fixed merge conflict.
Revision Changes Path
1.27 +92 -38 xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
Index: XSLTEngineImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- XSLTEngineImpl.cpp 2000/04/14 15:40:42 1.26
+++ XSLTEngineImpl.cpp 2000/04/18 15:29:40 1.27
@@ -126,12 +126,13 @@
#include "ElementMarker.hpp"
#include "FunctionCurrent.hpp"
#include "FunctionDocument.hpp"
+#include "FunctionElementAvailable.hpp"
+#include "FunctionFunctionAvailable.hpp"
#include "FunctionFormatNumber.hpp"
+#include "FunctionGenerateID.hpp"
#include "FunctionKey.hpp"
-#include "FunctionUnparsedEntityURI.hpp"
#include "FunctionSystemProperty.hpp"
-#include "FunctionGenerateID.hpp"
-#include "FunctionDocument.hpp"
+#include "FunctionUnparsedEntityURI.hpp"
#include "GenerateEvent.hpp"
#include "NodeSorter.hpp"
#include "ProblemListener.hpp"
@@ -523,7 +524,11 @@
{
try
{
- std::auto_ptr<XMLURL> url(getURLFromString(xsldocURLString));
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::auto_ptr;
+#endif
+
+ auto_ptr<XMLURL> url(getURLFromString(xsldocURLString));
assert(url.get() != 0);
XSLTInputSource input(url->getURLText(), 0);
@@ -884,8 +889,12 @@
addTraceListenersToStylesheet();
StylesheetHandler stylesheetProcessor(*this, *stylesheet,
constructionContext);
-
- std::auto_ptr<XMLURL>
xslURL(getURLFromString(localXSLURLString, xmlBaseIdent));
+
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::auto_ptr;
+#endif
+
+ auto_ptr<XMLURL>
xslURL(getURLFromString(localXSLURLString, xmlBaseIdent));
XSLTInputSource inputSource(xslURL->getURLText());
@@ -1079,7 +1088,7 @@
XPathExecutionContext& executionContext,
const XalanDOMString& theNamespace,
const XalanDOMString& extensionName,
- const std::vector<XObject*>& argVec) const
+ const XObjectArgVectorType& argVec) const
{
return m_xpathEnvSupport.extFunction( executionContext,
theNamespace, extensionName, argVec);
@@ -1254,8 +1263,11 @@
{
if(0 != key)
{
- m_durationsTable.insert(std::make_pair<const void* const,
-
clock_t>(key, clock()));
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::make_pair;
+#endif
+
+ m_durationsTable.insert(make_pair(key, clock()));
}
}
@@ -1544,8 +1556,8 @@
{
assert(length(value) > 0);
- const bool isPrefix = startsWith(aname,
XALAN_STATIC_UCODE_STRING("xmlns:"));
- if (equals(aname, XALAN_STATIC_UCODE_STRING("xmlns")) || isPrefix ==
true)
+ const bool isPrefix = startsWith(aname,
DOMServices::s_XMLNamespaceWithSeparator);
+ if (equals(aname, DOMServices::s_XMLNamespace) || isPrefix == true)
{
const XalanDOMString p = isPrefix == true ?
substring(aname, 6) : XalanDOMString();
addResultNamespaceDecl(p, value);
@@ -2032,8 +2044,12 @@
const QName& mode)
{
DocumentHandler* const savedFormatterListener = m_flistener;
+
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::auto_ptr;
+#endif
- std::auto_ptr<ResultTreeFragBase> pfrag(createDocFrag());
+ auto_ptr<ResultTreeFragBase> pfrag(createDocFrag());
FormatterToDOM tempFormatter(m_resultTreeFactory,
pfrag.get());
@@ -2173,7 +2189,7 @@
{
const XalanDOMString prefix = substring(elementName,
0, indexOfNSSep);
- if(equals(prefix, XALAN_STATIC_UCODE_STRING("xml")))
+ if(equals(prefix, DOMServices::s_XMLString))
{
elemNS = DOMServices::s_XMLNamespaceURI;
}
@@ -2217,7 +2233,7 @@
{
const XalanDOMString prefix = substring(elementName, 0,
indexOfNSSep);
- if(equals(prefix, XALAN_STATIC_UCODE_STRING("xml")))
+ if(equals(prefix, DOMServices::s_XMLString))
{
elemNS = DOMServices::s_XMLNamespaceURI;
}
@@ -2284,9 +2300,9 @@
const XalanDOMString aname =
attr->getNodeName();
- const bool
isPrefix = startsWith(aname, XALAN_STATIC_UCODE_STRING("xmlns:"));
+ const bool
isPrefix = startsWith(aname, DOMServices::s_XMLNamespaceWithSeparator);
- if (equals(aname,
XALAN_STATIC_UCODE_STRING("xmlns")) || isPrefix)
+ if (equals(aname, DOMServices::s_XMLNamespace)
|| isPrefix)
{
const unsigned int index =
indexOf(aname, ':');
assert(index < length(aname));
@@ -2337,9 +2353,9 @@
const XalanDOMString aname =
attr->getNodeName();
- const bool
isPrefix = startsWith(aname, XALAN_STATIC_UCODE_STRING("xmlns:"));
+ const bool
isPrefix = startsWith(aname, DOMServices::s_XMLNamespaceWithSeparator);
- if (equals(aname,
XALAN_STATIC_UCODE_STRING("xmlns")) || isPrefix)
+ if (equals(aname, DOMServices::s_XMLNamespace)
|| isPrefix)
{
const XalanDOMString prefix =
isPrefix ? substring(aname, 6) : XalanDOMString();
const XalanDOMString desturi =
getResultNamespaceForPrefix(prefix);
@@ -2746,7 +2762,7 @@
// TODO: Find out about empty attribute template expression handling.
if(0 != length(stringedValue))
{
- if((equals(attrName, XALAN_STATIC_UCODE_STRING("xmlns")) ||
startsWith(attrName, XALAN_STATIC_UCODE_STRING("xmlns:")))
+ if((equals(attrName, DOMServices::s_XMLNamespace) ||
startsWith(attrName, DOMServices::s_XMLNamespaceWithSeparator))
&& startsWith(stringedValue,
XALAN_STATIC_UCODE_STRING("quote:")))
{
stringedValue = substring(stringedValue, 6);
@@ -2804,10 +2820,14 @@
{
if(m_translateCSS == true)
{
- XalanDOMString styleAttrValueString;
- std::vector<const XMLCh*> toBeRemoved;
- int nAttributes = attList.getLength();
- for(int i = 0; i < nAttributes; i++)
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::vector;
+#endif
+
+ XalanDOMString styleAttrValueString;
+ vector<const XMLCh*> toBeRemoved;
+ const unsigned int nAttributes = attList.getLength();
+ for(unsigned int i = 0; i < nAttributes; i++)
{
const XMLCh* const attrName = attList.getName(i);
if(isCSSAttribute(attrName) == true)
@@ -2832,8 +2852,8 @@
}
}
}
- const int nAttrsToRemove = toBeRemoved.size();
- for(int j = 0; j < nAttrsToRemove; j++)
+ const unsigned int nAttrsToRemove = toBeRemoved.size();
+ for(unsigned int j = 0; j < nAttrsToRemove; j++)
{
attList.removeAttribute(toBeRemoved[j]);
}
@@ -3144,7 +3164,14 @@
bool
doublePunctuationSpaces)
{
const XMLCh* const theStringData = c_wstr(string);
- std::vector<XMLCh> buf(theStringData,
+
+#if defined(XALAN_NO_NAMESPACES)
+ typedef vector<XMLCh> XMLChVectorType;
+#else
+ typedef std::vector<XMLCh> XMLChVectorType;
+#endif
+
+ XMLChVectorType buf(theStringData,
theStringData +
length(string));
const int len = buf.size();
bool edit = false;
@@ -3203,7 +3230,7 @@
d --;
}
- std::vector<XMLCh>::const_iterator start = buf.begin();
+ XMLChVectorType::const_iterator start = buf.begin();
if (trimHead == true && 0 < d && ' ' == buf[0])
{
edit = true;
@@ -3240,7 +3267,11 @@
const int nSrcChars = src.length();
- std::vector<XMLCh> sb;
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::vector;
+#endif
+
+ vector<XMLCh> sb;
XMLCh prevChar = 0x00;
@@ -3738,7 +3769,11 @@
XMLURL*
XSLTEngineImpl::getURLFromString (const XalanDOMString& urlString) const
{
- std::auto_ptr<XMLURL> url(new XMLURL);
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::auto_ptr;
+#endif
+
+ auto_ptr<XMLURL> url(new XMLURL);
try
{
@@ -3985,10 +4020,16 @@
void
XSLTEngineImpl::VariableStack::reset()
{
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::for_each;
+#endif
+
// Delete all entries left on the stack
- std::for_each(m_stack.begin(),
- m_stack.end(),
- DeleteFunctor<StackEntry>());
+ // $$$ ToDo: Commented out because it's causing
+ // problems. Fix this!!!
+// for_each(m_stack.begin(),
+// m_stack.end(),
+// DeleteFunctor<StackEntry>());
m_stack.clear();
@@ -4165,6 +4206,13 @@
mode);
assert(theDocFragment
!= 0);
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::auto_ptr;
+#endif
+
+ // Make sure this
sucker gets cleaned up...
+
auto_ptr<ResultTreeFragBase> theGuard(theDocFragment);
+
XObject* var =
m_processor.createXResultTreeFrag(*theDocFragment);
theArg = new
Arg(xslParamElement->getQName(), var, true);
@@ -4200,13 +4248,17 @@
popElementMarker(targetTemplate);
throw;
}
- }
+ }
catch(...)
{
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::for_each;
+#endif
+
// Delete all temp entries not yet transferred.
// Any transferred ones will have been deleted
// by popElementMarker();
- std::for_each(tempStack.begin(),
+ for_each(tempStack.begin(),
tempStack.end(),
DeleteFunctor<StackEntry>());
@@ -4259,7 +4311,7 @@
const Arg*
XSLTEngineImpl::VariableStack::findArg(
const QName& qname,
- bool fSearchGlobalSpace)
const
+ bool fSearchGlobalSpace) const
{
const Arg* theResult = 0;
@@ -4323,12 +4375,14 @@
XSLTEngineImpl::InstallFunctions()
{
XPath::installFunction(XALAN_STATIC_UCODE_STRING("current"),
FunctionCurrent());
+ XPath::installFunction(XALAN_STATIC_UCODE_STRING("document"),
FunctionDocument());
+ XPath::installFunction(XALAN_STATIC_UCODE_STRING("element-available"),
FunctionElementAvailable());
+ XPath::installFunction(XALAN_STATIC_UCODE_STRING("function-available"),
FunctionFunctionAvailable());
XPath::installFunction(XALAN_STATIC_UCODE_STRING("format-number"),
FunctionFormatNumber());
+ XPath::installFunction(XALAN_STATIC_UCODE_STRING("generate-id"),
FunctionGenerateID());
XPath::installFunction(XALAN_STATIC_UCODE_STRING("key"), FunctionKey());
-
XPath::installFunction(XALAN_STATIC_UCODE_STRING("unparsed-entity-uri"),
FunctionUnparsedEntityURI());
XPath::installFunction(XALAN_STATIC_UCODE_STRING("system-property"),
FunctionSystemProperty());
- XPath::installFunction(XALAN_STATIC_UCODE_STRING("generate-id"),
FunctionGenerateID());
- XPath::installFunction(XALAN_STATIC_UCODE_STRING("document"),
FunctionDocument());
+
XPath::installFunction(XALAN_STATIC_UCODE_STRING("unparsed-entity-uri"),
FunctionUnparsedEntityURI());
}
1.24 +6 -2 xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp
Index: XSLTEngineImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- XSLTEngineImpl.hpp 2000/04/14 15:41:18 1.23
+++ XSLTEngineImpl.hpp 2000/04/18 15:29:40 1.24
@@ -91,10 +91,13 @@
#include <PlatformSupport/DOMStringHelper.hpp>
+
+#include <XPath/Function.hpp>
#include <XPath/MutableNodeRefList.hpp>
#include <XPath/NameSpace.hpp>
+
#include "Arg.hpp"
#include "KeyDeclaration.hpp"
#include "ProblemListener.hpp"
@@ -165,7 +168,6 @@
typedef XALAN_STD vector<NamespaceVectorType> NamespacesStackType;
typedef XALAN_STD vector<StackEntry*>
VariableStackStackType;
typedef XALAN_STD vector<TraceListener*>
TraceListenerVectorType;
- typedef XALAN_STD vector<XObject*>
XObjectPtrVectorType;
typedef XALAN_STD vector<bool>
BoolVectorType;
@@ -176,6 +178,8 @@
Stylesheet*>
StylesheetMapType;
#undef XALAN_STD
+ typedef Function::XObjectArgVectorType XObjectArgVectorType;
+
// Public members
//---------------------------------------------------------------------
@@ -619,7 +623,7 @@
XPathExecutionContext&
executionContext,
const XalanDOMString& theNamespace,
const XalanDOMString& extensionName,
- const XObjectPtrVectorType& argVec) const;
+ const XObjectArgVectorType& argVec) const;
// This is public for class Stylesheet...
/**