CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/EventFilter/StorageManager/interface/XHTMLMaker.h

Go to the documentation of this file.
00001 // $Id: XHTMLMaker.h,v 1.12 2011/07/07 09:22:44 mommsen Exp $
00003 
00004 #ifndef EventFilter_StorageManager_XHTMLMaker_h
00005 #define EventFilter_StorageManager_XHTMLMaker_h
00006 
00007 #include <xercesc/dom/DOM.hpp>
00008 #include <xercesc/dom/DOMDocument.hpp>
00009 #include <xercesc/dom/DOMWriter.hpp>
00010 #include <xercesc/util/XMLString.hpp>
00011 
00012 #include <map>
00013 #include <string>
00014 #include <iostream>
00015 #include <stdint.h>
00016 
00017 namespace stor {
00018 
00027   class XHTMLMaker
00028   {
00029     
00030   public:
00031     
00035     typedef xercesc::DOMElement Node;
00036     typedef std::map<std::string,std::string> AttrMap;
00037     
00041     XHTMLMaker();
00042  
00046     ~XHTMLMaker();
00047 
00051     Node* start( const std::string& title );
00052 
00056     Node* getHead() const { return head_; }
00057 
00061     Node* addNode
00062     (
00063       const std::string& name,
00064       Node* parent,
00065       const AttrMap& attrs
00066     );
00067 
00071     Node* addNode( const std::string& name, const AttrMap& attrs )
00072     {
00073       return addNode( name, (Node*)0, attrs );
00074     }
00075 
00079     Node* addNode( const std::string& name, Node* parent )
00080     {
00081       AttrMap empty;
00082       return addNode( name, parent, empty );
00083     }
00084 
00088     Node* addNode( const std::string& name )
00089     {
00090       return addNode( name, (Node*)0 );
00091     }
00092 
00096     void addText( Node* parent, const std::string& );
00097 
00101     void addInt( Node* parent, const int& );
00102 
00106     void addInt( Node* parent, const unsigned int& );
00107 
00111     void addInt( Node* parent, const long& );
00112 
00116     void addInt( Node* parent, const unsigned long& );
00117 
00121     void addInt( Node* parent, const long long& );
00122 
00126     void addInt( Node* parent, const unsigned long long& );
00127 
00131     void addHex( Node* parent, const unsigned long& );
00132 
00133 
00137     void addDouble( Node* parent, const double& value, const unsigned int& precision = 2 );
00138 
00142     void addBool( Node* parent, const bool& );
00143 
00147     void out();
00148 
00152     void out( const std::string& dest );
00153 
00157     void out( std::string& dest );
00158 
00162     void out( std::ostream& dest );
00163 
00164   private:
00165 
00166     xercesc::DOMDocument* doc_;
00167     xercesc::DOMWriter* writer_;
00168     xercesc::DOMDocumentType* typ_;
00169     
00170     Node* head_;
00171     
00172     bool pageStarted_;
00173 
00177     void setWriterFeatures_();
00178     
00179   };
00180 
00181 } // namespace stor
00182 
00183 #endif // EventFilter_StorageManager_XHTMLMaker_h
00184