00001 //============================================================================= 00002 // 00003 // XDFLengine library 00004 // 00005 //----------------------------------------------------------------------------- 00006 // XMLSTREAMER.CPP 00007 //----------------------------------------------------------------------------- 00013 //_____________________________________________________________________________ 00014 // 00015 // Copyright (C) 2003 Guillaume Baurand. All Rights Reserved. 00016 // 00017 // This file is part of the XDFLengine project. 00018 // 00019 // The XDFLengine is free software; you can redistribute it and/or modify 00020 // it under the terms of the GNU General Public License as published by 00021 // the Free Software Foundation; either version 2 of the License, or 00022 // (at your option) any later version. 00023 // 00024 // This program is distributed in the hope that it will be useful, 00025 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00027 // GNU General Public License for more details. 00028 // 00029 // You should have received a copy of the GNU General Public License 00030 // along with this program; if not, write to the Free Software 00031 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00032 // USA. 00033 // 00034 // For more information, 00035 // contact : guillaume@baurand.net 00036 // or visit : http://xdflengine.sourceforge.net 00037 // 00038 //============================================================================= 00039 # include "xmlstreamer.hpp" 00040 00041 BEGIN_XDFLENGINE_NS 00042 00043 //============================================================================= 00044 // CLASS XMLSTREAMER 00045 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00046 00047 //_________________________________________________________________________ 00048 // GETPARAMVALUE 00049 //------------------------------------------------------------------------- 00050 const char* XMLStreamer::getParamValue( StreamerParams* p_pParameters, const char* p_pszParamName, const char* p_pszParamDefault ) 00051 { 00052 char* l_pszValue; 00053 00054 DEBUG_FUNC(XMLStreamer::getParamValue) 00055 00056 l_pszValue = p_pParameters->get( p_pszParamName); 00057 if ( l_pszValue ) return exportCharBuffer( l_pszValue); 00058 else 00059 { 00060 if( p_pszParamDefault) return p_pszParamDefault; 00061 else return exportCharBuffer( ""); 00062 } 00063 } 00064 00065 //_____________________________________________________________________ 00066 // XMLSTREAMER 00067 //-------------------------------------------------------------------- 00068 XMLStreamer::XMLStreamer(const XMLStreamerFactory* p_pParent, StreamerParams* p_pParameters, XMLFlowContext* p_pContext, XMLStreamConsumer* p_pOutput) 00069 { 00070 m_pParent = p_pParent; 00071 m_pParameters = p_pParameters; 00072 m_pContext = p_pContext; 00073 m_pOutput = p_pOutput; 00074 DEBUG_CREATE(XMLStreamer) 00075 } 00076 00077 //_____________________________________________________________________ 00078 // ~XMLSTREAMER 00079 //--------------------------------------------------------------------- 00080 XMLStreamer::~XMLStreamer() 00081 { 00082 DEBUG_DEL(XMLStreamer) 00083 } 00084 00085 //_____________________________________________________________________ 00086 // INITSTREAM 00087 //--------------------------------------------------------------------- 00088 bool XMLStreamer::initStream() 00089 { 00090 return true; 00091 } 00092 00093 //_____________________________________________________________________ 00094 // WRITEDATA 00095 //--------------------------------------------------------------------- 00096 void XMLStreamer::writeData( const char* p_pszData, unsigned int p_uiDataLen) 00097 { 00098 m_pOutput->writeData( p_pszData, p_uiDataLen); 00099 } 00100 00101 //_____________________________________________________________________ 00102 // COMMITSTREAM 00103 //--------------------------------------------------------------------- 00104 bool XMLStreamer::commitStream(bool p_fFinal) 00105 { 00106 return m_pOutput->commitStream(false); 00107 } 00108 00109 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00110 //============================================================================= 00111 00112 END_XDFLENGINE_NS