From Jason Turner

[depr.str.strstreams]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp9_3u0962/{from.md → to.md} +56 -53
tmp/tmp9_3u0962/{from.md → to.md} RENAMED
@@ -1,27 +1,39 @@
1
  ## `char*` streams <a id="depr.str.strstreams">[[depr.str.strstreams]]</a>
2
 
3
- The header `<strstream>` defines three types that associate stream
4
- buffers with character array objects and assist reading and writing such
 
 
5
  objects.
6
 
 
 
 
 
 
 
 
 
 
7
  ### Class `strstreambuf` <a id="depr.strstreambuf">[[depr.strstreambuf]]</a>
8
 
9
  ``` cpp
10
  namespace std {
11
  class strstreambuf : public basic_streambuf<char> {
12
  public:
13
- explicit strstreambuf(streamsize alsize_arg = 0);
 
14
  strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
15
- strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0);
16
  strstreambuf(const char* gnext_arg, streamsize n);
17
 
18
  strstreambuf(signed char* gnext_arg, streamsize n,
19
- signed char* pbeg_arg = 0);
20
  strstreambuf(const signed char* gnext_arg, streamsize n);
21
  strstreambuf(unsigned char* gnext_arg, streamsize n,
22
- unsigned char* pbeg_arg = 0);
23
  strstreambuf(const unsigned char* gnext_arg, streamsize n);
24
 
25
  virtual ~strstreambuf();
26
 
27
  void freeze(bool freezefl = true);
@@ -31,15 +43,13 @@ namespace std {
31
  protected:
32
  int_type overflow (int_type c = EOF) override;
33
  int_type pbackfail(int_type c = EOF) override;
34
  int_type underflow() override;
35
  pos_type seekoff(off_type off, ios_base::seekdir way,
36
- ios_base::openmode which
37
- = ios_base::in | ios_base::out) override;
38
  pos_type seekpos(pos_type sp,
39
- ios_base::openmode which
40
- = ios_base::in | ios_base::out) override;
41
  streambuf* setbuf(char* s, streamsize n) override;
42
 
43
  private:
44
  using strstate = T1; // exposition only
45
  static const strstate allocated; // exposition only
@@ -96,18 +106,18 @@ seekable area is undefined. Otherwise, `seeklow` equals `gbeg` and
96
  `seekhigh` is either `pend`, if `pend` is not a null pointer, or `gend`.
97
 
98
  #### `strstreambuf` constructors <a id="depr.strstreambuf.cons">[[depr.strstreambuf.cons]]</a>
99
 
100
  ``` cpp
101
- explicit strstreambuf(streamsize alsize_arg = 0);
102
  ```
103
 
104
- *Effects:* Constructs an object of class `strstreambuf`, initializing
105
- the base class with `streambuf()`. The postconditions of this function
106
- are indicated in Table  [[tab:future.strstreambuf.effects]].
107
 
108
- **Table: `strstreambuf(streamsize)` effects** <a id="tab:future.strstreambuf.effects">[tab:future.strstreambuf.effects]</a>
109
 
110
  | Element | Value |
111
  | --------- | -------------- |
112
  | `strmode` | `dynamic` |
113
  | `alsize` | `alsize_arg` |
@@ -116,36 +126,36 @@ are indicated in Table  [[tab:future.strstreambuf.effects]].
116
 
117
  ``` cpp
118
  strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
119
  ```
120
 
121
- *Effects:* Constructs an object of class `strstreambuf`, initializing
122
- the base class with `streambuf()`. The postconditions of this function
123
- are indicated in Table  [[tab:future.strstreambuf1.effects]].
124
 
125
- **Table: `strstreambuf(void* (*)(size_t), void (*)(void*))` effects** <a id="tab:future.strstreambuf1.effects">[tab:future.strstreambuf1.effects]</a>
126
 
127
  | Element | Value |
128
  | --------- | -------------------- |
129
  | `strmode` | `dynamic` |
130
  | `alsize` | an unspecified value |
131
  | `palloc` | `palloc_arg` |
132
  | `pfree` | `pfree_arg` |
133
 
134
  ``` cpp
135
- strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0);
136
  strstreambuf(signed char* gnext_arg, streamsize n,
137
- signed char* pbeg_arg = 0);
138
  strstreambuf(unsigned char* gnext_arg, streamsize n,
139
- unsigned char* pbeg_arg = 0);
140
  ```
141
 
142
- *Effects:* Constructs an object of class `strstreambuf`, initializing
143
- the base class with `streambuf()`. The postconditions of this function
144
- are indicated in Table  [[tab:future.strstreambuf2.effects]].
145
 
146
- **Table: `strstreambuf(charT*, streamsize, charT*)` effects** <a id="tab:future.strstreambuf2.effects">[tab:future.strstreambuf2.effects]</a>
147
 
148
  | Element | Value |
149
  | --------- | -------------------- |
150
  | `strmode` | 0 |
151
  | `alsize` | an unspecified value |
@@ -308,27 +318,27 @@ as a result of any call.
308
  pos_type seekoff(off_type off, seekdir way, openmode which = in | out) override;
309
  ```
310
 
311
  *Effects:* Alters the stream position within one of the controlled
312
  sequences, if possible, as indicated in
313
- Table  [[tab:future.seekoff.positioning]].
314
 
315
- **Table: `seekoff` positioning** <a id="tab:future.seekoff.positioning">[tab:future.seekoff.positioning]</a>
316
 
317
  | Conditions | Result |
318
- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------- |
319
  | `(which & ios::in) != 0` | positions the input sequence |
320
  | `(which & ios::out) != 0` | positions the output sequence |
321
- | `(which & (ios::in |`<br> `ios::out)) == (ios::in |`<br> `ios::out))` and<br> `way ==` either<br> `ios::beg` or<br> `ios::end` | positions both the input and the output sequences |
322
  | Otherwise | the positioning operation fails. |
323
 
324
 
325
  For a sequence to be positioned, if its next pointer is a null pointer,
326
  the positioning operation fails. Otherwise, the function determines
327
- `newoff` as indicated in Table  [[tab:future.newoff.values]].
328
 
329
- **Table: `newoff` values** <a id="tab:future.newoff.values">[tab:future.newoff.values]</a>
330
 
331
  | Condition | `newoff` Value |
332
  | ----------------- | -------------------------------------------------------------- |
333
  | `way == ios::beg` | 0 |
334
  | `way == ios::cur` | the next pointer minus the beginning pointer (`xnext - xbeg`). |
@@ -345,12 +355,11 @@ pointer `xnext`.
345
  position, if possible. If the positioning operation fails, or if the
346
  constructed object cannot represent the resultant stream position, the
347
  return value is `pos_type(off_type(-1))`.
348
 
349
  ``` cpp
350
- pos_type seekpos(pos_type sp, ios_base::openmode which
351
- = ios_base::in | ios_base::out) override;
352
  ```
353
 
354
  *Effects:* Alters the stream position within one of the controlled
355
  sequences, if possible, to correspond to the stream position stored in
356
  `sp` (as described below).
@@ -378,12 +387,12 @@ return value is `pos_type(off_type(-1))`.
378
 
379
  ``` cpp
380
  streambuf<char>* setbuf(char* s, streamsize n) override;
381
  ```
382
 
383
- *Effects:* Implementation defined, except that `setbuf(0, 0)` has no
384
- effect.
385
 
386
  ### Class `istrstream` <a id="depr.istrstream">[[depr.istrstream]]</a>
387
 
388
  ``` cpp
389
  namespace std {
@@ -415,21 +424,19 @@ is presented here as:
415
  ``` cpp
416
  explicit istrstream(const char* s);
417
  explicit istrstream(char* s);
418
  ```
419
 
420
- *Effects:* Constructs an object of class `istrstream`, initializing the
421
- base class with `istream(&sb)` and initializing `sb` with
422
  `strstreambuf(s, 0)`. `s` shall designate the first element of an NTBS.
423
 
424
  ``` cpp
425
  istrstream(const char* s, streamsize n);
426
  istrstream(char* s, streamsize n);
427
  ```
428
 
429
- *Effects:* Constructs an object of class `istrstream`, initializing the
430
- base class with `istream(&sb)` and initializing `sb` with
431
  `strstreambuf(s, n)`. `s` shall designate the first element of an array
432
  whose length is `n` elements, and `n` shall be greater than zero.
433
 
434
  #### Member functions <a id="depr.istrstream.members">[[depr.istrstream.members]]</a>
435
 
@@ -476,21 +483,19 @@ is presented here as:
476
 
477
  ``` cpp
478
  ostrstream();
479
  ```
480
 
481
- *Effects:* Constructs an object of class `ostrstream`, initializing the
482
- base class with `ostream(&sb)` and initializing `sb` with
483
  `strstreambuf()`.
484
 
485
  ``` cpp
486
  ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
487
  ```
488
 
489
- *Effects:* Constructs an object of class `ostrstream`, initializing the
490
- base class with `ostream(&sb)`, and initializing `sb` with one of two
491
- constructors:
492
 
493
  - If `(mode & app) == 0`, then `s` shall designate the first element of
494
  an array of `n` elements. The constructor is `strstreambuf(s, n, s)`.
495
  - If `(mode & app) != 0`, then `s` shall designate the first element of
496
  an array of `n` elements that contains an NTBS whose first element is
@@ -528,11 +533,11 @@ int pcount() const;
528
  ``` cpp
529
  namespace std {
530
  class strstream
531
  : public basic_iostream<char> {
532
  public:
533
- // Types
534
  using char_type = char;
535
  using int_type = char_traits<char>::int_type;
536
  using pos_type = char_traits<char>::pos_type;
537
  using off_type = char_traits<char>::off_type;
538
 
@@ -540,11 +545,11 @@ namespace std {
540
  strstream();
541
  strstream(char* s, int n,
542
  ios_base::openmode mode = ios_base::in|ios_base::out);
543
  virtual ~strstream();
544
 
545
- // Members:
546
  strstreambuf* rdbuf() const;
547
  void freeze(bool freezefl = true);
548
  int pcount() const;
549
  char* str();
550
 
@@ -565,21 +570,19 @@ is presented here as:
565
 
566
  ``` cpp
567
  strstream();
568
  ```
569
 
570
- *Effects:* Constructs an object of class `strstream`, initializing the
571
- base class with `iostream(&sb)`.
572
 
573
  ``` cpp
574
  strstream(char* s, int n,
575
  ios_base::openmode mode = ios_base::in|ios_base::out);
576
  ```
577
 
578
- *Effects:* Constructs an object of class `strstream`, initializing the
579
- base class with `iostream(&sb)` and initializing `sb` with one of the
580
- two constructors:
581
 
582
  - If `(mode & app) == 0`, then `s` shall designate the first element of
583
  an array of `n` elements. The constructor is `strstreambuf(s,n,s)`.
584
  - If `(mode & app) != 0`, then `s` shall designate the first element of
585
  an array of `n` elements that contains an NTBS whose first element is
@@ -598,11 +601,11 @@ virtual ~strstream();
598
 
599
  ``` cpp
600
  strstreambuf* rdbuf() const;
601
  ```
602
 
603
- *Returns:* `&sb`.
604
 
605
  ``` cpp
606
  void freeze(bool freezefl = true);
607
  ```
608
 
 
1
  ## `char*` streams <a id="depr.str.strstreams">[[depr.str.strstreams]]</a>
2
 
3
+ ### Header `<strstream>` synopsis <a id="depr.strstream.syn">[[depr.strstream.syn]]</a>
4
+
5
+ The header `<strstream>` defines types that associate stream buffers
6
+ with character array objects and assist reading and writing such
7
  objects.
8
 
9
+ ``` cpp
10
+ namespace std {
11
+ class strstreambuf;
12
+ class istrstream;
13
+ class ostrstream;
14
+ class strstream;
15
+ }
16
+ ```
17
+
18
  ### Class `strstreambuf` <a id="depr.strstreambuf">[[depr.strstreambuf]]</a>
19
 
20
  ``` cpp
21
  namespace std {
22
  class strstreambuf : public basic_streambuf<char> {
23
  public:
24
+ strstreambuf() : strstreambuf(0) {}
25
+ explicit strstreambuf(streamsize alsize_arg);
26
  strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
27
+ strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr);
28
  strstreambuf(const char* gnext_arg, streamsize n);
29
 
30
  strstreambuf(signed char* gnext_arg, streamsize n,
31
+ signed char* pbeg_arg = nullptr);
32
  strstreambuf(const signed char* gnext_arg, streamsize n);
33
  strstreambuf(unsigned char* gnext_arg, streamsize n,
34
+ unsigned char* pbeg_arg = nullptr);
35
  strstreambuf(const unsigned char* gnext_arg, streamsize n);
36
 
37
  virtual ~strstreambuf();
38
 
39
  void freeze(bool freezefl = true);
 
43
  protected:
44
  int_type overflow (int_type c = EOF) override;
45
  int_type pbackfail(int_type c = EOF) override;
46
  int_type underflow() override;
47
  pos_type seekoff(off_type off, ios_base::seekdir way,
48
+ ios_base::openmode which = ios_base::in | ios_base::out) override;
 
49
  pos_type seekpos(pos_type sp,
50
+ ios_base::openmode which = ios_base::in | ios_base::out) override;
 
51
  streambuf* setbuf(char* s, streamsize n) override;
52
 
53
  private:
54
  using strstate = T1; // exposition only
55
  static const strstate allocated; // exposition only
 
106
  `seekhigh` is either `pend`, if `pend` is not a null pointer, or `gend`.
107
 
108
  #### `strstreambuf` constructors <a id="depr.strstreambuf.cons">[[depr.strstreambuf.cons]]</a>
109
 
110
  ``` cpp
111
+ explicit strstreambuf(streamsize alsize_arg);
112
  ```
113
 
114
+ *Effects:* Initializes the base class with `streambuf()`. The
115
+ postconditions of this function are indicated in
116
+ [[depr.strstreambuf.cons.sz]].
117
 
118
+ **Table: `strstreambuf(streamsize)` effects** <a id="depr.strstreambuf.cons.sz">[depr.strstreambuf.cons.sz]</a>
119
 
120
  | Element | Value |
121
  | --------- | -------------- |
122
  | `strmode` | `dynamic` |
123
  | `alsize` | `alsize_arg` |
 
126
 
127
  ``` cpp
128
  strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
129
  ```
130
 
131
+ *Effects:* Initializes the base class with `streambuf()`. The
132
+ postconditions of this function are indicated in
133
+ [[depr.strstreambuf.cons.alloc]].
134
 
135
+ **Table: `strstreambuf(void* (*)(size_t), void (*)(void*))` effects** <a id="depr.strstreambuf.cons.alloc">[depr.strstreambuf.cons.alloc]</a>
136
 
137
  | Element | Value |
138
  | --------- | -------------------- |
139
  | `strmode` | `dynamic` |
140
  | `alsize` | an unspecified value |
141
  | `palloc` | `palloc_arg` |
142
  | `pfree` | `pfree_arg` |
143
 
144
  ``` cpp
145
+ strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr);
146
  strstreambuf(signed char* gnext_arg, streamsize n,
147
+ signed char* pbeg_arg = nullptr);
148
  strstreambuf(unsigned char* gnext_arg, streamsize n,
149
+ unsigned char* pbeg_arg = nullptr);
150
  ```
151
 
152
+ *Effects:* Initializes the base class with `streambuf()`. The
153
+ postconditions of this function are indicated in
154
+ [[depr.strstreambuf.cons.ptr]].
155
 
156
+ **Table: `strstreambuf(charT*, streamsize, charT*)` effects** <a id="depr.strstreambuf.cons.ptr">[depr.strstreambuf.cons.ptr]</a>
157
 
158
  | Element | Value |
159
  | --------- | -------------------- |
160
  | `strmode` | 0 |
161
  | `alsize` | an unspecified value |
 
318
  pos_type seekoff(off_type off, seekdir way, openmode which = in | out) override;
319
  ```
320
 
321
  *Effects:* Alters the stream position within one of the controlled
322
  sequences, if possible, as indicated in
323
+ [[depr.strstreambuf.seekoff.pos]].
324
 
325
+ **Table: `seekoff` positioning** <a id="depr.strstreambuf.seekoff.pos">[depr.strstreambuf.seekoff.pos]</a>
326
 
327
  | Conditions | Result |
328
+ | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
329
  | `(which & ios::in) != 0` | positions the input sequence |
330
  | `(which & ios::out) != 0` | positions the output sequence |
331
+ | `(which & (ios::in | ios::out)) ==`<br> `(ios::in | ios::out)` and either<br> `way == ios::beg` or `way == ios::end` | positions both the input and the output sequences |
332
  | Otherwise | the positioning operation fails. |
333
 
334
 
335
  For a sequence to be positioned, if its next pointer is a null pointer,
336
  the positioning operation fails. Otherwise, the function determines
337
+ `newoff` as indicated in [[depr.strstreambuf.seekoff.newoff]].
338
 
339
+ **Table: `newoff` values** <a id="depr.strstreambuf.seekoff.newoff">[depr.strstreambuf.seekoff.newoff]</a>
340
 
341
  | Condition | `newoff` Value |
342
  | ----------------- | -------------------------------------------------------------- |
343
  | `way == ios::beg` | 0 |
344
  | `way == ios::cur` | the next pointer minus the beginning pointer (`xnext - xbeg`). |
 
355
  position, if possible. If the positioning operation fails, or if the
356
  constructed object cannot represent the resultant stream position, the
357
  return value is `pos_type(off_type(-1))`.
358
 
359
  ``` cpp
360
+ pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out) override;
 
361
  ```
362
 
363
  *Effects:* Alters the stream position within one of the controlled
364
  sequences, if possible, to correspond to the stream position stored in
365
  `sp` (as described below).
 
387
 
388
  ``` cpp
389
  streambuf<char>* setbuf(char* s, streamsize n) override;
390
  ```
391
 
392
+ *Effects:* Behavior is *implementation-defined*, except that
393
+ `setbuf(0, 0)` has no effect.
394
 
395
  ### Class `istrstream` <a id="depr.istrstream">[[depr.istrstream]]</a>
396
 
397
  ``` cpp
398
  namespace std {
 
424
  ``` cpp
425
  explicit istrstream(const char* s);
426
  explicit istrstream(char* s);
427
  ```
428
 
429
+ *Effects:* Initializes the base class with `istream(&sb)` and `sb` with
 
430
  `strstreambuf(s, 0)`. `s` shall designate the first element of an NTBS.
431
 
432
  ``` cpp
433
  istrstream(const char* s, streamsize n);
434
  istrstream(char* s, streamsize n);
435
  ```
436
 
437
+ *Effects:* Initializes the base class with `istream(&sb)` and `sb` with
 
438
  `strstreambuf(s, n)`. `s` shall designate the first element of an array
439
  whose length is `n` elements, and `n` shall be greater than zero.
440
 
441
  #### Member functions <a id="depr.istrstream.members">[[depr.istrstream.members]]</a>
442
 
 
483
 
484
  ``` cpp
485
  ostrstream();
486
  ```
487
 
488
+ *Effects:* Initializes the base class with `ostream(&sb)` and `sb` with
 
489
  `strstreambuf()`.
490
 
491
  ``` cpp
492
  ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
493
  ```
494
 
495
+ *Effects:* Initializes the base class with `ostream(&sb)`, and `sb` with
496
+ one of two constructors:
 
497
 
498
  - If `(mode & app) == 0`, then `s` shall designate the first element of
499
  an array of `n` elements. The constructor is `strstreambuf(s, n, s)`.
500
  - If `(mode & app) != 0`, then `s` shall designate the first element of
501
  an array of `n` elements that contains an NTBS whose first element is
 
533
  ``` cpp
534
  namespace std {
535
  class strstream
536
  : public basic_iostream<char> {
537
  public:
538
+ // types
539
  using char_type = char;
540
  using int_type = char_traits<char>::int_type;
541
  using pos_type = char_traits<char>::pos_type;
542
  using off_type = char_traits<char>::off_type;
543
 
 
545
  strstream();
546
  strstream(char* s, int n,
547
  ios_base::openmode mode = ios_base::in|ios_base::out);
548
  virtual ~strstream();
549
 
550
+ // members
551
  strstreambuf* rdbuf() const;
552
  void freeze(bool freezefl = true);
553
  int pcount() const;
554
  char* str();
555
 
 
570
 
571
  ``` cpp
572
  strstream();
573
  ```
574
 
575
+ *Effects:* Initializes the base class with `iostream(&sb)`.
 
576
 
577
  ``` cpp
578
  strstream(char* s, int n,
579
  ios_base::openmode mode = ios_base::in|ios_base::out);
580
  ```
581
 
582
+ *Effects:* Initializes the base class with `iostream(&sb)`, and `sb`
583
+ with one of the two constructors:
 
584
 
585
  - If `(mode & app) == 0`, then `s` shall designate the first element of
586
  an array of `n` elements. The constructor is `strstreambuf(s,n,s)`.
587
  - If `(mode & app) != 0`, then `s` shall designate the first element of
588
  an array of `n` elements that contains an NTBS whose first element is
 
601
 
602
  ``` cpp
603
  strstreambuf* rdbuf() const;
604
  ```
605
 
606
+ *Returns:* `const_cast<strstreambuf*>(&sb)`.
607
 
608
  ``` cpp
609
  void freeze(bool freezefl = true);
610
  ```
611