diff --git a/src/xercesc/dom/DOMWriterFilter.cpp b/src/xercesc/dom/DOMWriterFilter.cpp index 731d21dbbb069bf1c6e1b939ad5ad682e9e77ad9..dcc970f9af51c192d1e9df9174e487741ff749e6 100644 --- a/src/xercesc/dom/DOMWriterFilter.cpp +++ b/src/xercesc/dom/DOMWriterFilter.cpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.2 2002/06/03 22:34:53 peiyongz + * DOMWriterFilter: setter provided, and allows any SHOW setting + * * Revision 1.1 2002/05/28 22:38:55 peiyongz * DOM3 Save Interface: DOMWriter/DOMWriterFilter * @@ -64,30 +67,4 @@ #include <xercesc/dom/DOMWriterFilter.hpp> -// -// An inplementation (derived class) may allow any node type -// to be shown to it, but as the specs says, certain node types -// shall NEVER be shown to DOMWriterFilter. -// -static const unsigned long NOT_TO_SHOW_NODES = -~(DOMNodeFilter::SHOW_ATTRIBUTE | - DOMNodeFilter::SHOW_ENTITY | - DOMNodeFilter::SHOW_DOCUMENT | - DOMNodeFilter::SHOW_DOCUMENT_TYPE | - DOMNodeFilter::SHOW_DOCUMENT_FRAGMENT | - DOMNodeFilter::SHOW_NOTATION -); - -// -// We ensure that any of the above mentioned node type is not -// in the whatToShow. -// -DOMWriterFilter::DOMWriterFilter(unsigned long toShowMask) -:fWhatToShow(toShowMask & NOT_TO_SHOW_NODES) -{} - -bool DOMWriterFilter::showNode(const DOMNode *const node) const -{ - return ((fWhatToShow & (1 << (node->getNodeType() - 1))) != 0); -} diff --git a/src/xercesc/dom/DOMWriterFilter.hpp b/src/xercesc/dom/DOMWriterFilter.hpp index 23adea9ee84db51162f443f0cae92bdcbcaa2da4..722bbd59e95198b0a9f8214eea3f8c934688d7c8 100644 --- a/src/xercesc/dom/DOMWriterFilter.hpp +++ b/src/xercesc/dom/DOMWriterFilter.hpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.4 2002/06/03 22:34:53 peiyongz + * DOMWriterFilter: setter provided, and allows any SHOW setting + * * Revision 1.3 2002/05/31 20:59:40 peiyongz * Add "introduced in DOM3" * @@ -76,8 +79,9 @@ ////////////////////////////////////////////////////////////////////// // DOMWriterFilter.hpp: interface for the DOMWriterFilter class. // -// DOMWriterFilters provide applications the ability to examine nodes +// DOMWriterFilter provide applications the ability to examine nodes // as they are being serialized. +// // DOMWriterFilter lets the application decide what nodes should be // serialized or not. // @@ -99,22 +103,28 @@ public: virtual ~DOMWriterFilter(){}; //@} - /** @ interface from DOMNodeFilter, - to be implemented by implementation (derived class) */ + /** @ Interface from DOMNodeFilter, + * to be implemented by implementation (derived class) + */ //@{ virtual short acceptNode(const DOMNode* node) const = 0; //@} - /** @Query */ + /** @ Getter and Settter + * + * <p><b>"Experimental - subject to change"</b></p> + */ //@{ - bool showNode(const DOMNode* const) const; + unsigned long getWhatToShow() const {return fWhatToShow;}; + + void setWhatToShow(unsigned long toShow) {fWhatToShow = toShow;}; //@} protected: - /** @name Constructors */ //@{ - DOMWriterFilter(unsigned long toShowMask = DOMNodeFilter::SHOW_ALL); + DOMWriterFilter(unsigned long whatToShow = DOMNodeFilter::SHOW_ALL) + :fWhatToShow(whatToShow){}; //@} private: @@ -122,22 +132,27 @@ private: DOMWriterFilter(const DOMWriterFilter&); DOMWriterFilter & operator = (const DOMWriterFilter&); + // ----------------------------------------------------------------------- + // Private data members + // + // fWhatToShow + // + // The whatToShow mask. + // Tells the DOMWriter what types of nodes to show to the filter. + // See NodeFilter for definition of the constants. + // The constants + // SHOW_ATTRIBUTE, + // SHOW_DOCUMENT, + // SHOW_DOCUMENT_TYPE, + // SHOW_NOTATION, and + // SHOW_DOCUMENT_FRAGMENT are meaningless here, + // Entity nodes are not passed to the filter. + // + // Those nodes will never be passed to a DOMWriterFilter. // - // The whatToShow mask. - // - // Tells the DOMWriter what types of nodes to show to the filter. - // See NodeFilter for definition of the constants. - // The constants - // SHOW_ATTRIBUTE, - // SHOW_DOCUMENT, - // SHOW_DOCUMENT_TYPE, - // SHOW_NOTATION, and - // SHOW_DOCUMENT_FRAGMENT are meaningless here, - // those nodes will never be passed to a DOMWriterFilter. - // - // Entity nodes are not passed to the filter. + // ----------------------------------------------------------------------- + unsigned long fWhatToShow; - const unsigned long fWhatToShow; }; #endif