dbertoni 01/06/12 12:12:56
Modified: c/src/XalanTransformer XalanCAPI.cpp XalanCAPI.h
XalanTransformer.cpp XalanTransformer.hpp
XalanTransformerDefinitions.hpp
XalanTransformerOutputStream.cpp
XalanTransformerOutputStream.hpp
Log:
Updates and enhancements to the transformer class.
Revision Changes Path
1.17 +5 -3 xml-xalan/c/src/XalanTransformer/XalanCAPI.cpp
Index: XalanCAPI.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanCAPI.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- XalanCAPI.cpp 2001/06/07 14:44:35 1.16
+++ XalanCAPI.cpp 2001/06/12 19:12:53 1.17
@@ -289,7 +289,7 @@
const char* theXMLFileName,
const char* theXSLFileName,
XalanHandle theXalanHandle,
- const void* theOutputHandle,
+ void* theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler)
{
@@ -309,7 +309,7 @@
const char* theXMLFileName,
XalanCSSHandle theCSSHandle,
XalanHandle theXalanHandle,
- const void* theOutputHandle,
+ void* theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler)
{
@@ -360,7 +360,9 @@
const char* expression,
XalanHandle theXalanHandle)
{
- getTransformer(theXalanHandle)->setStylesheetParam(key, expression);
+ getTransformer(theXalanHandle)->setStylesheetParam(
+ XalanDOMString(key),
+ XalanDOMString(expression));
}
1.12 +2 -33 xml-xalan/c/src/XalanTransformer/XalanCAPI.h
Index: XalanCAPI.h
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanCAPI.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XalanCAPI.h 2001/06/06 21:41:08 1.11
+++ XalanCAPI.h 2001/06/12 19:12:53 1.12
@@ -92,37 +92,6 @@
typedef const void* XalanPSHandle;
/**
- * Callback function passed to XalanTransformToHandler.
- * Used to process transformation output in blocks of data.
- * Caller is responsible for streaming or copying data to a user
- * allocated buffer. Caller should not attempt to write to or
- * free this data. Upon termination, Xalan reuses the same buffer
- * and frees it.
- *
- * The callback should return the number of bytes written, and
- * this number should match the length received. Otherwise the
- * XalanTransformToHandler function terminates and returns an error status.
- *
- * static unsigned long xalanOutputHandler(const void* data, unsigned long
length, const void *handle);
- *
- * @param data a block of data
- * @param length length of block
- * @param handle handle of XalanTransformer instance.
- * @return number of bytes written
- */
- typedef unsigned long (*XalanOutputHandlerType) (const void*, unsigned long,
const void*);
-
- /**
- * Callback function passed to XalanTransformToHandler.
- * Used to flush the buffer once transform is completed.
- *
- * static void xalanFlushHandler(const void *handle);
- *
- * @param handle handle of XalanTransformer instance.
- */
- typedef void (*XalanFlushHandlerType) (const void*);
-
- /**
* This is a typedef to work around limitations with
* the XALAN_TRANSFORMER_EXPORT_FUNCTION macro.
*/
@@ -271,7 +240,7 @@
const char*
theXMLFileName,
const char* theXSLFileName,
XalanHandle theXalanHandle,
- const void*
theOutputHandle,
+ void*
theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler);
@@ -301,7 +270,7 @@
const char*
theXMLFileName,
XalanCSSHandle theCSSHandle,
XalanHandle theXalanHandle,
- const void*
theOutputHandle,
+ void*
theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler);
1.21 +27 -40 xml-xalan/c/src/XalanTransformer/XalanTransformer.cpp
Index: XalanTransformer.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanTransformer.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- XalanTransformer.cpp 2001/06/07 19:10:03 1.20
+++ XalanTransformer.cpp 2001/06/12 19:12:53 1.21
@@ -115,9 +115,8 @@
m_parsedSources(),
m_paramPairs(),
m_functionPairs(),
- m_errorMessage()
+ m_errorMessage(1, '\0')
{
- m_errorMessage.push_back(0);
}
@@ -181,9 +180,7 @@
int theResult = 0;
// Clear the error message.
- m_errorMessage.clear();
-
- m_errorMessage.push_back(0);
+ m_errorMessage.resize(1, '\0');
// Store error messages from problem listener.
XalanDOMString theErrorMessage;
@@ -346,9 +343,7 @@
int theResult = 0;
// Clear the error message.
- m_errorMessage.clear();
-
- m_errorMessage.push_back(0);
+ m_errorMessage.resize(1, '\0');
// Store error messages from problem listener.
XalanDOMString theErrorMessage;
@@ -556,7 +551,7 @@
XalanTransformer::transform(
const XSLTInputSource& theInputSource,
const XSLTInputSource& theStylesheetSource,
- const void* theOutputHandle,
+ void* theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler)
{
@@ -580,7 +575,7 @@
XalanTransformer::transform(
const XSLTInputSource& theInputSource,
const XalanCompiledStylesheet* theCompiledStylesheet,
- const void*
theOutputHandle,
+ void*
theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler)
{
@@ -603,7 +598,7 @@
int
XalanTransformer::transform(
const XSLTInputSource& theInputSource,
- const void*
theOutputHandle,
+ void*
theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler)
{
@@ -627,10 +622,8 @@
XalanTransformer::compileStylesheet(const XSLTInputSource&
theStylesheetSource)
{
// Clear the error message.
- m_errorMessage.clear();
+ m_errorMessage.resize(1, '\0');
- m_errorMessage.push_back(0);
-
// Store error messages from problem listener.
XalanDOMString theErrorMessage;
@@ -759,7 +752,7 @@
const XalanParsedSource*
XalanTransformer::parseSource(
- const XSLTInputSource& theInputSource,
+ const XSLTInputSource& theInputSource,
bool useXercesDOM)
{
// Clear the error message.
@@ -767,7 +760,7 @@
m_errorMessage.push_back(0);
try
- {
+ {
XalanParsedSource* theParsedDocument = 0;
if(useXercesDOM == true)
@@ -780,10 +773,10 @@
}
// Store it in a vector.
- m_parsedSources.push_back(theParsedDocument);
+ m_parsedSources.push_back(theParsedDocument);
return theParsedDocument;
- }
+ }
catch (XSLException& e)
{
TranscodeToLocalCodePage(e.getMessage(), m_errorMessage, true);
@@ -846,19 +839,6 @@
-void
-XalanTransformer::setStylesheetParam(
- const char* key,
- const char* expression)
-{
- // Set the stylesheet parameter.
- setStylesheetParam(
- XalanDOMString(key),
- XalanDOMString(expression));
-}
-
-
-
XalanDocumentBuilder*
XalanTransformer::createDocumentBuilder()
{
@@ -893,12 +873,15 @@
void
-XalanTransformer::installExternalFunction(
- const char* theNamespace,
- const char* functionName,
+XalanTransformer::installExternalFunctionGlobal(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& functionName,
const Function& function)
{
- installExternalFunction(theNamespace, functionName, function);
+ XSLTProcessorEnvSupportDefault::installExternalFunctionGlobal(
+ theNamespace,
+ functionName,
+ function);
}
@@ -911,8 +894,9 @@
for (FunctionParamPairVectorType::size_type i = 0; i < m_functionPairs.size();
++i)
{
if(QNameByReference(theNamespace,
functionName).equals(m_functionPairs[i].first))
- {
+ {
delete m_functionPairs[i].second;
+
m_functionPairs.erase(m_functionPairs.begin() + i);
}
}
@@ -921,12 +905,15 @@
void
-XalanTransformer::uninstallExternalFunction(
- const char* theNamespace,
- const char* functionName)
+XalanTransformer::uninstallExternalFunctionGlobal(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& functionName)
{
- uninstallExternalFunction(theNamespace, functionName);
+ XSLTProcessorEnvSupportDefault::uninstallExternalFunctionGlobal(
+ theNamespace,
+ functionName);
}
+
1.24 +16 -29 xml-xalan/c/src/XalanTransformer/XalanTransformer.hpp
Index: XalanTransformer.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanTransformer.hpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- XalanTransformer.hpp 2001/06/07 19:10:04 1.23
+++ XalanTransformer.hpp 2001/06/12 19:12:54 1.24
@@ -223,7 +223,7 @@
transform(
const XSLTInputSource& theInputSource,
const XSLTInputSource& theStylesheetSource,
- const void*
theOutputHandle,
+ void*
theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler = 0);
@@ -247,9 +247,9 @@
*/
int
transform(
- const XSLTInputSource& theInputSource,
+ const XSLTInputSource& theInputSource,
const XalanCompiledStylesheet* theCompiledStylesheet,
- const void*
theOutputHandle,
+ void*
theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler = 0);
@@ -272,8 +272,8 @@
*/
int
transform(
- const XSLTInputSource& theInputSource,
- const void*
theOutputHandle,
+ const XSLTInputSource& theInputSource,
+ void*
theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler = 0);
@@ -364,21 +364,20 @@
const Function& function);
/**
- * Install an external function. The function is only
- * available in this instance.
+ * Install an external function in the global space.
*
* @param theNamespace The namespace for the functionl
* @param functionName The name of the function.
* @param function The function to install.
*/
- void
- installExternalFunction(
- const char* theNamespace,
- const char* functionName,
+ static void
+ installExternalFunctionGlobal(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& functionName,
const Function& function);
/**
- * Uninstall an external function.
+ * Uninstall an external local function.
*
* @param theNamespace The namespace for the function
* @param functionName The name of the function.
@@ -389,15 +388,15 @@
const XalanDOMString& functionName);
/**
- * Uninstall an external function.
+ * Uninstall an external global function.
*
* @param theNamespace The namespace for the function
* @param functionName The name of the function.
*/
- void
- uninstallExternalFunction(
- const char* theNamespace,
- const char* functionName);
+ static void
+ uninstallExternalFunctionGlobal(
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& functionName);
/**
* Set a top-level stylesheet parameter. This value can be evaluated via
@@ -410,18 +409,6 @@
setStylesheetParam(
const XalanDOMString& key,
const XalanDOMString& expression);
-
- /**
- * Set a top-level stylesheet parameter. This value can be evaluated via
- * xsl:param-variable.
- *
- * @param key name of the param
- * @param expression expression that will be evaluated
- */
- void
- setStylesheetParam(
- const char* key,
- const char* expression);
/**
* Returns the last error that occurred as a
1.5 +39 -0 xml-xalan/c/src/XalanTransformer/XalanTransformerDefinitions.hpp
Index: XalanTransformerDefinitions.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XalanTransformer/XalanTransformerDefinitions.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanTransformerDefinitions.hpp 2001/02/01 19:11:37 1.4
+++ XalanTransformerDefinitions.hpp 2001/06/12 19:12:54 1.5
@@ -77,6 +77,45 @@
#endif
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+/**
+ * Callback function passed to the XalanTransformer APIs.
+ * Used to process transformation output in blocks of data.
+ * Caller is responsible for streaming or copying data to a user
+ * allocated buffer. Caller should not attempt to write to or
+ * free this data.
+ *
+ * The callback should return the number of bytes written, and
+ * this number should match the length received. Otherwise the
+ * XalanTransformToHandler function terminates and returns an error status.
+ *
+ * static unsigned long xalanOutputHandler(const void* data, unsigned long length,
const void *handle);
+ *
+ * @param data a block of data
+ * @param length length of block
+ * @param handle handle of XalanTransformer instance.
+ * @return number of bytes written
+ */
+typedef unsigned long (*XalanOutputHandlerType) (const char*, unsigned long, void*);
+
+/**
+ * Callback function passed to the XalanTransformer APIs.
+ * Used to flush the buffer once transform is completed.
+ *
+ * static void xalanFlushHandler(const void *handle);
+ *
+ * @param handle handle of XalanTransformer instance.
+ */
+typedef void (*XalanFlushHandlerType) (void*);
+
+#if defined(__cplusplus)
+}
+#endif
+
#endif // XALAN_TRANSFORMER_DEFINITIONS_HEADER_GUARD_1357924680
1.6 +2 -2
xml-xalan/c/src/XalanTransformer/XalanTransformerOutputStream.cpp
Index: XalanTransformerOutputStream.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XalanTransformer/XalanTransformerOutputStream.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XalanTransformerOutputStream.cpp 2001/02/08 21:18:13 1.5
+++ XalanTransformerOutputStream.cpp 2001/06/12 19:12:54 1.6
@@ -54,12 +54,12 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-#include <XalanTransformer/XalanTransformerOutputStream.hpp>
+#include "XalanTransformerOutputStream.hpp"
XalanTransformerOutputStream::XalanTransformerOutputStream(
- const void* theOutputHandle,
+ void* theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler):
m_outputHandle(theOutputHandle),
1.7 +2 -11
xml-xalan/c/src/XalanTransformer/XalanTransformerOutputStream.hpp
Index: XalanTransformerOutputStream.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XalanTransformer/XalanTransformerOutputStream.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XalanTransformerOutputStream.hpp 2001/03/16 15:51:56 1.6
+++ XalanTransformerOutputStream.hpp 2001/06/12 19:12:54 1.7
@@ -69,15 +69,6 @@
-extern "C"
-{
- typedef unsigned long (*XalanOutputHandlerType) (const void*, unsigned long,
const void*);
-
- typedef void (*XalanFlushHandlerType) (const void*);
-}
-
-
-
// A class for output to a user defined (callback) function.
class XALAN_TRANSFORMER_EXPORT XalanTransformerOutputStream : public
XalanOutputStream
{
@@ -92,7 +83,7 @@
* @param theFlushHandler a user defined (callback) function.
*/
XalanTransformerOutputStream(
- const void* theOutputHandle,
+ void* theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler = 0);
@@ -117,7 +108,7 @@
XalanTransformerOutputStream&
operator=(const XalanTransformerOutputStream&);
- const void* m_outputHandle;
+ void* const m_outputHandle;
XalanOutputHandlerType m_outputHandler;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]