00001 //============================================================================= 00002 // 00003 // XDFLengine library 00004 // 00005 //----------------------------------------------------------------------------- 00006 // RawStreamer.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 "processor/xmlflowcontext.hpp" 00041 # include "streamers/generic/saxstreamer.hpp" 00042 # include "rawstreamer.hpp" 00043 00044 00045 BEGIN_XDFLENGINE_NS 00046 00047 00048 00049 00050 //============================================================================= 00051 // CLASS RawStreamerFactory 00052 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00053 00054 XMLStreamer* RawStreamerFactory::getStreamer( 00055 StreamerParams* p_pParameters, 00056 XMLFlowContext* p_pStreamContext, 00057 XMLStreamConsumer* p_pStreamConsumer) const 00058 { 00059 SAXRawHandler* l_pSaxRawHandler; 00060 00061 l_pSaxRawHandler = new SAXRawHandler(p_pStreamContext, p_pStreamConsumer); 00062 return (XMLStreamer*) new SaxStreamer( this, p_pParameters, p_pStreamContext, p_pStreamConsumer, l_pSaxRawHandler, false); 00063 } 00064 00065 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00066 //============================================================================= 00067 00068 00069 //============================================================================= 00070 // CLASS SAXRawHandler 00071 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00072 00073 //_________________________________________________________________________ 00074 // SAXRAWHANDLER 00075 //------------------------------------------------------------------------- 00076 SAXRawHandler::SAXRawHandler(XMLFlowContext* p_pContext, XMLStreamConsumer* p_pStreamConsumer) 00077 { 00078 m_pStreamConsumer=p_pStreamConsumer; 00079 m_pContext = p_pContext; 00080 DEBUG_CREATE(SAXRawHandler) 00081 } 00082 00083 //_________________________________________________________________________ 00084 // ~SAXRAWHANDLER 00085 //------------------------------------------------------------------------- 00086 SAXRawHandler::~SAXRawHandler() 00087 { 00088 DEBUG_DEL(SAXRawHandler) 00089 } 00090 00091 00092 // CONTENTHANDLER 00093 00094 //_________________________________________________________________________ 00095 // CHARACTERS 00096 //------------------------------------------------------------------------- 00097 void SAXRawHandler::characters(const XMLCh* const chars ,const unsigned int length) 00098 { 00099 char* l_pszChars; 00100 00101 DEBUG_FUNC(SAXRawHandler::characters) 00102 00103 l_pszChars=XSTR(m_pContext->getTranscoder(), chars, length); 00104 (*m_pStreamConsumer) << l_pszChars; 00105 l_pszChars = releaseCharBuffer( l_pszChars); 00106 } 00107 00108 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00109 //============================================================================= 00110 00111 END_XDFLENGINE_NS