⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apacheoutputstream.cpp

📁 "More for C++" is a class library that provides some features that are usually common for object ori
💻 CPP
字号:
////  This file is part of the "More for C++" library////  Copyright (c) 1999-2003 by Thorsten Goertz (thorsten@morefor.org)////  The "More for C++" library is free software; you can redistribute it and/or//  modify it under the terms of the license that comes with this package.////  Read "license.txt" for more details.////  THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED//  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES//  OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.////////////////////////////////////////////////////////////////////////////////#include <apache.hpp>#include <cstdlib>#include <more/create.hpp>#include "apacheoutputstream.hpp"using namespace more;using namespace more::io;using namespace more::servlet;using namespace more::servlet::apache;using namespace more::util;using namespace std;////////////////////////////////////////////////////////////////////////////////ApacheOutputStream::ApacheOutputStream(  request_rec* pRequest): m_pRequest( pRequest ), m_pBuffers( CREATE Buffers( ) ){}////////////////////////////////////////////////////////////////////////////////size_t ApacheOutputStream::rewind(  size_t nNoOfBytes) throw( IOException ){  throw IOException( 0, "Rewind on this output-stream not supported" );  return 0;}////////////////////////////////////////////////////////////////////////////////void ApacheOutputStream::write(  const void*   pBuffer,  size_t        nNoOfBytes) throw( IOException ){  m_pBuffers -> push_back( CREATE Buffer( pBuffer, nNoOfBytes ) );}////////////////////////////////////////////////////////////////////////////////bool ApacheOutputStream::hasBeenClosed( ) throw( IOException ){  return false;}////////////////////////////////////////////////////////////////////////////////void ApacheOutputStream::flush( ) throw( IOException ){  Buffers::const_iterator pBuffer = m_pBuffers -> begin( );  while( pBuffer != m_pBuffers -> end( ) )  {    const char* pcBuffer = ( const char* ) ( *pBuffer ) -> getBuffer( );    size_t      nNoOfBytes = ( *pBuffer ) -> getNoOfBytes( );    if( strlen( pcBuffer ) == nNoOfBytes )    {      ap_rputs( pcBuffer, m_pRequest );    }    else    {      ap_rwrite( pcBuffer, nNoOfBytes, m_pRequest );    }    pBuffer++;  }  m_pBuffers -> clear( );}////////////////////////////////////////////////////////////////////////////////ApacheOutputStream::Buffer::Buffer(  const void* pBuffer,  size_t      nNoOfBytes): m_pBuffer( malloc( nNoOfBytes + 1 ) ), m_nNoOfBytes( nNoOfBytes ){  memcpy( m_pBuffer, pBuffer, nNoOfBytes );  ( ( unsigned char* ) m_pBuffer ) [nNoOfBytes] = 0x00;}////////////////////////////////////////////////////////////////////////////////void ApacheOutputStream::Buffer::finalize( ){  free( m_pBuffer );}////////////////////////////////////////////////////////////////////////////////const void* ApacheOutputStream::Buffer::getBuffer( ) const{  return m_pBuffer;}////////////////////////////////////////////////////////////////////////////////size_t ApacheOutputStream::Buffer::getNoOfBytes( ) const{  return m_nNoOfBytes;}////////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -