00001 //============================================================================= 00002 // 00003 // XDFLengine library 00004 // 00005 //----------------------------------------------------------------------------- 00006 // RaiseErrorStreamer.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 00040 # include "raiseerrorstreamer.hpp" 00041 # include "processor/xmlflowcontext.hpp" 00042 00043 BEGIN_XDFLENGINE_NS 00044 00045 //============================================================================= 00046 // CLASS RaiseErrorStreamer 00047 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00048 00049 // CONSTRUCTOR & DESTRUCTOR 00050 00051 //_____________________________________________________________________ 00052 // RaiseErrorStreamer 00053 //--------------------------------------------------------------------- 00054 RaiseErrorStreamer::RaiseErrorStreamer( const XMLStreamerFactory* p_pParent, StreamerParams* p_pParameters, XMLFlowContext* p_pContext, XMLStreamConsumer* p_pOutput) 00055 :XMLStreamer( p_pParent, p_pParameters, p_pContext, p_pOutput){} 00056 00057 //_____________________________________________________________________ 00058 // ~RaiseErrorStreamer 00059 //--------------------------------------------------------------------- 00060 RaiseErrorStreamer::~RaiseErrorStreamer() 00061 { 00062 } 00063 00064 // STREAM 00065 00066 //_____________________________________________________________________ 00067 // INITSTREAM 00068 //--------------------------------------------------------------------- 00069 bool RaiseErrorStreamer::initStream() 00070 { 00071 //----------------------------------------------------------------- 00072 const char* l_pszErrorMessage; 00073 unsigned int l_uiErrorNumber; 00074 bool l_fErrorFatal; 00075 //----------------------------------------------------------------- 00076 l_uiErrorNumber = atoi( getParamValue( m_pParameters,RAISEERRORSTREAMER_NUMBER,RAISEERRORSTREAMER_NUMBER_DEF) ); 00077 l_pszErrorMessage = getParamValue( m_pParameters, RAISEERRORSTREAMER_MESSAGE,RAISEERRORSTREAMER_MESSAGE_DEF); 00078 l_fErrorFatal=false; 00079 if( strcmp( getParamValue( m_pParameters, RAISEERRORSTREAMER_FATAL, RAISEERRORSTREAMER_FATAL_DEF), REQ_TRUE ) == 1 ) l_fErrorFatal=true; 00080 00081 if (l_uiErrorNumber != 0) 00082 { 00083 THROW_XMLFLOW_EXCEPTION ( l_uiErrorNumber , l_pszErrorMessage, "", "RaiseErrorStreamer::initStream", "", l_fErrorFatal ); 00084 } 00085 00086 return true; 00087 } 00088 00089 00090 00091 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00092 //============================================================================= 00093 00094 00095 //============================================================================= 00096 // CLASS RaiseErrorStreamerFactory 00097 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00098 00099 XMLStreamer* RaiseErrorStreamerFactory::getStreamer( 00100 StreamerParams* p_pParameters, 00101 XMLFlowContext* p_pStreamContext, 00102 XMLStreamConsumer* p_pStreamConsumer) const 00103 { 00104 return (XMLStreamer*) new RaiseErrorStreamer( this, p_pParameters, p_pStreamContext, p_pStreamConsumer); 00105 } 00106 00107 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00108 //============================================================================= 00109 00110 00111 END_XDFLENGINE_NS 00112 00113 00114