本文整理汇总了C++中rdbuf函数的典型用法代码示例。如果您正苦于以下问题:C++ rdbuf函数的具体用法?C++ rdbuf怎么用?C++ rdbuf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rdbuf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rdbuf
char * SQLQuery::preview_char() {
*this << ends;
#ifdef __USLC__
strstreambuf *tmpbuf = rdbuf();
uint length = tmpbuf->pcount();
#else
uint length = pcount();
#endif
char *s = new char[length+1];
get(s, length, '\0');
seekg (0,ios::beg);
seekp (-1,ios::cur);
return s;
}
开发者ID:royratcliffe,项目名称:ta-lib,代码行数:14,代码来源:sql_query.cpp
示例2: CHECK_M
void ifstream::close() {
if (!is_open()) {
return;
}
CHECK_M(m_filterDepth == 0, "Filters still attached to file!");
filters::streamfilter *handle =
dynamic_cast< filters::streamfilter * >(rdbuf());
filters::streamfilter *filebuf =
dynamic_cast< filters::streamfilter * >(handle->getNext());
CHECK(vfs::close(filebuf));
handle->chain(nullptr, std::ios::in);
}
开发者ID:kulseran,项目名称:FISHY,代码行数:14,代码来源:vfs_file.cpp
示例3: basic_compressor_ostream
explicit basic_compressor_ostream(
ostream_reference ostream_,
int open_mode = std::ios::out,
size_t level_ = Z_DEFAULT_COMPRESSION,
EStrategy strategy_ = DefaultStrategy,
size_t window_size_ = 15,
size_t memory_level_ = 8,
size_t buffer_size_ = default_buffer_size
)
:
zip_ostreambase_type(ostream_,level_,strategy_,window_size_,memory_level_,buffer_size_),
ostream_type(rdbuf(),open_mode )
{
};
开发者ID:apakian,项目名称:rtmp-cpp,代码行数:15,代码来源:compressed_stream.hpp
示例4: __lock_it
void fstreambase::setbuf( char *buf, int len ) {
filebuf *fb;
__lock_it( __i_lock );
fb = rdbuf();
if( fb == NULL ) {
setstate( ios::failbit );
} else {
__lock_it( fb->__b_lock );
if( fb->setbuf( buf, len ) == NULL ) {
setstate( ios::failbit );
}
}
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:15,代码来源:fsbsetbf.cpp
示例5: __lock_it
ostream &ostream::write( char const *buf, int len ) {
/***************************************************/
// Write a sequence of characters to the ostream.
__lock_it( __i_lock );
if( opfx() ) {
if( len ) {
if( rdbuf()->sputn( buf, len ) != len ) {
setstate( ios::failbit );
}
}
osfx();
}
return( *this );
}
开发者ID:kendallb,项目名称:scitech-mgl,代码行数:15,代码来源:ostwrite.cpp
示例6: rdbuf
/*--------------------------------------------------------------istream::read-+
| |
+----------------------------------------------------------------------------*/
istream & istream::read(char * buf, int n)
{
_M_gcount = 0;
if (n > 0) {
streambuf * sb = rdbuf();
do {
int c = sb->sbumpc();
if (c == EOF) {
setstate(ios::eofbit | ios::failbit);
break;
}
*buf++ = c;
}while (++_M_gcount < n);
}
return *this;
}
开发者ID:Jaxo,项目名称:yaxx,代码行数:19,代码来源:iostream.cpp
示例7: __lock_it
ostream &ostream::operator << ( char c ) {
/****************************************/
// Write a single character to the stream.
__lock_it( __i_lock );
if( opfx() ) {
if( width() == 0 ) {
if( rdbuf()->sputc( c ) == EOF ) {
setstate( ios::failbit );
}
} else {
do_lshift( c );
}
osfx();
}
return( *this );
}
开发者ID:kendallb,项目名称:scitech-mgl,代码行数:17,代码来源:ostincha.cpp
示例8: __lock_it
void fstreambase::attach( filedesc fd ) {
filebuf *fb;
__lock_it( __i_lock );
fb = rdbuf();
if( fb == NULL ) {
setstate( ios::failbit );
} else {
__lock_it( fb->__b_lock );
if( fb->attach( fd ) == NULL ) {
setstate( ios::failbit );
} else {
clear();
}
}
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:17,代码来源:fsbattac.cpp
示例9: __lock_it
void fstreambase::open( char const *name, ios::openmode mode, int prot ) {
filebuf *fb;
__lock_it( __i_lock );
fb = rdbuf();
if( fb == NULL ) {
setstate( ios::failbit );
} else {
__lock_it( fb->__b_lock );
if( fb->open( name, mode, prot ) == NULL ) {
setstate( ios::failbit );
} else {
clear();
}
}
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:17,代码来源:fsbopen.cpp
示例10: while
/*---------------------------------------------------------------istream::get-+
| |
+----------------------------------------------------------------------------*/
istream & istream::get(char * s, streamsize n, char delim)
{
char * c_p = s;
if (n) {
int c;
while ((--n > 0) && ((EOF != (c=get())) && (c!=delim))) {
*c_p++ = (char)c;
}
*c_p = '\0';
if (c == delim) {
rdbuf()->sputbackc(c);
}else if (c==EOF) {
setstate(ios::eofbit); // clear failbit
}
}
_M_gcount = c_p - s;
return *this;
}
开发者ID:Jaxo,项目名称:yaxx,代码行数:21,代码来源:iostream.cpp
示例11: NCBI_THROW
void CConn_MemoryStream::ToVector(vector<char>* vec)
{
if (!vec) {
NCBI_THROW(CIO_Exception, eInvalidArg,
"CConn_MemoryStream::ToVector(NULL) is not allowed");
}
CConn_Streambuf* sb = dynamic_cast<CConn_Streambuf*>(rdbuf());
size_t size = sb && good() ? (size_t)(tellp() - tellg()) : 0;
vec->resize(size);
if (sb) {
size_t s = (size_t) sb->sgetn(&(*vec)[0], size);
#ifdef NCBI_COMPILER_WORKSHOP
if (s < 0) {
s = 0; // WS6 weirdness to sometimes return -1 from sgetn() :-/
} else
#endif //NCBI_COMPILER_WORKSHOP
_ASSERT(s == size);
vec->resize(s); // NB: just in case, essentially NOOP when s == size
}
}
开发者ID:swuecho,项目名称:igblast,代码行数:20,代码来源:ncbi_conn_stream.cpp
示例12: clsCompressedStreamBuff
void clsCompressedOutputStream::open(const std::string &_name, bool _allowFail)
{
if (this->Buffer)
delete this->Buffer;
if ((_name.rfind(".gz") == _name.length() - 3) || (_name.rfind(".Z") == _name.length() - 3)) {
clsCompressedStreamBuff *CompressedBuff = new clsCompressedStreamBuff();
if (!CompressedBuff->open(_name, std::ios::out)) {
if (!_allowFail)
throw exTargomanBase("Could not open " + QString::fromStdString(_name) + " for writing");
setstate(std::ios::failbit);
}
this->Buffer = CompressedBuff;
} else if (_name == "-") {
this->Buffer = std::cout.rdbuf();
} else {
std::filebuf *FileBbuf = new std::filebuf();
if (!FileBbuf->open(_name.c_str(), std::ios::out)) setstate(std::ios::failbit);
this->Buffer = FileBbuf;
}
rdbuf(Buffer);
}
开发者ID:Targoman,项目名称:Source,代码行数:21,代码来源:clsCompressedOutputStream.cpp
示例13: __lock_it
int istream::get() {
/******************/
// Extract a single character from the input stream.
// Don't set ios::failbit.
int c = EOF;
__lock_it( __i_lock );
if( ipfx( 1 ) ) {
c = rdbuf()->sgetchar();
if( c == EOF ) {
setstate( ios::eofbit );
__last_read_length = 0;
} else {
__last_read_length = 1;
}
isfx();
} else {
__last_read_length = 0;
}
return( c );
}
开发者ID:kendallb,项目名称:scitech-mgl,代码行数:22,代码来源:istget.cpp
示例14: mpStreambuf
/**
* Logstream constructor
*/
LogStream::LogStream( std::ostream *pConsoleStream,
std::ofstream *pFileStream )
: std::ios( 0 ),
std::ostream( new DebugStreambuf<char> ),
mpStreambuf( NULL ),
mpConsoleStream( pConsoleStream ),
mpFileStream( pFileStream )
{
// i really don't like having to do this
mpStreambuf = dynamic_cast<DebugStreambuf<char>* >( rdbuf() );
ASSERT_MSG( mpStreambuf != NULL, "Something really evil just happened" );
// Assign the output streams to our internal debug stream
if ( pConsoleStream != NULL )
{
mpStreambuf->setConsole( pConsoleStream->rdbuf() );
}
if ( pFileStream != NULL )
{
mpStreambuf->setFile( pFileStream->rdbuf() );
}
}
开发者ID:Shnozo602,项目名称:cubeworld,代码行数:26,代码来源:logstream.cpp
示例15: error
/**
* @return An \c error_code corresponding to the last error from the stream.
*
* @par Example
* To print the error associated with a failure to establish a connection:
* @code tcp::iostream s("www.boost.org", "http");
* if (!s)
* {
* std::cout << "Error: " << s.error().message() << std::endl;
* } @endcode
*/
const boost::system::error_code& error() const
{
return rdbuf()->puberror();
}
开发者ID:13609594236,项目名称:ph-open,代码行数:15,代码来源:basic_socket_iostream.hpp
示例16: close
/// Close the connection.
void close()
{
if (rdbuf()->close() == 0)
this->setstate(std::ios_base::failbit);
}
开发者ID:13609594236,项目名称:ph-open,代码行数:6,代码来源:basic_socket_iostream.hpp
示例17: connect
void connect(T... x)
{
if (rdbuf()->connect(x...) == 0)
this->setstate(std::ios_base::failbit);
}
开发者ID:13609594236,项目名称:ph-open,代码行数:5,代码来源:basic_socket_iostream.hpp
示例18: rdbuf
void BinaryStream::resetReading(UInt32 position) {
rdbuf()->pubseekoff(position,ios::beg,ios_base::in);
iostream::clear();
}
开发者ID:holdensmagicalunicorn,项目名称:Cumulus,代码行数:4,代码来源:BinaryStream.cpp
示例19: iostream
BinaryStream::BinaryStream() : iostream(rdbuf()) {
}
开发者ID:holdensmagicalunicorn,项目名称:Cumulus,代码行数:2,代码来源:BinaryStream.cpp
示例20: rdbuf
void rpcstream::verbose(boolean verbose) { // no effect on stream's state
rdbuf()->verbose(verbose);
}
开发者ID:neurodebian,项目名称:iv-hines,代码行数:3,代码来源:rpcstream.cpp
注:本文中的rdbuf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论