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

📄 sstrbuf_.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
📖 第 1 页 / 共 2 页
字号:
:SNPL.
:SNPFLF          .#include <strstrea.h>
:SNPFLF          .public:
:SNPF index='str'.char *strstreambuf::str();
:eSNPL.
:SMTICS.
The &fn. freezes the &obj. and returns a pointer to the &rsvarea.:PERIOD.
This pointer
remains valid after the &obj. is destroyed provided the &obj. remains
frozen, since the destructor does not free the &rsvarea. if it is frozen.
:P.
The returned pointer may be &null. if the &obj. is using dynamic allocation but
has not yet had anything written to it.
:P.
If the &obj. is not using dynamic allocation, the pointer returned by the
&fn. is the same buffer pointer provided to the constructor. For a &obj.
using dynamic allocation, the pointer points to a dynamically allocated area.
:P.
Note that the &rsvarea. does not necessarily end with a null character.
If the pointer returned by the &fn. is to be interpreted as a C string,
it is the program's responsibility to ensure that the null character is
present.
:RSLTS.
The &fn. returns a pointer to the &rsvarea. and freezes the &obj.:PERIOD.
:SALSO.
:SAL typ='mfun'.freeze
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='ctor' prot='public'.strstreambuf
:SNPL.
:SNPFLF                    .#include <strstrea.h>
:SNPFLF                    .public:
:SNPCD cd_idx='c'.strstreambuf::strstreambuf();
:eSNPL.
:SMTICS.
This form of the &fn. creates an empty &obj. that uses dynamic allocation. No
&rsvarea. is allocated to start. Whenever characters are written to extend the
&obj., the &rsvarea. is reallocated and copied as required. The size of
allocation is determined by the &obj. unless the
:MONO.setbuf
or
:MONO.alloc_size_increment
member functions are called to change the allocation size.
The default allocation size is determined by the constant
:MONO.DEFAULT_MAINBUF_SIZE
:CONT., which is 512.
:RSLTS.
This form of the &fn. creates a &obj.:PERIOD.
:SALSO.
:SAL typ='mfun'.doallocate
:SAL typ='dtor'.
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='ctor' prot='public'.strstreambuf
:SNPL.
:SNPFLF                    .#include <strstrea.h>
:SNPFLF                    .public:
:SNPCD cd_idx='c'.strstreambuf::strstreambuf( int alloc_size );
:eSNPL.
:SMTICS.
This form of the &fn. creates an empty &obj. that uses dynamic allocation.
No buffer is allocated to start. Whenever characters are written to extend
the &obj., the &rsvarea. is reallocated and copied as required. The size
of the first allocation is determined by the
:ARG.alloc_size
parameter, unless changed by a call to the
:MONO.setbuf
or
:MONO.alloc_size_increment
member functions.
:P.
Note that the
:ARG.alloc_size
parameter is the starting &rsvarea. size. When the &rsvarea. is reallocated,
the &obj. uses
:MONO.DEFAULT_MAINBUF_SIZE
to increase the &rsvarea. size, unless the
:MONO.setbuf
or
:MONO.alloc_size_increment
member functions have been called to specify a new allocation size.
:RSLTS.
This form of the &fn. creates a &obj.:PERIOD.
:SALSO.
:SAL typ='mfun'.alloc_size_increment
:SAL typ='mfun'.doallocate
:SAL typ='mfun'.setbuf
:SAL typ='dtor'.
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='ctor' prot='public'.strstreambuf
:SNPL.
:SNPFLF          .#include <strstrea.h>
:SNPFLF          .public:
:SNPCD cd_idx='c'.strstreambuf::strstreambuf( void * (*alloc_fn)( long ),
:SNPFLF          .                            void   (*free_fn)( void * ) );
:eSNPL.
:SMTICS.
This form of the &fn. creates an empty &obj. that uses dynamic allocation.
No buffer is allocated to start. Whenever characters are written to extend
the &obj., the &rsvarea. is reallocated and copied as required, using the
specified
:ARG.alloc_fn
and
:ARG.free_fn
functions.
The size of allocation is determined by the class unless the
:MONO.setbuf
or
:MONO.alloc_size_increment
member functions are called to change the allocation size.
The default allocation size is determined by the constant
:MONO.DEFAULT_MAINBUF_SIZE
:CONT., which is 512.
:P.
When a new &rsvarea. is allocated, the function specified by the
:ARG.alloc_fn
parameter is called with a
:MONO.long integer
value indicating the number of bytes to allocate.
If
:ARG.alloc_fn
is &null., the
:MONO.operator~bnew
intrinsic function is used.
Likewise, when the &rsvarea. is freed, the function specified by the
:ARG.free_fn
parameter is called with the pointer returned by the
:ARG.alloc_fn
function as the parameter.
If
:ARG.free_fn
is &null., the
:MONO.operator~bdelete
intrinsic function is used.
:RSLTS.
This form of the &fn. creates a &obj.:PERIOD.
:SALSO.
:SAL typ='mfun'.alloc_size_increment
:SAL typ='mfun'.doallocate
:SAL typ='mfun'.setbuf
:SAL typ='dtor'.
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='ctor' prot='public'.strstreambuf
:SNPL.
:SNPFLF          .#include <strstrea.h>
:SNPFLF          .public:
:SNPCD cd_idx='c'.strstreambuf::strstreambuf( char *str,
:SNPFLF          .                            int len,
:SNPFLF          .                            char *pstart = NULL );
:SNPCD cd_idx='c'.strstreambuf::strstreambuf( signed char *str,
:SNPFLF          .                            int len,
:SNPFLF          .                            signed char *pstart = NULL );
:SNPCD cd_idx='c'.strstreambuf::strstreambuf( unsigned char *str,
:SNPFLF          .                            int len,
:SNPFLF          .                            unsigned char *pstart = NULL );
:eSNPL.
:SMTICS.
This form of the &fn. creates a &obj. that does not use dynamic
allocation (unless
:ARG.str
is &null.). The &obj. is said to be using static allocation. The
:ARG.str
and
:ARG.len
parameters specify the bounds of the &rsvarea.:PERIOD.
:INCLUDE file='str_b'.
:P.
If the &getarea. is exhausted and characters have been written to the
&putarea., the &getarea. is extended to include the &putarea.:PERIOD.
:P.
The &getptr. and &putptr. do not necessarily point at the
same position in the &rsvarea., so a read followed by a write does not
imply that the write stores following the last character read.
The &getptr. is positioned following the last read operation, and
the &putptr. is positioned following the last write operation, unless the
:MONO.seekoff
member function has been used to reposition the pointer(s).
:P.
Note that if
:ARG.str
is &null. the effect is to create an empty dynamic &obj.:PERIOD.
:RSLTS.
This form of the &fn. creates a &obj.:PERIOD.
:SALSO.
:SAL typ='dtor'.
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='dtor' prot='public'.~~strstreambuf
:SNPL.
:SNPFLF                   .#include <strstrea.h>
:SNPFLF                   .public:
:SNPCD cd_idx='d'.strstreambuf::~~strstreambuf();
:eSNPL.
:SMTICS.
The &fn. destroys the &obj. after discarding the &rsvarea.:PERIOD.
The &rsvarea. is
discarded only if the &obj. is using dynamic allocation and is not frozen.
The &rsvarea. is freed using the free function specified by the form of the
constructor that allows specification of the allocate and free functions,
or using the
:MONO.operator~bdelete
intrinsic function.
If the &obj. is frozen or using static allocation, the user of the &obj.
must have a pointer to the &rsvarea. and is responsible for freeing it.
The call to the &fn. is inserted implicitly by the compiler
at the point where the &obj. goes out of scope.
:RSLTS.
The &obj. is destroyed.
:SALSO.
:SAL typ='ctor'.
:eSALSO.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public virtual'.sync
:SNPL.
:SNPFLF           .#include <strstrea.h>
:SNPFLF           .public:
:SNPF index='sync'.virtual int strstreambuf::sync();
:eSNPL.
:SMTICS.
The &fn. does nothing because there is no external device with which to
synchronize.
:RSLTS.
The &fn. returns &noteof.:PERIOD.
:eLIBF.
:CMT.========================================================================
:LIBF fmt='mfun' prot='public virtual'.underflow
:SNPL.
:SNPFLF                .#include <strstrea.h>
:SNPFLF                .public:
:SNPF index='underflow'.virtual int strstreambuf::underflow();
:eSNPL.
:SMTICS.
The &fn. provides the input communication between the
:MONO.streambuf
member functions and the &obj.:PERIOD.
Member functions in the
:MONO.streambuf
class call the &fn. when the &getarea. is empty.
:P.
If there is a non-empty &putarea. present following the &getarea.,
the &getarea. is extended to include the &putarea., allowing the
input operation to continue using the &putarea.:PERIOD.
Otherwise the &getarea. cannot be extended.
:RSLTS.
The &fn. returns the first available character in the &getarea. on successful
extension, otherwise &eof. is returned.
:SALSO.
:SAL typ='ofun' ocls='streambuf'.underflow
:SAL typ='mfun'.overflow
:eSALSO.
:eLIBF.

⌨️ 快捷键说明

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