You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by pe...@apache.org on 2002/06/04 00:34:53 UTC

cvs commit: xml-xerces/c/src/xercesc/dom DOMWriterFilter.hpp DOMWriterFilter.cpp

peiyongz    2002/06/03 15:34:53

  Modified:    c/src/xercesc/dom DOMWriterFilter.hpp DOMWriterFilter.cpp
  Log:
  DOMWriterFilter: setter provided, and allows any SHOW setting
  
  Revision  Changes    Path
  1.4       +37 -22    xml-xerces/c/src/xercesc/dom/DOMWriterFilter.hpp
  
  Index: DOMWriterFilter.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/DOMWriterFilter.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DOMWriterFilter.hpp	31 May 2002 20:59:40 -0000	1.3
  +++ DOMWriterFilter.hpp	3 Jun 2002 22:34:53 -0000	1.4
  @@ -55,8 +55,11 @@
    */
   
   /*
  - * $Id: DOMWriterFilter.hpp,v 1.3 2002/05/31 20:59:40 peiyongz Exp $
  + * $Id: DOMWriterFilter.hpp,v 1.4 2002/06/03 22:34:53 peiyongz Exp $
    * $Log: DOMWriterFilter.hpp,v $
  + * 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 @@
   	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 @@
   	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
  
  
  
  1.2       +5 -28     xml-xerces/c/src/xercesc/dom/DOMWriterFilter.cpp
  
  Index: DOMWriterFilter.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/DOMWriterFilter.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DOMWriterFilter.cpp	28 May 2002 22:38:55 -0000	1.1
  +++ DOMWriterFilter.cpp	3 Jun 2002 22:34:53 -0000	1.2
  @@ -55,8 +55,11 @@
    */
   
   /*
  - * $Id: DOMWriterFilter.cpp,v 1.1 2002/05/28 22:38:55 peiyongz Exp $
  + * $Id: DOMWriterFilter.cpp,v 1.2 2002/06/03 22:34:53 peiyongz Exp $
    * $Log: DOMWriterFilter.cpp,v $
  + * 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);  
  -}
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org