![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsXMLSimpleWriter.hpp 00003 00004 XMLSimpleWriter class (hpp file). 00005 00006 SUKITTI PUNAK (05/08/2008) 00007 UPDATE (05/08/2008) 00008 ******************************************************************************/ 00009 #ifndef TAPs_XML_SIMPLE_WRITER_HPP 00010 #define TAPs_XML_SIMPLE_WRITER_HPP 00011 00012 #include "../Core/TAPsStdLib.hpp" 00013 00014 BEGIN_NAMESPACE_TAPs__XML 00015 //============================================================================= 00016 class XMLSimpleWriter { 00017 //============================================================================= 00018 public: 00019 // Member Functions ------------------------------------------------------- 00020 //------------------------------------------------------------------------- 00021 XMLSimpleWriter (); 00022 ~XMLSimpleWriter (); 00023 //------------------------------------------------------------------------- 00024 00025 //========================================================================= 00026 // Start of Operation Set 00027 //------------------------------------------------------------------------- 00029 void OpenFile ( std::string const & fileName ); 00030 00032 void WriteComment ( std::string const & comment ); 00033 void WriteComment ( char comment[] ) 00034 { 00035 WriteComment( std::string( comment ) ); 00036 } 00037 00039 void WriteXMLDeclaration () throw (); 00040 00042 void WriteXMLDeclaration ( std::string const & declaration ); 00043 void WriteXMLDeclaration ( char declaration[] ) { WriteXMLDeclaration( std::string( declaration ) ); } 00044 00046 void WritXSLStyleSheetName ( std::string const & XSLName ); 00047 void WritXSLStyleSheetName ( char XSLName[] ) { WritXSLStyleSheetName( std::string( XSLName ) ); } 00048 00050 void WritXSLStyleSheetRef ( std::string const & XSLRef ); 00051 void WritXSLStyleSheetRef ( char XSLRef[] ) { WritXSLStyleSheetRef( std::string( XSLRef ) ); } 00052 00054 void WriteElementInOneLine ( std::string const & name, std::string const & value ); 00055 void WriteElementInOneLine ( char name[], char value[] ) 00056 { 00057 WriteElementInOneLine( std::string( name ), std::string( value ) ); 00058 } 00059 00061 void WriteOpeningTag ( std::string & name, std::string const * category = NULL ); 00062 void WriteOpeningTag ( char name[], char category[] ) 00063 { 00064 WriteOpeningTag( std::string( name ), & std::string( category ) ); 00065 } 00066 void WriteOpeningTag ( char name[] ) 00067 { 00068 WriteOpeningTag( std::string( name ) ); 00069 } 00070 00072 void WriteClosingTag () throw (); 00073 00075 void CloseFile () throw (); 00076 //------------------------------------------------------------------------- 00077 // End of Operation Set 00078 //========================================================================= 00079 00080 // Data Members ----------------------------------------------------------- 00081 //============================================================================= 00082 protected: 00083 // Member Functions ------------------------------------------------------- 00084 void WriteTabs (); 00085 // Data Members ----------------------------------------------------------- 00086 std::ofstream m_outStream; 00087 std::vector< std::string > m_strOpeningTagList; 00088 //============================================================================= 00089 private: 00090 // Member Functions ------------------------------------------------------- 00091 // Data Members ----------------------------------------------------------- 00092 //============================================================================= 00093 }; // END CLASS XMLSimpleWriter 00094 //============================================================================= 00095 END_NAMESPACE_TAPs__XML 00096 //----------------------------------------------------------------------------- 00097 // Include definition if TAPs_USE_EXPORT is not defined 00098 #if !defined( TAPs_USE_EXPORT ) 00099 #include "TAPsXMLSimpleWriter.cpp" 00100 #endif 00101 //----------------------------------------------------------------------------- 00102 #endif 00103 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00104 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----