dbertoni 2003/07/01 16:48:06
Modified: c/src/xalanc/XSLT StylesheetExecutionContext.hpp
StylesheetExecutionContextDefault.cpp
StylesheetExecutionContextDefault.hpp
StylesheetRoot.cpp XSLTEngineImpl.cpp
Log:
Modifications to push functionality into base FormatterListener class to
remove implementation classes from the interface and to remove dangerous
downcast.
Revision Changes Path
1.2 +26 -53
xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContext.hpp
Index: StylesheetExecutionContext.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContext.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StylesheetExecutionContext.hpp 29 Jun 2003 03:58:08 -0000 1.1
+++ StylesheetExecutionContext.hpp 1 Jul 2003 23:48:05 -0000 1.2
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -99,7 +99,6 @@
-#include <xalanc/XSLT/KeyTable.hpp>
#include <xalanc/XSLT/TopLevelArg.hpp>
@@ -113,12 +112,9 @@
class ElemTemplateElement;
class ElemVariable;
class FormatterListener;
-class FormatterToDOM;
-class FormatterToHTML;
class FormatterToText;
-class FormatterToXML;
class GenerateEvent;
-class KeyTable;
+class KeyDeclaration;
class PrefixResolver;
class NodeRefListBase;
class NodeSorter;
@@ -1386,7 +1382,7 @@
* standalone document declaration
* @return a pointer to the new instance.
*/
- virtual FormatterToXML*
+ virtual FormatterListener*
createFormatterToXML(
Writer& writer,
const XalanDOMString& version = XalanDOMString(),
@@ -1416,7 +1412,7 @@
* @param omitMetaTag Whether or not to output a META TAG
according to the recommendation. The default is false.
* @return a pointer to the new instance.
*/
- virtual FormatterToHTML*
+ virtual FormatterListener*
createFormatterToHTML(
Writer& writer,
const XalanDOMString& encoding = XalanDOMString(),
@@ -1429,60 +1425,16 @@
bool omitMetaTag =
false) = 0;
/**
- * Construct a FormatterToDOM instance. it will add the DOM nodes
- * to the document fragment.
- *
- * @param doc document for nodes
- * @param docFrag document fragment for nodes, default none
- * @param currentElement current element for nodes, default none
- */
- virtual FormatterToDOM*
- createFormatterToDOM(
- XalanDocument* doc,
- XalanDocumentFragment* docFrag,
- XalanElement* currentElement) = 0;
-
- /**
- * Construct a FormatterToDOM instance. it will add the DOM nodes
- * to the document fragment.
- *
- * @param doc document for nodes
- * @param docFrag document fragment for nodes, default none
- * @param currentElement current element for nodes, default none
- */
- virtual FormatterToDOM*
- createFormatterToDOM(
- XalanDocument* doc,
- XalanElement* elem) = 0;
-
- /**
* FormatterToText instance constructor.
*
* @param writer writer for output
* @param encoding character encoding for the writer
*/
- virtual FormatterToText*
+ virtual FormatterListener*
createFormatterToText(
Writer& writer,
const XalanDOMString& encoding) = 0;
- /**
- * Borrow a cached FormatterToText instance.
- *
- * @return A pointer to the instance.
- */
- virtual FormatterToText*
- borrowFormatterToText() = 0;
-
- /**
- * Return a previously borrowed FormatterToText instance.
- *
- * @param theFormatter A pointer the to previously borrowed instance.
- * @return true if the instance was previously borrowed, false if not.
- */
- virtual bool
- returnFormatterToText(FormatterToText* theFormatter) = 0;
-
class BorrowReturnFormatterToText
{
public:
@@ -1530,6 +1482,8 @@
};
+ friend class BorrowReturnFormatterToText;
+
/**
* Borrow a cached NodeSorter instance.
*
@@ -2025,6 +1979,25 @@
const char* msg,
const XalanNode* sourceNode = 0,
const LocatorType* locator = 0) const = 0;
+
+protected:
+
+ /**
+ * Borrow a cached FormatterToText instance.
+ *
+ * @return A pointer to the instance.
+ */
+ virtual FormatterToText*
+ borrowFormatterToText() = 0;
+
+ /**
+ * Return a previously borrowed FormatterToText instance.
+ *
+ * @param theFormatter A pointer the to previously borrowed instance.
+ * @return true if the instance was previously borrowed, false if not.
+ */
+ virtual bool
+ returnFormatterToText(FormatterToText* theFormatter) = 0;
};
1.2 +7 -6
xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp
Index: StylesheetExecutionContextDefault.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StylesheetExecutionContextDefault.cpp 29 Jun 2003 03:58:08 -0000
1.1
+++ StylesheetExecutionContextDefault.cpp 1 Jul 2003 23:48:05 -0000
1.2
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -104,6 +104,7 @@
#include "Constants.hpp"
#include "ElemTemplateElement.hpp"
#include "ElemWithParam.hpp"
+#include "KeyTable.hpp"
#include "StylesheetConstructionContextDefault.hpp"
#include "StylesheetRoot.hpp"
#include "XSLTEngineImpl.hpp"
@@ -1270,7 +1271,7 @@
-FormatterToXML*
+FormatterListener*
StylesheetExecutionContextDefault::createFormatterToXML(
Writer& writer,
const XalanDOMString& version,
@@ -1303,7 +1304,7 @@
-FormatterToHTML*
+FormatterListener*
StylesheetExecutionContextDefault::createFormatterToHTML(
Writer& writer,
const XalanDOMString& encoding,
@@ -1342,7 +1343,7 @@
-FormatterToDOM*
+FormatterListener*
StylesheetExecutionContextDefault::createFormatterToDOM(
XalanDocument* doc,
XalanDocumentFragment* docFrag,
@@ -1363,7 +1364,7 @@
-FormatterToDOM*
+FormatterListener*
StylesheetExecutionContextDefault::createFormatterToDOM(
XalanDocument* doc,
XalanElement* elem)
@@ -1382,7 +1383,7 @@
-FormatterToText*
+FormatterListener*
StylesheetExecutionContextDefault::createFormatterToText(
Writer& writer,
const XalanDOMString& encoding)
1.2 +14 -12
xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp
Index: StylesheetExecutionContextDefault.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StylesheetExecutionContextDefault.hpp 29 Jun 2003 03:58:08 -0000
1.1
+++ StylesheetExecutionContextDefault.hpp 1 Jul 2003 23:48:05 -0000
1.2
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -616,7 +616,7 @@
void
setOmitMETATag(eOmitMETATag value);
- virtual FormatterToXML*
+ virtual FormatterListener*
createFormatterToXML(
Writer& writer,
const XalanDOMString& version = XalanDOMString(),
@@ -629,7 +629,7 @@
bool xmlDecl = true,
const XalanDOMString& standalone = XalanDOMString());
- virtual FormatterToHTML*
+ virtual FormatterListener*
createFormatterToHTML(
Writer& writer,
const XalanDOMString& encoding = XalanDOMString(),
@@ -641,28 +641,22 @@
bool escapeURLs =
true,
bool omitMetaTag =
false);
- virtual FormatterToDOM*
+ virtual FormatterListener*
createFormatterToDOM(
XalanDocument* doc,
XalanDocumentFragment* docFrag,
XalanElement* currentElement);
- virtual FormatterToDOM*
+ virtual FormatterListener*
createFormatterToDOM(
XalanDocument* doc,
XalanElement* elem);
- virtual FormatterToText*
+ virtual FormatterListener*
createFormatterToText(
Writer& writer,
const XalanDOMString& encoding);
- virtual FormatterToText*
- borrowFormatterToText();
-
- virtual bool
- returnFormatterToText(FormatterToText* theFormatter);
-
virtual NodeSorter*
borrowNodeSorter();
@@ -1035,6 +1029,14 @@
*/
XalanSourceTreeDocument*
getSourceTreeFactory() const;
+
+protected:
+
+ virtual FormatterToText*
+ borrowFormatterToText();
+
+ virtual bool
+ returnFormatterToText(FormatterToText* theFormatter);
private:
1.2 +3 -2 xml-xalan/c/src/xalanc/XSLT/StylesheetRoot.cpp
Index: StylesheetRoot.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetRoot.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StylesheetRoot.cpp 29 Jun 2003 03:58:08 -0000 1.1
+++ StylesheetRoot.cpp 1 Jul 2003 23:48:05 -0000 1.2
@@ -96,9 +96,10 @@
#include "Constants.hpp"
-#include "ElemApplyTemplates.hpp"
-#include "ElemTemplate.hpp"
+#include "ElemApplyTemplates.hpp"
+#include "ElemTemplate.hpp"
#include "ElemValueOf.hpp"
+#include "KeyTable.hpp"
#include "StylesheetConstructionContext.hpp"
#include "StylesheetExecutionContext.hpp"
#include "TraceListener.hpp"
1.2 +3 -9 xml-xalan/c/src/xalanc/XSLT/XSLTEngineImpl.cpp
Index: XSLTEngineImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/XSLTEngineImpl.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XSLTEngineImpl.cpp 29 Jun 2003 03:58:08 -0000 1.1
+++ XSLTEngineImpl.cpp 1 Jul 2003 23:48:05 -0000 1.2
@@ -96,9 +96,6 @@
-#include <xalanc/XMLSupport/FormatterToDOM.hpp>
-#include <xalanc/XMLSupport/FormatterToText.hpp>
-#include <xalanc/XMLSupport/FormatterToXML.hpp>
#include <xalanc/XMLSupport/FormatterToHTML.hpp>
#include <xalanc/XMLSupport/FormatterTreeWalker.hpp>
#include <xalanc/XMLSupport/XMLParserLiaison.hpp>
@@ -1620,12 +1617,9 @@
if (getFormatterListener()->getOutputFormat()
== FormatterListener::OUTPUT_METHOD_XML)
{
// Yuck!!! Ugly hack to switch to HTML
on-the-fly.
- FormatterToXML* const theFormatter =
-#if defined(XALAN_OLD_STYLE_CASTS)
-
(FormatterToXML*)getFormatterListener();
-#else
-
static_cast<FormatterToXML*>(getFormatterListener());
-#endif
+ FormatterListener* const
theFormatter =
+ getFormatterListener();
+ assert(theFormatter->getWriter() != 0);
setFormatterListenerImpl(
m_executionContext->createFormatterToHTML(
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]