00001 //============================================================================= 00002 // 00003 // XDFLengine library 00004 // 00005 //----------------------------------------------------------------------------- 00006 // NULLBUFFER.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 <sys/stat.h> 00041 # include "nullbuffer.hpp" 00042 00043 BEGIN_XDFLENGINE_NS 00044 00045 //============================================================================= 00046 // CLASS NULLBUFFER 00047 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00048 00049 //_________________________________________________________________________ 00050 // NULLBUFFER 00051 //------------------------------------------------------------------------- 00052 NullBuffer::NullBuffer() 00053 { 00054 DEBUG_CREATE(NullBuffer) 00055 } 00056 00057 //_________________________________________________________________________ 00058 // NULLBUFFER 00059 //------------------------------------------------------------------------- 00060 NullBuffer::NullBuffer(const char* p_cFileName, bool p_boolReadOnly) 00061 { 00062 DEBUG_CREATE(NullBuffer) 00063 } 00064 00065 //_________________________________________________________________________ 00066 // ~NULLBUFFER 00067 //------------------------------------------------------------------------- 00068 NullBuffer::~NullBuffer() 00069 { 00070 DEBUG_DEL(NullBuffer) 00071 } 00072 00073 //_________________________________________________________________________ 00074 // GETNAME 00075 //------------------------------------------------------------------------- 00076 const char* NullBuffer::getName() 00077 { 00078 DEBUG_FUNC(NullBuffer::getName) 00079 00080 return "NULL"; 00081 } 00082 00083 //_________________________________________________________________________ 00084 // OPERATOR << 00085 //------------------------------------------------------------------------- 00086 XMLStreamBuffer & NullBuffer::operator<< (const char* p_cData) 00087 { 00088 DEBUG_FUNC(NullBuffer::<<(char*)) 00089 return *this; 00090 } 00091 00092 //_________________________________________________________________________ 00093 // OPERATOR << 00094 //------------------------------------------------------------------------- 00095 XMLStreamBuffer & NullBuffer::operator<< (XMLStreamBuffer& p_pXMLStreamBuffer) 00096 { 00097 DEBUG_FUNC(NullBuffer::<<(NullBuffer)) 00098 00099 return *this; 00100 } 00101 00102 //_________________________________________________________________________ 00103 // OPERATOR >> 00104 //------------------------------------------------------------------------- 00105 XMLStreamBuffer & NullBuffer::operator>> (XMLStreamBuffer& p_pXMLStreamBuffer) 00106 { 00107 DEBUG_FUNC(NullBuffer::>>(XMLStreamBuffer)) 00108 00109 return *this; 00110 } 00111 00112 void NullBuffer::write(const void* p_bData, int p_intSize) 00113 { 00114 DEBUG_FUNC(NullBuffer::write) 00115 } 00116 00117 //_________________________________________________________________________ 00118 // SLEEP 00119 //------------------------------------------------------------------------- 00120 void NullBuffer::sleep() 00121 { 00122 DEBUG_FUNC(NullBuffer::sleep) 00123 } 00124 00125 //_________________________________________________________________________ 00126 // FLUSH 00127 //------------------------------------------------------------------------- 00128 void NullBuffer::flush () 00129 { 00130 DEBUG_FUNC(NullBuffer::flush) 00131 } 00132 00133 //_________________________________________________________________________ 00134 // DATA 00135 //------------------------------------------------------------------------- 00136 void* NullBuffer::data() 00137 { 00138 //--------------------------------------------------------------------- 00139 void* l_cBuf; 00140 //--------------------------------------------------------------------- 00141 00142 DEBUG_FUNC(NullBuffer::data) 00143 00144 l_cBuf= malloc(1); 00145 memcpy( l_cBuf," ",1); 00146 00147 return l_cBuf; 00148 } 00149 00150 //_________________________________________________________________________ 00151 // LENGTH 00152 //------------------------------------------------------------------------- 00153 int NullBuffer::length() 00154 { 00155 DEBUG_FUNC(NullBuffer::length) 00156 00157 return 0; 00158 } 00159 00160 //_________________________________________________________________________ 00161 // GETINPUTSOURCE 00162 //------------------------------------------------------------------------- 00163 InputSource* NullBuffer::getInputSource() 00164 { 00165 InputSource* l_inputRet; 00166 00167 DEBUG_FUNC(NullBuffer::getInputSource) 00168 00169 l_inputRet = MakeInputSource("<NULL/>", m_pszEncoding,9); 00170 return l_inputRet; 00171 } 00172 00173 00174 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00175 //============================================================================= 00176 00177 END_XDFLENGINE_NS