home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / c++ / sbuf.prot.z / sbuf.prot
Encoding:
Text File  |  1998-10-30  |  38.8 KB  |  463 lines

  1.  
  2.  
  3.  
  4. SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))                                                SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      streambuf - interface for derived classes
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh_>>>>
  13.  
  14.      _tttt_yyyy_pppp_eeee_dddd_eeee_ffff _llll_oooo_nnnn_gggg _ssss_tttt_rrrr_eeee_aaaa_mmmm_oooo_ffff_ffff_,,,, _ssss_tttt_rrrr_eeee_aaaa_mmmm_pppp_oooo_ssss_;;;;
  15.      _cccc_llll_aaaa_ssss_ssss _iiii_oooo_ssss _{{{{
  16.      _pppp_uuuu_bbbb_llll_iiii_cccc_::::
  17.                _eeee_nnnn_uuuu_mmmm      _ssss_eeee_eeee_kkkk______dddd_iiii_rrrr _{{{{ _bbbb_eeee_gggg_,,,, _cccc_uuuu_rrrr_,,,, _eeee_nnnn_dddd _}}}}_;;;;
  18.                _eeee_nnnn_uuuu_mmmm      _oooo_pppp_eeee_nnnn______mmmm_oooo_dddd_eeee _{{{{ _iiii_nnnn_,,,, _oooo_uuuu_tttt_,,,, _aaaa_tttt_eeee_,,,, _aaaa_pppp_pppp_,,,, _tttt_rrrr_uuuu_nnnn_cccc_,,,, _nnnn_oooo_cccc_rrrr_eeee_aaaa_tttt_eeee_,,,, _nnnn_oooo_rrrr_eeee_pppp_llll_aaaa_cccc_eeee _}}}} _;;;;
  19.                _////_//// _aaaa_nnnn_dddd _llll_oooo_tttt_ssss _oooo_ffff _oooo_tttt_hhhh_eeee_rrrr _ssss_tttt_uuuu_ffff_ffff_,,,, _ssss_eeee_eeee _iiii_oooo_ssss_((((_3333_CCCC_++++_++++_)))) _...._...._....
  20.      _}}}} _;;;;
  21.  
  22.      _cccc_llll_aaaa_ssss_ssss _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff _{{{{
  23.      _pppp_uuuu_bbbb_llll_iiii_cccc_::::
  24.                          _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_((((_)))) _;;;;
  25.                          _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_((((_cccc_hhhh_aaaa_rrrr_**** _pppp_,,,, _iiii_nnnn_tttt _llll_eeee_nnnn_))))_;;;;
  26.                _vvvv_oooo_iiii_dddd      _dddd_bbbb_pppp_((((_)))) _;;;;
  27.      _pppp_rrrr_oooo_tttt_eeee_cccc_tttt_eeee_dddd_::::
  28.                _iiii_nnnn_tttt       _aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_((((_))))_;;;;
  29.                _cccc_hhhh_aaaa_rrrr_****     _bbbb_aaaa_ssss_eeee_((((_))))_;;;;
  30.                _iiii_nnnn_tttt       _bbbb_llll_eeee_nnnn_((((_))))_;;;;
  31.                _cccc_hhhh_aaaa_rrrr_****     _eeee_bbbb_aaaa_cccc_kkkk_((((_))))_;;;;
  32.                _cccc_hhhh_aaaa_rrrr_****     _eeee_bbbb_uuuu_ffff_((((_))))_;;;;
  33.                _cccc_hhhh_aaaa_rrrr_****     _eeee_gggg_pppp_tttt_rrrr_((((_))))_;;;;
  34.                _cccc_hhhh_aaaa_rrrr_****     _eeee_pppp_pppp_tttt_rrrr_((((_))))_;;;;
  35.                _vvvv_oooo_iiii_dddd      _gggg_bbbb_uuuu_mmmm_pppp_((((_iiii_nnnn_tttt _nnnn_))))_;;;;
  36.                _cccc_hhhh_aaaa_rrrr_****     _gggg_pppp_tttt_rrrr_((((_))))_;;;;
  37.                _cccc_hhhh_aaaa_rrrr_****     _pppp_bbbb_aaaa_ssss_eeee_((((_))))_;;;;
  38.                _vvvv_oooo_iiii_dddd      _pppp_bbbb_uuuu_mmmm_pppp_((((_iiii_nnnn_tttt _nnnn_))))_;;;;
  39.                _cccc_hhhh_aaaa_rrrr_****     _pppp_pppp_tttt_rrrr_((((_))))_;;;;
  40.                _vvvv_oooo_iiii_dddd      _ssss_eeee_tttt_gggg_((((_cccc_hhhh_aaaa_rrrr_**** _eeee_bbbb_,,,, _cccc_hhhh_aaaa_rrrr_**** _gggg_,,,, _cccc_hhhh_aaaa_rrrr_**** _eeee_gggg_))))_;;;;
  41.                _vvvv_oooo_iiii_dddd      _ssss_eeee_tttt_pppp_((((_cccc_hhhh_aaaa_rrrr_**** _pppp_,,,, _cccc_hhhh_aaaa_rrrr_**** _eeee_pppp_))))_;;;;
  42.                _vvvv_oooo_iiii_dddd      _ssss_eeee_tttt_bbbb_((((_cccc_hhhh_aaaa_rrrr_**** _bbbb_,,,, _cccc_hhhh_aaaa_rrrr_**** _eeee_bbbb_,,,, _iiii_nnnn_tttt _aaaa_====_0000_))))_;;;;
  43.                _iiii_nnnn_tttt       _uuuu_nnnn_bbbb_uuuu_ffff_ffff_eeee_rrrr_eeee_dddd_((((_))))_;;;;
  44.                _vvvv_oooo_iiii_dddd      _uuuu_nnnn_bbbb_uuuu_ffff_ffff_eeee_rrrr_eeee_dddd_((((_iiii_nnnn_tttt_))))_;;;;
  45.  
  46.                _vvvv_iiii_rrrr_tttt_uuuu_aaaa_llll _iiii_nnnn_tttt _dddd_oooo_aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_((((_))))_;;;;
  47.                _vvvv_iiii_rrrr_tttt_uuuu_aaaa_llll   _~~~~_ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_((((_)))) _;;;;
  48.      _pppp_uuuu_bbbb_llll_iiii_cccc_::::
  49.                _vvvv_iiii_rrrr_tttt_uuuu_aaaa_llll _iiii_nnnn_tttt_pppp_bbbb_aaaa_cccc_kkkk_ffff_aaaa_iiii_llll_((((_iiii_nnnn_tttt _cccc_))))_;;;;
  50.                _vvvv_iiii_rrrr_tttt_uuuu_aaaa_llll _iiii_nnnn_tttt_oooo_vvvv_eeee_rrrr_ffff_llll_oooo_wwww_((((_iiii_nnnn_tttt _cccc_====_EEEE_OOOO_FFFF_))))_;;;;
  51.                _vvvv_iiii_rrrr_tttt_uuuu_aaaa_llll _iiii_nnnn_tttt_uuuu_nnnn_dddd_eeee_rrrr_ffff_llll_oooo_wwww_((((_))))_;;;;
  52.                _vvvv_iiii_rrrr_tttt_uuuu_aaaa_llll _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_****
  53.                          _ssss_eeee_tttt_bbbb_uuuu_ffff_((((_cccc_hhhh_aaaa_rrrr_**** _pppp_,,,, _iiii_nnnn_tttt _llll_eeee_nnnn_))))_;;;;
  54.                _vvvv_iiii_rrrr_tttt_uuuu_aaaa_llll _ssss_tttt_rrrr_eeee_aaaa_mmmm_pppp_oooo_ssss
  55.                          _ssss_eeee_eeee_kkkk_pppp_oooo_ssss_((((_ssss_tttt_rrrr_eeee_aaaa_mmmm_pppp_oooo_ssss_,,,, _iiii_nnnn_tttt _====_iiii_oooo_ssss_::::_::::_iiii_nnnn_||||_iiii_oooo_ssss_::::_oooo_uuuu_tttt_))))_;;;;
  56.                _vvvv_iiii_rrrr_tttt_uuuu_aaaa_llll _ssss_tttt_rrrr_eeee_aaaa_mmmm_pppp_oooo_ssss
  57.                          _ssss_eeee_eeee_kkkk_oooo_ffff_ffff_((((_ssss_tttt_rrrr_eeee_aaaa_mmmm_oooo_ffff_ffff_,,,, _ssss_eeee_eeee_kkkk______dddd_iiii_rrrr_,,,, _iiii_nnnn_tttt _====_iiii_oooo_ssss_::::_::::_iiii_nnnn_||||_iiii_oooo_ssss_::::_oooo_uuuu_tttt_))))_;;;;
  58.                _vvvv_iiii_rrrr_tttt_uuuu_aaaa_llll _iiii_nnnn_tttt_ssss_yyyy_nnnn_cccc_((((_))))_;;;;
  59.      _}}}}_;;;;
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))                                                SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  75.      _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffffs implement the buffer abstraction described in _ssss_bbbb_uuuu_ffff_...._pppp_uuuu_bbbb(3C++).
  76.      However, the _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff class itself contains only basic members for
  77.      manipulating the characters and normally a class derived from _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff
  78.      will be used.  This man page describes the interface needed by
  79.      programmers who are coding a derived class.  Broadly speaking there are
  80.      two kinds of member functions described here.  The non-virtual functions
  81.      are provided for manipulating a _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff in ways that are appropriate in
  82.      a derived class.  Their descriptions reveal details of the implementation
  83.      that would be inappropriate in the public interface.  The virtual
  84.      functions permit the derived class to specialize the _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff class in
  85.      ways appropriate to the specific sources and sinks that it is
  86.      implementing.  The descriptions of the virtual functions explain the
  87.      obligations of the virtuals of the derived class.  If the virtuals behave
  88.      as specified, the _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff will behave as specified in the public
  89.      interface.  However, if the virtuals do not behave as specified, then the
  90.      _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff may not behave properly, and an _iiii_oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm (or any other code)
  91.      that relies on proper behavior of the _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff may not behave properly
  92.      either.
  93.  
  94.      In the following descriptions assume:
  95.      - _s_b is a _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_****.
  96.      - _i and _n are _iiii_nnnn_tttts.
  97.      - _p_t_r, _b, _e_b, _p, _e_p, _e_b, _g, and _e_g are _cccc_hhhh_aaaa_rrrr_****s.
  98.      - _c is an _iiii_nnnn_tttt character (positive or _EEEE_OOOO_FFFF)).
  99.      - _p_o_s is a _ssss_tttt_rrrr_eeee_aaaa_mmmm_pppp_oooo_ssss. (See _ssss_bbbb_uuuu_ffff_...._pppp_uuuu_bbbb(3C++).)
  100.      - _o_f_f is a _ssss_tttt_rrrr_eeee_aaaa_mmmm_oooo_ffff_ffff.
  101.      - _d_i_r is a _ssss_eeee_eeee_kkkk_dddd_iiii_rrrr.
  102.      - _m_o_d_e is an _iiii_nnnn_tttt representing an _oooo_pppp_eeee_nnnn______mmmm_oooo_dddd_eeee.
  103.  
  104.    CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss::::
  105.           _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_((((_))))
  106.                Constructs an empty buffer corresponding to an empty sequence.
  107.  
  108.           _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_((((_b_,,,,_l_e_n_))))
  109.                Constructs an empty buffer and then sets up the reserve area to
  110.                be the _l_e_n bytes starting at _b.
  111.  
  112.    TTTThhhheeee GGGGeeeetttt,,,, PPPPuuuutttt,,,, aaaannnndddd RRRReeeesssseeeerrrrvvvveeeerrrr aaaarrrreeeeaaaa
  113.      The protected members of _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff present an interface to derived
  114.      classes organized around three areas (arrays of bytes) managed
  115.      cooperatively by the base and derived classes.  They are the _g_e_t _a_r_e_a,
  116.      the _p_u_t _a_r_e_a, and the _r_e_s_e_r_v_e _a_r_e_a (or buffer).  The get and the put
  117.      areas are normally disjoint, but they may both overlap the reserve area,
  118.      whose primary purpose is to be a resource in which space for the put and
  119.      get areas can be allocated.  The get and the put areas are changed as
  120.      characters are put into and gotten from the buffer, but the reserve area
  121.      normally remains fixed.  The areas are defined by a collection of _cccc_hhhh_aaaa_rrrr_****
  122.      values.  The buffer abstraction is described in terms of pointers that
  123.      point between characters, but the _cccc_hhhh_aaaa_rrrr_**** values must point at _cccc_hhhh_aaaa_rrrrs.  To
  124.      establish a correspondence the _cccc_hhhh_aaaa_rrrr_**** values should be thought of as
  125.      pointing just before the byte they really point at.
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))                                                SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.    FFFFuuuunnnnccccttttiiiioooonnnnssss ttttoooo eeeexxxxaaaammmmiiiinnnneeee tttthhhheeee ppppooooiiiinnnntttteeeerrrrssss
  141.           _p_t_r_====_s_b_----_>>>>_bbbb_aaaa_ssss_eeee_((((_))))
  142.                Returns a pointer to the first byte of the reserve area.  Space
  143.                between _s_b_----_>>>>_bbbb_aaaa_ssss_eeee_((((_)))) and _s_b_----_>>>>_eeee_bbbb_uuuu_ffff_((((_)))) is the reserve area.
  144.  
  145.           _p_t_r_====_s_b_----_>>>>_eeee_bbbb_aaaa_cccc_kkkk_((((_))))
  146.                Returns a pointer to a lower bound on _s_b_----_>>>>_gggg_pppp_tttt_rrrr_((((_)))).  Space
  147.                between _s_b_----_>>>>_eeee_bbbb_aaaa_cccc_kkkk_((((_)))) and _s_b_----_>>>>_gggg_pppp_tttt_rrrr_((((_)))) is available for putback.
  148.  
  149.           _p_t_r_====_s_b_----_>>>>_eeee_bbbb_uuuu_ffff_((((_))))
  150.                Returns a pointer to the byte after the last byte of the
  151.                reserve area.
  152.  
  153.           _p_t_r_====_s_b_----_>>>>_eeee_gggg_pppp_tttt_rrrr_((((_))))
  154.                Returns a pointer to the byte after the last byte of the get
  155.                area.
  156.  
  157.           _p_t_r_====_s_b_----_>>>>_eeee_pppp_pppp_tttt_rrrr_((((_))))
  158.                Returns a pointer to the byte after the last byte of the put
  159.                area.
  160.  
  161.           _p_t_r_====_s_b_----_>>>>_gggg_pppp_tttt_rrrr_((((_))))
  162.                Returns a pointer to the first byte of the get area.  The
  163.                available characters are those between _s_b_----_>>>>_gggg_pppp_tttt_rrrr_((((_)))) and
  164.                _s_b_----_>>>>_eeee_gggg_pppp_tttt_rrrr_((((_)))).  The next character fetched will be _****_s_b_----_>>>>_gggg_pppp_tttt_rrrr_((((_))))_))))
  165.                unless _s_b_----_>>>>_eeee_gggg_pppp_tttt_rrrr_((((_)))) is less than or equal to _s_b_----_>>>>_gggg_pppp_tttt_rrrr_((((_)))).
  166.  
  167.           _p_t_r_====_s_b_----_>>>>_pppp_bbbb_aaaa_ssss_eeee_((((_))))
  168.                Returns a pointer to the put area base.  Characters between
  169.                _s_b_----_>>>>_pppp_bbbb_aaaa_ssss_eeee_((((_)))) and _s_b_----_>>>>_pppp_pppp_tttt_rrrr_((((_)))) have been stored into the buffer and
  170.                not yet consumed.
  171.  
  172.           _p_t_r_====_s_b_----_>>>>_pppp_pppp_tttt_rrrr_((((_))))
  173.                Returns a pointer to the first byte of the put area.  The space
  174.                between _ssss_bbbb_----_>>>>_pppp_pppp_tttt_rrrr_((((_)))) and _ssss_bbbb_----_>>>>_eeee_pppp_pppp_tttt_rrrr_((((_)))) is the put area and
  175.                characters will be stored here.
  176.  
  177.    FFFFuuuunnnnccccttttiiiioooonnnnssss ffffoooorrrr sssseeeettttttttiiiinnnngggg tttthhhheeee ppppooooiiiinnnntttteeeerrrrssss
  178.      Note that to indicate that a particular area (get, put, or reserve) does
  179.      not exist, all the associated pointers should be set to zero.
  180.  
  181.           _s_b_----_>>>>_ssss_eeee_tttt_bbbb_((((_b_,,,, _e_b_,,,, _i_))))
  182.                Sets _bbbb_aaaa_ssss_eeee_((((_)))) and _eeee_bbbb_uuuu_ffff_((((_)))) to _b and _e_b respectively.  _i controls
  183.                whether the area will be subject to automatic deletion.  If _i
  184.                is non-zero, then _b will be deleted when _bbbb_aaaa_ssss_eeee is changed by
  185.                another call of _ssss_eeee_tttt_bbbb_((((_)))), or when the destructor is called for
  186.                _****_s_b.  If _b and _e_b are both null then we say that there is no
  187.                reserve area.  If _b is non-null, there is a reserve area even
  188.                if _e_b is less than _b and so the reserve area has zero length.
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))                                                SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))
  203.  
  204.  
  205.  
  206.           _s_b_----_>>>>_ssss_eeee_tttt_pppp_((((_p_,,,, _e_p_))))
  207.                Sets _pppp_pppp_tttt_rrrr_((((_)))) to _p, _pppp_bbbb_aaaa_ssss_eeee_((((_)))) to _p, and _eeee_pppp_pppp_tttt_rrrr_((((_)))) to _e_p.
  208.  
  209.           _s_b_----_>>>>_ssss_eeee_tttt_gggg_((((_e_b_,,,, _g_,,,, _e_g_))))
  210.                Sets _eeee_bbbb_aaaa_cccc_kkkk_((((_)))) to _e_b, _gggg_pppp_tttt_rrrr_((((_)))) to _g, and _eeee_gggg_pppp_tttt_rrrr_((((_)))) to _e_g.
  211.  
  212.    OOOOtttthhhheeeerrrr nnnnoooonnnn----vvvviiiirrrrttttuuuuaaaallll mmmmeeeemmmmbbbbeeeerrrrssss
  213.           _i_====_s_b_----_>>>>_aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_((((_))))
  214.                Tries to set up a reserve area.  If a reserve area already
  215.                exists or if _s_b_----_>>>>_uuuu_nnnn_bbbb_uuuu_ffff_ffff_eeee_rrrr_eeee_dddd_((((_)))) is nonzero, _aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_((((_)))) returns 0
  216.                without doing anything.  If the attempt to allocate space
  217.                fails, _aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_((((_)))) returns _EEEE_OOOO_FFFF, otherwise (allocation succeeds)
  218.                _aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_((((_)))) returns 1.  _aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_((((_)))) is not called by any non-
  219.                virtual member function of _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff.
  220.  
  221.           _i_====_s_b_----_>>>>_bbbb_llll_eeee_nnnn_((((_))))
  222.                Returns the size (in _cccc_hhhh_aaaa_rrrrs) of the current reserve area.
  223.  
  224.           _dddd_bbbb_pppp_((((_))))
  225.                Writes directly on file descriptor 1 information in ASCII about
  226.                the state of the buffer.  It is intended for debugging and
  227.                nothing is specified about the form of the output.  It is
  228.                considered part of the protected interface because the
  229.                information it prints can only be understood in relation to
  230.                that interface, but it is a public function so that it can be
  231.                called anywhere during debugging.
  232.  
  233.           _s_b_----_>>>>_gggg_bbbb_uuuu_mmmm_pppp_((((_n_))))
  234.                Increments _gggg_pppp_tttt_rrrr_((((_)))) by _n which may be positive or negative.  No
  235.                checks are made on whether the new value of _gggg_pppp_tttt_rrrr_((((_)))) is in
  236.                bounds.
  237.  
  238.           _s_b_----_>>>>_pppp_bbbb_uuuu_mmmm_pppp_((((_n_))))
  239.                Increments _pppp_pppp_tttt_rrrr_((((_)))) by _n which may be positive or negative.  No
  240.                checks are made on whether the new value of _pppp_pppp_tttt_rrrr_((((_)))) is in
  241.                bounds.
  242.  
  243.           _s_b_----_>>>>_uuuu_nnnn_bbbb_uuuu_ffff_ffff_eeee_rrrr_eeee_dddd_((((_iiii_))))
  244.           _i_====_s_b_----_>>>>_uuuu_nnnn_bbbb_uuuu_ffff_ffff_eeee_rrrr_eeee_dddd_((((_))))
  245.                There is a private variable known as _s_b's buffering state.
  246.                _s_b_----_>>>>_uuuu_nnnn_bbbb_uuuu_ffff_ffff_eeee_rrrr_eeee_dddd_((((_i_)))) sets the value of this variable to _i and _s_b_----
  247.                _>>>>_uuuu_nnnn_bbbb_uuuu_ffff_ffff_eeee_rrrr_eeee_dddd_((((_)))) returns the current value.  This state is
  248.                independent of the actual allocation of a reserve area.  Its
  249.                primary purpose is to control whether a reserve area is
  250.                allocated automatically by _aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee.
  251.  
  252.    VVVViiiirrrrttttuuuuaaaallll mmmmeeeemmmmbbbbeeeerrrr ffffuuuunnnnccccttttiiiioooonnnnssss
  253.      Virtual functions may be redefined in derived classes to specialize the
  254.      behavior of _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffffs.  This section describes the behavior that these
  255.      virtual functions should have in any derived classes; the next section
  256.      describes the behavior that these functions are defined to have in base
  257.      class _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff.
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))                                                SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))
  269.  
  270.  
  271.  
  272.           _i_====_s_b_----_>>>>_dddd_oooo_aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_((((_))))
  273.                Is called when _aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_((((_)))) determines that space is needed.
  274.                _dddd_oooo_aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_((((_)))) is required to call _ssss_eeee_tttt_bbbb_((((_)))) to provide a reserve
  275.                area or to return _EEEE_OOOO_FFFF if it cannot.  It is only called if
  276.                _s_b_----_>>>>_uuuu_nnnn_bbbb_uuuu_ffff_ffff_eeee_rrrr_eeee_dddd_((((_)))) is zero and _s_b_----_>>>>_bbbb_aaaa_ssss_eeee_((((_)))) is zero.
  277.  
  278.           _i_====_oooo_vvvv_eeee_rrrr_ffff_llll_oooo_wwww_((((_c_))))
  279.                Is called to consume characters.  If _c is not _EEEE_OOOO_FFFF, _oooo_vvvv_eeee_rrrr_ffff_llll_oooo_wwww_((((_))))
  280.                also must either save _c or consume it. Usually it is called
  281.                when the put area is full and an attempt is being made to store
  282.                a new character, but it can be called at other times.  The
  283.                normal action is to consume the characters between _pppp_bbbb_aaaa_ssss_eeee_((((_)))) and
  284.                _pppp_pppp_tttt_rrrr_((((_)))), call _ssss_eeee_tttt_pppp_((((_)))) to establish a new put area, and if _c_!!!!_====_EEEE_OOOO_FFFF
  285.                store it (using _ssss_pppp_uuuu_tttt_cccc_((((_))))).  _s_b_----_>>>>_oooo_vvvv_eeee_rrrr_ffff_llll_oooo_wwww_((((_)))) should return _EEEE_OOOO_FFFF to
  286.                indicate an error; otherwise it should return something else.
  287.  
  288.           _i_====_s_b_----_>>>>_pppp_bbbb_aaaa_cccc_kkkk_ffff_aaaa_iiii_llll_((((_c_))))
  289.                Is called when _eeee_bbbb_aaaa_cccc_kkkk_((((_)))) equals _gggg_pppp_tttt_rrrr_((((_)))) and an attempt has been
  290.                made to putback _c.  If this situation can be dealt with (e.g.,
  291.                by repositioning an external file), _pppp_bbbb_aaaa_cccc_kkkk_ffff_aaaa_iiii_llll_((((_)))) should return
  292.                _c; otherwise it should return _EEEE_OOOO_FFFF.
  293.  
  294.           _p_o_s_====_s_b_----_>>>>_ssss_eeee_eeee_kkkk_oooo_ffff_ffff_((((_o_f_f_,,,, _d_i_r_,,,, _m_o_d_e_))))
  295.                Repositions the get and/or put pointers  (i.e., the abstract
  296.                get and put pointers, not _pppp_pppp_tttt_rrrr_((((_)))) and _gggg_pppp_tttt_rrrr_((((_))))).  The meanings of
  297.                _o_f_f and _d_i_r are discussed in _ssss_bbbb_uuuu_ffff_...._pppp_uuuu_bbbb(3C++).  _m_o_d_e specifies
  298.                whether the put pointer (_iiii_oooo_ssss_::::_::::_oooo_uuuu_tttt bit set) or the get pointer
  299.                (_iiii_oooo_ssss_::::_::::_iiii_nnnn bit set) is to be modified.  Both bits may be set in
  300.                which case both pointers should be affected.  A class derived
  301.                from _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff is not required to support repositioning.
  302.                _ssss_eeee_eeee_kkkk_oooo_ffff_ffff_((((_)))) should return _EEEE_OOOO_FFFF if the class does not support
  303.                repositioning.  If the class does support repositioning,
  304.                _ssss_eeee_eeee_kkkk_oooo_ffff_ffff_((((_)))) should return the new position or _EEEE_OOOO_FFFF on error.
  305.  
  306.           _p_o_s_====_s_b_----_>>>>_ssss_eeee_eeee_kkkk_pppp_oooo_ssss_((((_p_o_s_,,,, _m_o_d_e_))))
  307.                Repositions the _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff get and/or put pointer to _p_o_s.  _m_o_d_e
  308.                specifies which pointers are affected as for _ssss_eeee_eeee_kkkk_oooo_ffff_ffff_((((_)))).
  309.                Returns _p_o_s (the argument) or _EEEE_OOOO_FFFF if the class does not support
  310.                repositioning or an error occurs.
  311.  
  312.           _s_b_====_s_b_----_>>>>_ssss_eeee_tttt_bbbb_uuuu_ffff_((((_p_t_r_,,,, _l_e_n_))))
  313.                Offers the array at _p_t_r with _l_e_n bytes to be used as a reserve
  314.                area.  The normal interpretation is that if _p_t_r or _l_e_n are zero
  315.                then this is a request to make the _s_b unbuffered.  The derived
  316.                class may use this area or not as it chooses.  It may accept or
  317.                ignore the request for unbuffered state as it chooses.
  318.                _ssss_eeee_tttt_bbbb_uuuu_ffff_((((_)))) should return _s_b if it honors the request.  Otherwise
  319.                it should return 0.
  320.  
  321.           _iiii_====_s_b_----_>>>>_ssss_yyyy_nnnn_cccc_((((_))))
  322.                Is called to give the derived class a chance to look at the
  323.                state of the areas, and synchronize them with any external
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))                                                SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))
  335.  
  336.  
  337.  
  338.                representation.  Normally _ssss_yyyy_nnnn_cccc_((((_)))) should consume any characters
  339.                that have been stored into the put area, and if possible give
  340.                back to the source any characters in the get area that have not
  341.                been fetched.  When _ssss_yyyy_nnnn_cccc_((((_)))) returns there should not be any
  342.                unconsumed characters, and the get area should be empty.
  343.                _ssss_yyyy_nnnn_cccc_((((_)))) should return _EEEE_OOOO_FFFF if some kind of failure occurs.
  344.  
  345.           _i_====_s_b_----_>>>>_uuuu_nnnn_dddd_eeee_rrrr_ffff_llll_oooo_wwww_((((_))))
  346.                Is called to supply characters for fetching, i.e., to create a
  347.                condition in which the get area is not empty.  If it is called
  348.                when there are characters in the get area it should return the
  349.                first character.  If the get area is empty, it should create a
  350.                nonempty get area and return the next character (which it
  351.                should also leave in the get area).  If there are no more
  352.                characters available, _uuuu_nnnn_dddd_eeee_rrrr_ffff_llll_oooo_wwww_((((_)))) should return _EEEE_OOOO_FFFF and leave
  353.                an empty get area.
  354.  
  355.      The default definitions of the virtual functions:
  356.  
  357.           _i_====_s_b_----_>>>>_ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_::::_::::_dddd_oooo_aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_((((_))))
  358.                Attempts to allocate a reserve area using _oooo_pppp_eeee_rrrr_aaaa_tttt_oooo_rrrr _nnnn_eeee_wwww.
  359.  
  360.           _i_====_s_b_----_>>>>_ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_::::_::::_oooo_vvvv_eeee_rrrr_ffff_llll_oooo_wwww_((((_c_))))
  361.                Is compatible with the old stream package, but that behavior is
  362.                not considered part of the specification of the iostream
  363.                package.  Therefore, _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_::::_::::_oooo_vvvv_eeee_rrrr_ffff_llll_oooo_wwww_((((_)))) should be treated as
  364.                if it had undefined behavior.  That is, derived classes should
  365.                always define it.
  366.  
  367.           _i_====_s_b_----_>>>>_ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_::::_::::_pppp_bbbb_aaaa_cccc_kkkk_ffff_aaaa_iiii_llll_((((_c_))))
  368.                Returns _EEEE_OOOO_FFFF.
  369.  
  370.           _p_o_s_====_s_b_----_>>>>_ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_::::_::::_ssss_eeee_eeee_kkkk_pppp_oooo_ssss_((((_p_o_s_,,,, _m_o_d_e_))))
  371.                Returns _s_b_----_>>>>_ssss_eeee_eeee_kkkk_oooo_ffff_ffff_((((_ssss_tttt_rrrr_eeee_aaaa_mmmm_oooo_ffff_ffff_((((_p_o_s_))))_,,,,_iiii_oooo_ssss_::::_::::_bbbb_eeee_gggg_,,,,_m_o_d_e_)))).  Thus to
  372.                define seeking in a derived class, it is frequently only
  373.                necessary to define _ssss_eeee_eeee_kkkk_oooo_ffff_ffff_((((_)))) and use the inherited
  374.                _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_::::_::::_ssss_eeee_eeee_kkkk_pppp_oooo_ssss_((((_)))).
  375.  
  376.           _p_o_s_====_s_b_----_>>>>_ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_::::_::::_ssss_eeee_eeee_kkkk_oooo_ffff_ffff_((((_o_f_f_,,,, _d_i_r_,,,, _m_o_d_e_))))
  377.                Returns _EEEE_OOOO_FFFF.
  378.  
  379.           _s_b_====_s_b_----_>>>>_ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_::::_::::_ssss_eeee_tttt_bbbb_uuuu_ffff_((((_p_t_r_,,,, _l_e_n_))))
  380.                Will honor the request when there is no reserve area.
  381.  
  382.           _i_====_s_b_----_>>>>_ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_::::_::::_ssss_yyyy_nnnn_cccc_((((_))))
  383.                Returns 0 if the get area is empty and there are no unconsumed
  384.                characters.  Otherwise it returns _EEEE_OOOO_FFFF.
  385.  
  386.           _iiii_====_s_b_----_>>>>_ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_::::_::::_uuuu_nnnn_dddd_eeee_rrrr_ffff_llll_oooo_wwww_((((_))))
  387.                Is compatible with the old stream package, but that behavior is
  388.                not considered part of the specification of the iostream
  389.                package.  Therefore, _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_::::_::::_uuuu_nnnn_dddd_eeee_rrrr_ffff_llll_oooo_wwww_((((_)))) should be treated
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))                                                SSSSBBBBUUUUFFFF....PPPPRRRROOOOTTTT((((3333CCCC++++++++))))
  401.  
  402.  
  403.  
  404.                as if it had undefined behavior.  That is, it should always be
  405.                defined in derived classes.
  406.  
  407. CCCCAAAAVVVVEEEEAAAATTTTSSSS
  408.      The constructors are public for compatibility with the old stream
  409.      package.  They ought to be protected.
  410.  
  411.      The interface for unbuffered actions is awkward.  It's hard to write
  412.      _uuuu_nnnn_dddd_eeee_rrrr_ffff_llll_oooo_wwww_((((_)))) and _oooo_vvvv_eeee_rrrr_ffff_llll_oooo_wwww_((((_)))) virtuals that behave properly for unbuffered
  413.      _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff_((((_))))s without special casing.  Also there is no way for the
  414.      virtuals to react sensibly to multi-character gets or puts.
  415.  
  416.      Although the public interface to _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffffs deals in characters and
  417.      bytes, the interface to derived classes deals in _cccc_hhhh_aaaa_rrrrs.  Since a decision
  418.      had to be made on the types of the real data pointers, it seemed easier
  419.      to reflect that choice in the types of the protected members than to
  420.      duplicate all the members with both plain and unsigned char versions.
  421.      But perhaps all these uses of _cccc_hhhh_aaaa_rrrr_**** ought to have been with a typedef.
  422.  
  423.      The implementation contains a variant of  _ssss_eeee_tttt_bbbb_uuuu_ffff_((((_)))) that accepts a third
  424.      argument.  It is present only for compatibility with the old stream
  425.      package.
  426.  
  427. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  428.      _ssss_bbbb_uuuu_ffff_...._pppp_uuuu_bbbb(3C++), _ssss_tttt_rrrr_eeee_aaaa_mmmm_bbbb_uuuu_ffff(3C++), _iiii_oooo_ssss(3C++) _iiii_ssss_tttt_rrrr_eeee_aaaa_mmmm(3C++) _oooo_ssss_tttt_rrrr_eeee_aaaa_mmmm(3C++)
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.                                                                         PPPPaaaaggggeeee 7777
  460.  
  461.  
  462.  
  463.