From Jason Turner

[locales]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpkyzmhuri/{from.md → to.md} +45 -34
tmp/tmpkyzmhuri/{from.md → to.md} RENAMED
@@ -209,20 +209,20 @@ The provided implementation of members of facets `num_get<charT>` and
209
  `num_put<charT>` calls `use_facet <F> (l)` only for facet `F` of types
210
  `numpunct<charT>` and `ctype<charT>`, and for locale `l` the value
211
  obtained by calling member `getloc()` on the `ios_base&` argument to
212
  these functions.
213
 
214
- In declarations of facets, a template formal parameter with name
215
  `InputIterator` or `OutputIterator` indicates the set of all possible
216
  specializations on parameters that satisfy the requirements of an Input
217
  Iterator or an Output Iterator, respectively (
218
- [[iterator.requirements]]). A template formal parameter with name `C`
219
  represents the set of types containing `char`, `wchar_t`, and any other
220
  implementation-defined character types that satisfy the requirements for
221
  a character on which any of the iostream components can be instantiated.
222
- A template formal parameter with name `International` represents the set
223
- of all possible specializations on a bool parameter.
224
 
225
  ##### Class `locale::facet` <a id="locale.facet">[[locale.facet]]</a>
226
 
227
  ``` cpp
228
  namespace std {
@@ -312,14 +312,10 @@ value for arguments of functions that take a `const locale&` argument.
312
  locale(const locale& other) noexcept;
313
  ```
314
 
315
  *Effects:* Constructs a locale which is a copy of `other`.
316
 
317
- *Effects:* Creates a copy of `other`, replacing the current value.
318
-
319
- *Returns:* `*this`
320
-
321
  ``` cpp
322
  explicit locale(const char* std_name);
323
  ```
324
 
325
  *Effects:* Constructs a locale using standard C locale names, e.g.,
@@ -379,10 +375,14 @@ arguments have names.
379
 
380
  ``` cpp
381
  const locale& operator=(const locale& other) noexcept;
382
  ```
383
 
 
 
 
 
384
  ``` cpp
385
  ~locale();
386
  ```
387
 
388
  A non-virtual destructor that throws no exceptions.
@@ -560,18 +560,17 @@ template <class charT> charT tolower(charT c, const locale& loc);
560
  ##### `string` conversions <a id="conversions.string">[[conversions.string]]</a>
561
 
562
  Class template `wstring_convert` performs conversions between a wide
563
  string and a byte string. It lets you specify a code conversion facet
564
  (like class template `codecvt`) to perform the conversions, without
565
- affecting any streams or locales. Say, for example, you have a code
566
- conversion facet called `codecvt_utf8` that you want to use to output to
567
- `cout` a UTF-8 multibyte sequence corresponding to a wide string, but
568
- you don’t want to alter the locale for `cout`. You can write something
569
- like:
570
 
571
  ``` cpp
572
- wstring_convert<codecvt_utf8<wchar_t>> myconv;
573
  std::string mbstring = myconv.to_bytes(L"Hello\n");
574
  std::cout << mbstring;
575
  ```
576
 
577
  ``` cpp
@@ -583,27 +582,30 @@ template<class Codecvt, class Elem = wchar_t,
583
  typedef std::basic_string<char, char_traits<char>, Byte_alloc> byte_string;
584
  typedef std::basic_string<Elem, char_traits<Elem>, Wide_alloc> wide_string;
585
  typedef typename Codecvt::state_type state_type;
586
  typedef typename wide_string::traits_type::int_type int_type;
587
 
588
- wstring_convert(Codecvt *pcvt = new Codecvt);
589
  wstring_convert(Codecvt* pcvt, state_type state);
590
- wstring_convert(const byte_string& byte_err,
591
  const wide_string& wide_err = wide_string());
592
  ~wstring_convert();
593
 
 
 
 
594
  wide_string from_bytes(char byte);
595
  wide_string from_bytes(const char* ptr);
596
  wide_string from_bytes(const byte_string& str);
597
  wide_string from_bytes(const char* first, const char* last);
598
 
599
  byte_string to_bytes(Elem wchar);
600
  byte_string to_bytes(const Elem* wptr);
601
  byte_string to_bytes(const wide_string& wstr);
602
  byte_string to_bytes(const Elem* first, const Elem* last);
603
 
604
- size_t converted() const;
605
  state_type state() const;
606
  private:
607
  byte_string byte_err_string; // exposition only
608
  wide_string wide_err_string; // exposition only
609
  Codecvt* cvtptr; // exposition only
@@ -616,15 +618,14 @@ template<class Codecvt, class Elem = wchar_t,
616
  The class template describes an object that controls conversions between
617
  wide string objects of class `std::basic_string<Elem, char_traits<Elem>,
618
  Wide_alloc>` and byte string objects of class `std::\\basic_string<char,
619
  char_traits<char>, Byte_alloc>`. The class template defines the types
620
  `wide_string` and `byte_string` as synonyms for these two types.
621
- Conversion between a sequence of `Elem` values (stored in a wide_string
622
- object) and multibyte sequences (stored in a byte_string object) is
623
- performed by an object of class `Codecvt<Elem, char, std::mbstate_t>`,
624
- which meets the requirements of the standard code-conversion facet
625
- `std::codecvt<Elem,
626
  char, std::mbstate_t>`.
627
 
628
  An object of this class template stores:
629
 
630
  - `byte_err_string` — a byte string to display on errors
@@ -633,17 +634,18 @@ An object of this class template stores:
633
  freed when the `wstring_convert` object is destroyed)
634
  - `cvtstate` — a conversion state object
635
  - `cvtcount` — a conversion count
636
 
637
  ``` cpp
638
- typedef std::basic_string<char> byte_string;
639
  ```
640
 
641
- The type shall be a synonym for `std::basic_string<char>`
 
642
 
643
  ``` cpp
644
- size_t converted() const;
645
  ```
646
 
647
  *Returns:* `cvtcount`.
648
 
649
  ``` cpp
@@ -719,22 +721,25 @@ return the converted byte string. Otherwise, if the object was
719
  constructed with a byte-error string, the member function shall return
720
  the byte-error string. Otherwise, the member function shall throw an
721
  object of class `std::range_error`.
722
 
723
  ``` cpp
724
- typedef std::basic_string<Elem> wide_string;
725
  ```
726
 
727
- The type shall be a synonym for `std::basic_string<Elem>`.
 
728
 
729
  ``` cpp
730
- wstring_convert(Codecvt *pcvt = new Codecvt);
731
  wstring_convert(Codecvt* pcvt, state_type state);
732
- wstring_convert(const byte_string& byte_err,
733
  const wide_string& wide_err = wide_string());
734
  ```
735
 
 
 
736
  *Effects:* The first constructor shall store `pcvt` in `cvtptr` and
737
  default values in `cvtstate`, `byte_err_string`, and `wide_err_string`.
738
  The second constructor shall store `pcvt` in `cvtptr`, `state` in
739
  `cvtstate`, and default values in `byte_err_string` and
740
  `wide_err_string`; moreover the stored state shall be retained between
@@ -764,14 +769,19 @@ template<class Codecvt,
764
  class wbuffer_convert
765
  : public std::basic_streambuf<Elem, Tr> {
766
  public:
767
  typedef typename Codecvt::state_type state_type;
768
 
769
- wbuffer_convert(std::streambuf *bytebuf = 0,
770
  Codecvt* pcvt = new Codecvt,
771
  state_type state = state_type());
772
 
 
 
 
 
 
773
  std::streambuf* rdbuf() const;
774
  std::streambuf* rdbuf(std::streambuf* bytebuf);
775
 
776
  state_type state() const;
777
 
@@ -785,13 +795,12 @@ template<class Codecvt,
785
 
786
  The class template describes a stream buffer that controls the
787
  transmission of elements of type `Elem`, whose character traits are
788
  described by the class `Tr`, to and from a byte stream buffer of type
789
  `std::streambuf`. Conversion between a sequence of `Elem` values and
790
- multibyte sequences is performed by an object of class
791
- `Codecvt<Elem, char, std::mbstate_t>`, which shall meet the requirements
792
- of the standard code-conversion facet
793
  `std::codecvt<Elem, char, std::mbstate_t>`.
794
 
795
  An object of this class template stores:
796
 
797
  - `bufptr` — a pointer to its underlying byte stream buffer
@@ -824,14 +833,16 @@ typedef typename Codecvt::state_type state_type;
824
  ```
825
 
826
  The type shall be a synonym for `Codecvt::state_type`.
827
 
828
  ``` cpp
829
- wbuffer_convert(std::streambuf *bytebuf = 0,
830
  Codecvt* pcvt = new Codecvt, state_type state = state_type());
831
  ```
832
 
 
 
833
  *Effects:* The constructor constructs a stream buffer object,
834
  initializes `bufptr` to `bytebuf`, initializes `cvtptr` to `pcvt`, and
835
  initializes `cvtstate` to `state`.
836
 
837
  ``` cpp
 
209
  `num_put<charT>` calls `use_facet <F> (l)` only for facet `F` of types
210
  `numpunct<charT>` and `ctype<charT>`, and for locale `l` the value
211
  obtained by calling member `getloc()` on the `ios_base&` argument to
212
  these functions.
213
 
214
+ In declarations of facets, a template parameter with name
215
  `InputIterator` or `OutputIterator` indicates the set of all possible
216
  specializations on parameters that satisfy the requirements of an Input
217
  Iterator or an Output Iterator, respectively (
218
+ [[iterator.requirements]]). A template parameter with name `C`
219
  represents the set of types containing `char`, `wchar_t`, and any other
220
  implementation-defined character types that satisfy the requirements for
221
  a character on which any of the iostream components can be instantiated.
222
+ A template parameter with name `International` represents the set of all
223
+ possible specializations on a bool parameter.
224
 
225
  ##### Class `locale::facet` <a id="locale.facet">[[locale.facet]]</a>
226
 
227
  ``` cpp
228
  namespace std {
 
312
  locale(const locale& other) noexcept;
313
  ```
314
 
315
  *Effects:* Constructs a locale which is a copy of `other`.
316
 
 
 
 
 
317
  ``` cpp
318
  explicit locale(const char* std_name);
319
  ```
320
 
321
  *Effects:* Constructs a locale using standard C locale names, e.g.,
 
375
 
376
  ``` cpp
377
  const locale& operator=(const locale& other) noexcept;
378
  ```
379
 
380
+ *Effects:* Creates a copy of `other`, replacing the current value.
381
+
382
+ *Returns:* `*this`
383
+
384
  ``` cpp
385
  ~locale();
386
  ```
387
 
388
  A non-virtual destructor that throws no exceptions.
 
560
  ##### `string` conversions <a id="conversions.string">[[conversions.string]]</a>
561
 
562
  Class template `wstring_convert` performs conversions between a wide
563
  string and a byte string. It lets you specify a code conversion facet
564
  (like class template `codecvt`) to perform the conversions, without
565
+ affecting any streams or locales. If you want to use the code conversion
566
+ facet `codecvt_utf8` to output to `cout` a UTF-8 multibyte sequence
567
+ corresponding to a wide string, but you don’t want to alter the locale
568
+ for `cout`, you can write something like:
 
569
 
570
  ``` cpp
571
+ wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
572
  std::string mbstring = myconv.to_bytes(L"Hello\n");
573
  std::cout << mbstring;
574
  ```
575
 
576
  ``` cpp
 
582
  typedef std::basic_string<char, char_traits<char>, Byte_alloc> byte_string;
583
  typedef std::basic_string<Elem, char_traits<Elem>, Wide_alloc> wide_string;
584
  typedef typename Codecvt::state_type state_type;
585
  typedef typename wide_string::traits_type::int_type int_type;
586
 
587
+ explicit wstring_convert(Codecvt* pcvt = new Codecvt);
588
  wstring_convert(Codecvt* pcvt, state_type state);
589
+ explicit wstring_convert(const byte_string& byte_err,
590
  const wide_string& wide_err = wide_string());
591
  ~wstring_convert();
592
 
593
+ wstring_convert(const wstring_convert&) = delete;
594
+ wstring_convert& operator=(const wstring_convert&) = delete;
595
+
596
  wide_string from_bytes(char byte);
597
  wide_string from_bytes(const char* ptr);
598
  wide_string from_bytes(const byte_string& str);
599
  wide_string from_bytes(const char* first, const char* last);
600
 
601
  byte_string to_bytes(Elem wchar);
602
  byte_string to_bytes(const Elem* wptr);
603
  byte_string to_bytes(const wide_string& wstr);
604
  byte_string to_bytes(const Elem* first, const Elem* last);
605
 
606
+ size_t converted() const noexcept;
607
  state_type state() const;
608
  private:
609
  byte_string byte_err_string; // exposition only
610
  wide_string wide_err_string; // exposition only
611
  Codecvt* cvtptr; // exposition only
 
618
  The class template describes an object that controls conversions between
619
  wide string objects of class `std::basic_string<Elem, char_traits<Elem>,
620
  Wide_alloc>` and byte string objects of class `std::\\basic_string<char,
621
  char_traits<char>, Byte_alloc>`. The class template defines the types
622
  `wide_string` and `byte_string` as synonyms for these two types.
623
+ Conversion between a sequence of `Elem` values (stored in a
624
+ `wide_string` object) and multibyte sequences (stored in a `byte_string`
625
+ object) is performed by an object of class `Codecvt`, which meets the
626
+ requirements of the standard code-conversion facet `std::codecvt<Elem,
 
627
  char, std::mbstate_t>`.
628
 
629
  An object of this class template stores:
630
 
631
  - `byte_err_string` — a byte string to display on errors
 
634
  freed when the `wstring_convert` object is destroyed)
635
  - `cvtstate` — a conversion state object
636
  - `cvtcount` — a conversion count
637
 
638
  ``` cpp
639
+ typedef std::basic_string<char, char_traits<char>, Byte_alloc> byte_string;
640
  ```
641
 
642
+ The type shall be a synonym for
643
+ `std::basic_string<char, char_traits<char>, Byte_alloc>`
644
 
645
  ``` cpp
646
+ size_t converted() const noexcept;
647
  ```
648
 
649
  *Returns:* `cvtcount`.
650
 
651
  ``` cpp
 
721
  constructed with a byte-error string, the member function shall return
722
  the byte-error string. Otherwise, the member function shall throw an
723
  object of class `std::range_error`.
724
 
725
  ``` cpp
726
+ typedef std::basic_string<Elem, char_traits<Elem>, Wide_alloc> wide_string;
727
  ```
728
 
729
+ The type shall be a synonym for
730
+ `std::basic_string<Elem, char_traits<Elem>, Wide_alloc>`.
731
 
732
  ``` cpp
733
+ explicit wstring_convert(Codecvt* pcvt = new Codecvt);
734
  wstring_convert(Codecvt* pcvt, state_type state);
735
+ explicit wstring_convert(const byte_string& byte_err,
736
  const wide_string& wide_err = wide_string());
737
  ```
738
 
739
+ *Requires:* For the first and second constructors, `pcvt != nullptr`.
740
+
741
  *Effects:* The first constructor shall store `pcvt` in `cvtptr` and
742
  default values in `cvtstate`, `byte_err_string`, and `wide_err_string`.
743
  The second constructor shall store `pcvt` in `cvtptr`, `state` in
744
  `cvtstate`, and default values in `byte_err_string` and
745
  `wide_err_string`; moreover the stored state shall be retained between
 
769
  class wbuffer_convert
770
  : public std::basic_streambuf<Elem, Tr> {
771
  public:
772
  typedef typename Codecvt::state_type state_type;
773
 
774
+ explicit wbuffer_convert(std::streambuf* bytebuf = 0,
775
  Codecvt* pcvt = new Codecvt,
776
  state_type state = state_type());
777
 
778
+ ~wbuffer_convert();
779
+
780
+ wbuffer_convert(const wbuffer_convert&) = delete;
781
+ wbuffer_convert& operator=(const wbuffer_convert&) = delete;
782
+
783
  std::streambuf* rdbuf() const;
784
  std::streambuf* rdbuf(std::streambuf* bytebuf);
785
 
786
  state_type state() const;
787
 
 
795
 
796
  The class template describes a stream buffer that controls the
797
  transmission of elements of type `Elem`, whose character traits are
798
  described by the class `Tr`, to and from a byte stream buffer of type
799
  `std::streambuf`. Conversion between a sequence of `Elem` values and
800
+ multibyte sequences is performed by an object of class `Codecvt`, which
801
+ shall meet the requirements of the standard code-conversion facet
 
802
  `std::codecvt<Elem, char, std::mbstate_t>`.
803
 
804
  An object of this class template stores:
805
 
806
  - `bufptr` — a pointer to its underlying byte stream buffer
 
833
  ```
834
 
835
  The type shall be a synonym for `Codecvt::state_type`.
836
 
837
  ``` cpp
838
+ explicit wbuffer_convert(std::streambuf* bytebuf = 0,
839
  Codecvt* pcvt = new Codecvt, state_type state = state_type());
840
  ```
841
 
842
+ *Requires:* `pcvt != nullptr`.
843
+
844
  *Effects:* The constructor constructs a stream buffer object,
845
  initializes `bufptr` to `bytebuf`, initializes `cvtptr` to `pcvt`, and
846
  initializes `cvtstate` to `state`.
847
 
848
  ``` cpp