00001 //============================================================================= 00002 // 00003 // XDFLengine library 00004 // 00005 //----------------------------------------------------------------------------- 00006 // XMLSTREAMCONSUMER.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 "xmlstreamconsumer.hpp" 00040 #include "flow/xmlstreamprovider.hpp" 00041 00042 #define XMLSTREAMCONSUMER_DBLMAXLEN 50 00043 #define XMLSTREAMCONSUMER_LNGMAXLEN 50 00044 00045 00046 BEGIN_XDFLENGINE_NS 00047 00048 00049 //============================================================================= 00050 // CLASS XMLStreamConsumer 00051 //----------------------------------------------------------------------------- 00052 00053 XMLStreamConsumer::XMLStreamConsumer(){DEBUG_CREATE(XMLStreamConsumer)} 00054 XMLStreamConsumer::~XMLStreamConsumer(){DEBUG_DEL(XMLStreamConsumer)} 00055 00056 // STREAM OPERATORS 00057 00058 //_____________________________________________________________________ 00059 // OPERATOR << 00060 //--------------------------------------------------------------------- 00061 XMLStreamConsumer & XMLStreamConsumer::operator<<( const char* p_szData) 00062 { 00063 writeData(p_szData, strlen(p_szData)); 00064 return *this; 00065 } 00066 00067 //_____________________________________________________________________ 00068 // OPERATOR << 00069 //--------------------------------------------------------------------- 00070 XMLStreamConsumer & XMLStreamConsumer::operator<<( long p_plVal) 00071 { 00072 char l_szTmp[XMLSTREAMCONSUMER_LNGMAXLEN]; 00073 sprintf( (char*) l_szTmp,"%d",p_plVal); 00074 writeData((char*) l_szTmp, strlen( (char*) l_szTmp)); 00075 return *this; 00076 } 00077 00078 //_____________________________________________________________________ 00079 // OPERATOR << 00080 //--------------------------------------------------------------------- 00081 XMLStreamConsumer & XMLStreamConsumer::operator<<( double p_pdVal) 00082 { 00083 char l_szTmp[XMLSTREAMCONSUMER_DBLMAXLEN]; 00084 sprintf( (char*) l_szTmp,"%f",p_pdVal); 00085 writeData((char*) l_szTmp, strlen( (char*) l_szTmp)); 00086 return *this; 00087 } 00088 00089 //_____________________________________________________________________ 00090 // OPERATOR << 00091 //--------------------------------------------------------------------- 00092 XMLStreamConsumer & XMLStreamConsumer::operator<<( XMLStreamProvider& p_StreamProvider) 00093 { 00094 p_StreamProvider >> (*this); 00095 return *this; 00096 } 00097 00098 //_____________________________________________________________________ 00099 // COMMITSTREAM 00100 //--------------------------------------------------------------------- 00101 bool XMLStreamConsumer::commitStream(bool fFinal){ return true; }; 00102 00103 //----------------------------------------------------------------------------- 00104 //============================================================================= 00105 00106 00107 00108 00109 00110 00111 00112 END_XDFLENGINE_NS 00113