メインページ | ネームスペース一覧 | クラス階層 | 構成 | Directories | ファイル一覧 | ネームスペースメンバ | 構成メンバ | ファイルメンバ | 関連ページ

StrBufBase.h

説明を見る。
00001 #ifndef STRBUFBASE_H
00002 #define STRBUFBASE_H
00003 #if defined _MSC_VER && _MSC_VER >= 1000
00004 #pragma once
00005 #endif // _MSC_VER >= 1000
00006 #include "Env.h"
00007 #include <cstdio>
00008 #include <iostream>
00009 /** @file StrBufBase.h iostream を派生するときに使うクラスの定義 */
00010 #ifdef __BORLANDC__
00011  #define BCC_CDECL __cdecl
00012 #else
00013  #define BCC_CDECL
00014 #endif
00015 
00016 namespace Spr {
00017 
00018 template <class T>
00019 class UTPrintfStream:public T
00020     {
00021     public:
00022     explicit UTPrintfStream(std::streambuf *sb)
00023         :T(sb)
00024         {
00025         }
00026     int SPR_CDECL printf(char* fmt, ...)
00027         {
00028         char buf[4096];
00029         return _vsnprintf(buf, sizeof(buf), fmt, (char*)&fmt);
00030         }
00031     };
00032 class SPR_DLL UTStreambufBase:public std::streambuf
00033     {
00034     char* pbuf,*gbuf;
00035     int plen, glen;
00036     public:
00037     int lahead;
00038 #ifdef _MSC_VER
00039     UTStreambufBase(std::_Uninitialized);
00040 #endif
00041     UTStreambufBase(char* gb, int gl, char* pb, int pl);
00042     BCC_CDECL ~UTStreambufBase();
00043     protected:
00044     virtual int BCC_CDECL overflow(int c = EOF);
00045     virtual int BCC_CDECL underflow();
00046     virtual int BCC_CDECL sync();
00047     virtual pos_type BCC_CDECL seekoff(off_type off, std::ios_base::seekdir way,
00048         std::ios_base::openmode which = std::ios_base::in | std::ios_base::out);
00049     //  新しいストリームを派生させるには、以下の3つの関数をオーバーロードしてください。
00050     virtual unsigned int read(void* buf, unsigned int bufLen)=0;    //  bufLen 以内の文字数入力し buf に格納する。入力文字数を返す。
00051     virtual unsigned int write(void* buf, unsigned int bufLen)=0;   //  buf に格納された bufLen 文字のデータを出力し、出力した文字数を返す。
00052     virtual int in_avail_stream(){return 0;}        //  入力可能な文字数を返す。
00053     };
00054 
00055 }   //  namespace Spr
00056 #endif

Springheadに対してSun Apr 16 01:57:55 2006に生成されました。  doxygen 1.4.1