📄 wy__rdbuf.h
字号:
/* Copyright is licensed under GNU LGPL. by I.J.Wang 2005 This header file is included in wy_uty.h Documentation: wy__rdbuf.3wy*/#ifndef WY__RDBUF_H__#define WY__RDBUF_H__#include "wybyteflow.h"// Known problem: // WyByteFlow regf("some_regular_file",O_RDONLY);//// void f(WyByteFlow& bf) {// Wy__RdBuf rdq(bf);// dynamic_cast<WyRegFile&>(bf).set_pos(0);// WyByteFlow tmp(bf);// tmp.read(...); // read pos could be random (not specified)// }//class Wy__RdBuf { WyByteFlow* _fptr; // pointer to the WyByteFlow object to read data from WyStr _rqbuf; // read buffer size_t _cidx; // starting index for the next getdata output size_t _dtsize; // data transfer size ('count' for read) unsigned int _lgch; // the char for unget (last get char) // [Syn] Initialize member _dtsize suitable for reading bf // // [Ret] Ok // Wym_EBADF Object is not valid for the operation // Wym_ENOMEM Not enough memory // WyRet _init_dtsize(const WyByteFlow& bf); // [Internal] For Wy_AtDestroy // // [Throw] Reply // Wym_EBADF Object is not valid for the operation // Wym_ENOMEM Not enough memory // static void _set_dtsize(Wy__RdBuf& rdq,size_t size); // For Wy_AtDestroy // Hidden Wy__RdBuf(const Wy__RdBuf& bf); const Wy__RdBuf& operator=(const Wy__RdBuf& rhs); bool operator==(const Wy__RdBuf& rhs) const; bool operator!=(const Wy__RdBuf& rhs) const; public: static const char class_name[]; WY_THROW_REPLY; // bf can't be O_NONBLOCK // explicit // no implicit conversion Wy__RdBuf(WyByteFlow* bfp); ~Wy__RdBuf() WY__TSPC(); WyByteFlow* rf_ptr(void) const WY__TSPC(); WyCSeg data(void) const WY__TSPC(); // bf can't be O_NONBLOCK // WyRet reset(WyByteFlow*); WyRet getch(char& chr); WyRet getdata(WyCSeg& peek, size_t count); WyRet getdata(WyCSeg& peek, size_t count, char term); WyRet unget(void); void flush(size_t count); size_t _rdsize(void) const WY__TSPC(); void _rdsize(size_t) WY__TSPC(); WyRet _feed(void); WyRet _feed(size_t nbytes);};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -