From Jason Turner

[streambuf]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpdxjj3t2k/{from.md → to.md} +32 -29
tmp/tmpdxjj3t2k/{from.md → to.md} RENAMED
@@ -1,7 +1,9 @@
1
  ### Class template `basic_streambuf` <a id="streambuf">[[streambuf]]</a>
2
 
 
 
3
  ``` cpp
4
  namespace std {
5
  template<class charT, class traits = char_traits<charT>>
6
  class basic_streambuf {
7
  public:
@@ -105,15 +107,15 @@ for deriving various *stream buffers* whose objects each control two
105
 
106
  ``` cpp
107
  basic_streambuf();
108
  ```
109
 
110
- *Effects:* Initializes:[^13]
111
 
112
  - all pointer member objects to null pointers,
113
- - the `getloc()` member to a copy the global locale, `locale()`, at the
114
- time of construction.
115
 
116
  *Remarks:* Once the `getloc()` member is initialized, results of calling
117
  locale member functions, and of members of facets so obtained, can
118
  safely be cached until the next time the member `imbue` is called.
119
 
@@ -382,11 +384,11 @@ functions and to members of facets so obtained.
382
  basic_streambuf* setbuf(char_type* s, streamsize n);
383
  ```
384
 
385
  *Effects:* Influences stream buffering in a way that is defined
386
  separately for each class derived from `basic_streambuf` in this
387
- Clause ([[stringbuf.virtuals]], [[filebuf.virtuals]]).
388
 
389
  *Default behavior:* Does nothing. Returns `this`.
390
 
391
  ``` cpp
392
  pos_type seekoff(off_type off, ios_base::seekdir way,
@@ -394,12 +396,12 @@ pos_type seekoff(off_type off, ios_base::seekdir way,
394
  = ios_base::in | ios_base::out);
395
  ```
396
 
397
  *Effects:* Alters the stream positions within one or more of the
398
  controlled sequences in a way that is defined separately for each class
399
- derived from `basic_streambuf` in this Clause ([[stringbuf.virtuals]],
400
- [[filebuf.virtuals]]).
401
 
402
  *Default behavior:* Returns `pos_type(off_type(-1))`.
403
 
404
  ``` cpp
405
  pos_type seekpos(pos_type sp,
@@ -407,12 +409,12 @@ pos_type seekpos(pos_type sp,
407
  = ios_base::in | ios_base::out);
408
  ```
409
 
410
  *Effects:* Alters the stream positions within one or more of the
411
  controlled sequences in a way that is defined separately for each class
412
- derived from `basic_streambuf` in this Clause ([[stringbuf]],
413
- [[filebuf]]).
414
 
415
  *Default behavior:* Returns `pos_type(off_type(-1))`.
416
 
417
  ``` cpp
418
  int sync();
@@ -429,14 +431,15 @@ each derived class [[filebuf.virtuals]].
429
  *Default behavior:* Returns zero.
430
 
431
  ##### Get area <a id="streambuf.virt.get">[[streambuf.virt.get]]</a>
432
 
433
  ``` cpp
434
- streamsize showmanyc();\footnote{The morphemes of showmanyc\
435
- are ``es-how-many-see'', not ``show-manic''.}
436
  ```
437
 
 
 
438
  *Returns:* An estimate of the number of characters available in the
439
  sequence, or -1. If it returns a positive value, then successive calls
440
  to `underflow()` will not return `traits::eof()` until at least that
441
  number of characters have been extracted from the stream. If
442
  `showmanyc()` returns -1, then calls to `underflow()` or `uflow()` will
@@ -462,18 +465,10 @@ to `sbumpc()` would return `traits::eof()`.
462
 
463
  ``` cpp
464
  int_type underflow();
465
  ```
466
 
467
- *Remarks:* The public members of `basic_streambuf` call this virtual
468
- function only if `gptr()` is null or `gptr() >= egptr()`.
469
-
470
- *Returns:* `traits::to_int_type(c)`, where `c` is the first *character*
471
- of the *pending sequence*, without moving the input sequence position
472
- past it. If the pending sequence is null then the function returns
473
- `traits::eof()` to indicate failure.
474
-
475
  The *pending sequence* of characters is defined as the concatenation of
476
 
477
  - the empty sequence if `gptr()` is null, otherwise the characters in
478
  \[`gptr()`, `egptr()`), followed by
479
  - some (possibly empty) sequence of characters read from the input
@@ -499,12 +494,20 @@ that either
499
  in which case the characters in \[`eback()`, `gptr()`) agree with the
500
  last `gptr() - eback()` characters of the backup sequence, or
501
  - the characters in \[`gptr() - n`, `gptr()`) agree with the backup
502
  sequence (where `n` is the length of the backup sequence).
503
 
 
 
 
 
 
504
  *Default behavior:* Returns `traits::eof()`.
505
 
 
 
 
506
  ``` cpp
507
  int_type uflow();
508
  ```
509
 
510
  *Preconditions:* The constraints are the same as for `underflow()`,
@@ -512,26 +515,21 @@ except that the result character is transferred from the pending
512
  sequence to the backup sequence, and the pending sequence is not empty
513
  before the transfer.
514
 
515
  *Default behavior:* Calls `underflow()`. If `underflow()` returns
516
  `traits::eof()`, returns `traits::eof()`. Otherwise, returns the value
517
- of `traits::to_int_type(*gptr())` and increment the value of the next
518
  pointer for the input sequence.
519
 
520
  *Returns:* `traits::eof()` to indicate failure.
521
 
522
  ##### Putback <a id="streambuf.virt.pback">[[streambuf.virt.pback]]</a>
523
 
524
  ``` cpp
525
  int_type pbackfail(int_type c = traits::eof());
526
  ```
527
 
528
- *Remarks:* The public functions of `basic_streambuf` call this virtual
529
- function only when `gptr()` is null, `gptr() == eback()`, or
530
- `traits::eq(traits::to_char_type(c), gptr()[-1])` returns `false`. Other
531
- calls shall also satisfy that constraint.
532
-
533
  The *pending sequence* is defined as for `underflow()`, with the
534
  modifications that
535
 
536
  - If `traits::eq_int_type(c, traits::eof())` returns `true`, then the
537
  input sequence is backed up one character before the pending sequence
@@ -543,17 +541,22 @@ modifications that
543
  *Ensures:* On return, the constraints of `gptr()`, `eback()`, and
544
  `pptr()` are the same as for `underflow()`.
545
 
546
  *Returns:* `traits::eof()` to indicate failure. Failure may occur
547
  because the input sequence could not be backed up, or if for some other
548
- reason the pointers could not be set consistent with the constraints.
549
  `pbackfail()` is called only when put back has really failed.
550
 
551
  Returns some value other than `traits::eof()` to indicate success.
552
 
553
  *Default behavior:* Returns `traits::eof()`.
554
 
 
 
 
 
 
555
  ##### Put area <a id="streambuf.virt.put">[[streambuf.virt.put]]</a>
556
 
557
  ``` cpp
558
  streamsize xsputn(const char_type* s, streamsize n);
559
  ```
@@ -579,14 +582,10 @@ of
579
  - the empty sequence if `pbase()` is null, otherwise the
580
  `pptr() - pbase()` characters beginning at `pbase()`, followed by
581
  - the empty sequence if `traits::eq_int_type(c, traits::eof())` returns
582
  `true`, otherwise the sequence consisting of `c`.
583
 
584
- *Remarks:* The member functions `sputc()` and `sputn()` call this
585
- function in case that no room can be found in the put buffer enough to
586
- accommodate the argument character sequence.
587
-
588
  *Preconditions:* Every overriding definition of this virtual function
589
  obeys the following constraints:
590
 
591
  - The effect of consuming a character on the associated output sequence
592
  is specified.[^16]
@@ -606,5 +605,9 @@ obeys the following constraints:
606
  Otherwise, returns some value other than `traits::eof()` to indicate
607
  success.[^17]
608
 
609
  *Default behavior:* Returns `traits::eof()`.
610
 
 
 
 
 
 
1
  ### Class template `basic_streambuf` <a id="streambuf">[[streambuf]]</a>
2
 
3
+ #### General <a id="streambuf.general">[[streambuf.general]]</a>
4
+
5
  ``` cpp
6
  namespace std {
7
  template<class charT, class traits = char_traits<charT>>
8
  class basic_streambuf {
9
  public:
 
107
 
108
  ``` cpp
109
  basic_streambuf();
110
  ```
111
 
112
+ *Effects:* Initializes:[^12]
113
 
114
  - all pointer member objects to null pointers,
115
+ - the `getloc()` member to a copy of the global locale, `locale()`, at
116
+ the time of construction.
117
 
118
  *Remarks:* Once the `getloc()` member is initialized, results of calling
119
  locale member functions, and of members of facets so obtained, can
120
  safely be cached until the next time the member `imbue` is called.
121
 
 
384
  basic_streambuf* setbuf(char_type* s, streamsize n);
385
  ```
386
 
387
  *Effects:* Influences stream buffering in a way that is defined
388
  separately for each class derived from `basic_streambuf` in this
389
+ Clause [[stringbuf.virtuals]], [[filebuf.virtuals]].
390
 
391
  *Default behavior:* Does nothing. Returns `this`.
392
 
393
  ``` cpp
394
  pos_type seekoff(off_type off, ios_base::seekdir way,
 
396
  = ios_base::in | ios_base::out);
397
  ```
398
 
399
  *Effects:* Alters the stream positions within one or more of the
400
  controlled sequences in a way that is defined separately for each class
401
+ derived from `basic_streambuf` in this
402
+ Clause [[stringbuf.virtuals]], [[filebuf.virtuals]].
403
 
404
  *Default behavior:* Returns `pos_type(off_type(-1))`.
405
 
406
  ``` cpp
407
  pos_type seekpos(pos_type sp,
 
409
  = ios_base::in | ios_base::out);
410
  ```
411
 
412
  *Effects:* Alters the stream positions within one or more of the
413
  controlled sequences in a way that is defined separately for each class
414
+ derived from `basic_streambuf` in this
415
+ Clause [[stringbuf]], [[filebuf]].
416
 
417
  *Default behavior:* Returns `pos_type(off_type(-1))`.
418
 
419
  ``` cpp
420
  int sync();
 
431
  *Default behavior:* Returns zero.
432
 
433
  ##### Get area <a id="streambuf.virt.get">[[streambuf.virt.get]]</a>
434
 
435
  ``` cpp
436
+ streamsize showmanyc();
 
437
  ```
438
 
439
+ [^13]
440
+
441
  *Returns:* An estimate of the number of characters available in the
442
  sequence, or -1. If it returns a positive value, then successive calls
443
  to `underflow()` will not return `traits::eof()` until at least that
444
  number of characters have been extracted from the stream. If
445
  `showmanyc()` returns -1, then calls to `underflow()` or `uflow()` will
 
465
 
466
  ``` cpp
467
  int_type underflow();
468
  ```
469
 
 
 
 
 
 
 
 
 
470
  The *pending sequence* of characters is defined as the concatenation of
471
 
472
  - the empty sequence if `gptr()` is null, otherwise the characters in
473
  \[`gptr()`, `egptr()`), followed by
474
  - some (possibly empty) sequence of characters read from the input
 
494
  in which case the characters in \[`eback()`, `gptr()`) agree with the
495
  last `gptr() - eback()` characters of the backup sequence, or
496
  - the characters in \[`gptr() - n`, `gptr()`) agree with the backup
497
  sequence (where `n` is the length of the backup sequence).
498
 
499
+ *Returns:* `traits::to_int_type(c)`, where `c` is the first *character*
500
+ of the *pending sequence*, without moving the input sequence position
501
+ past it. If the pending sequence is null then the function returns
502
+ `traits::eof()` to indicate failure.
503
+
504
  *Default behavior:* Returns `traits::eof()`.
505
 
506
+ *Remarks:* The public members of `basic_streambuf` call this virtual
507
+ function only if `gptr()` is null or `gptr() >= egptr()`.
508
+
509
  ``` cpp
510
  int_type uflow();
511
  ```
512
 
513
  *Preconditions:* The constraints are the same as for `underflow()`,
 
515
  sequence to the backup sequence, and the pending sequence is not empty
516
  before the transfer.
517
 
518
  *Default behavior:* Calls `underflow()`. If `underflow()` returns
519
  `traits::eof()`, returns `traits::eof()`. Otherwise, returns the value
520
+ of `traits::to_int_type(*gptr())` and increments the value of the next
521
  pointer for the input sequence.
522
 
523
  *Returns:* `traits::eof()` to indicate failure.
524
 
525
  ##### Putback <a id="streambuf.virt.pback">[[streambuf.virt.pback]]</a>
526
 
527
  ``` cpp
528
  int_type pbackfail(int_type c = traits::eof());
529
  ```
530
 
 
 
 
 
 
531
  The *pending sequence* is defined as for `underflow()`, with the
532
  modifications that
533
 
534
  - If `traits::eq_int_type(c, traits::eof())` returns `true`, then the
535
  input sequence is backed up one character before the pending sequence
 
541
  *Ensures:* On return, the constraints of `gptr()`, `eback()`, and
542
  `pptr()` are the same as for `underflow()`.
543
 
544
  *Returns:* `traits::eof()` to indicate failure. Failure may occur
545
  because the input sequence could not be backed up, or if for some other
546
+ reason the pointers cannot be set consistent with the constraints.
547
  `pbackfail()` is called only when put back has really failed.
548
 
549
  Returns some value other than `traits::eof()` to indicate success.
550
 
551
  *Default behavior:* Returns `traits::eof()`.
552
 
553
+ *Remarks:* The public functions of `basic_streambuf` call this virtual
554
+ function only when `gptr()` is null, `gptr() == eback()`, or
555
+ `traits::eq(traits::to_char_type(c), gptr()[-1])` returns `false`. Other
556
+ calls shall also satisfy that constraint.
557
+
558
  ##### Put area <a id="streambuf.virt.put">[[streambuf.virt.put]]</a>
559
 
560
  ``` cpp
561
  streamsize xsputn(const char_type* s, streamsize n);
562
  ```
 
582
  - the empty sequence if `pbase()` is null, otherwise the
583
  `pptr() - pbase()` characters beginning at `pbase()`, followed by
584
  - the empty sequence if `traits::eq_int_type(c, traits::eof())` returns
585
  `true`, otherwise the sequence consisting of `c`.
586
 
 
 
 
 
587
  *Preconditions:* Every overriding definition of this virtual function
588
  obeys the following constraints:
589
 
590
  - The effect of consuming a character on the associated output sequence
591
  is specified.[^16]
 
605
  Otherwise, returns some value other than `traits::eof()` to indicate
606
  success.[^17]
607
 
608
  *Default behavior:* Returns `traits::eof()`.
609
 
610
+ *Remarks:* The member functions `sputc()` and `sputn()` call this
611
+ function in case that no room can be found in the put buffer enough to
612
+ accommodate the argument character sequence.
613
+