codecvt 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. // -*- C++ -*-
  2. //===-------------------------- codecvt -----------------------------------===//
  3. //
  4. // The LLVM Compiler Infrastructure
  5. //
  6. // This file is dual licensed under the MIT and the University of Illinois Open
  7. // Source Licenses. See LICENSE.TXT for details.
  8. //
  9. //===----------------------------------------------------------------------===//
  10. #ifndef _LIBCPP_CODECVT
  11. #define _LIBCPP_CODECVT
  12. /*
  13. codecvt synopsis
  14. namespace std
  15. {
  16. enum codecvt_mode
  17. {
  18. consume_header = 4,
  19. generate_header = 2,
  20. little_endian = 1
  21. };
  22. template <class Elem, unsigned long Maxcode = 0x10ffff,
  23. codecvt_mode Mode = (codecvt_mode)0>
  24. class codecvt_utf8
  25. : public codecvt<Elem, char, mbstate_t>
  26. {
  27. explicit codecvt_utf8(size_t refs = 0);
  28. ~codecvt_utf8();
  29. };
  30. template <class Elem, unsigned long Maxcode = 0x10ffff,
  31. codecvt_mode Mode = (codecvt_mode)0>
  32. class codecvt_utf16
  33. : public codecvt<Elem, char, mbstate_t>
  34. {
  35. explicit codecvt_utf16(size_t refs = 0);
  36. ~codecvt_utf16();
  37. };
  38. template <class Elem, unsigned long Maxcode = 0x10ffff,
  39. codecvt_mode Mode = (codecvt_mode)0>
  40. class codecvt_utf8_utf16
  41. : public codecvt<Elem, char, mbstate_t>
  42. {
  43. explicit codecvt_utf8_utf16(size_t refs = 0);
  44. ~codecvt_utf8_utf16();
  45. };
  46. } // std
  47. */
  48. #include <__config>
  49. #ifndef _LIBCPP_SGX_CONFIG
  50. #include <__locale>
  51. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  52. #pragma GCC system_header
  53. #endif
  54. _LIBCPP_BEGIN_NAMESPACE_STD
  55. enum codecvt_mode
  56. {
  57. consume_header = 4,
  58. generate_header = 2,
  59. little_endian = 1
  60. };
  61. // codecvt_utf8
  62. template <class _Elem> class __codecvt_utf8;
  63. template <>
  64. class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t>
  65. : public codecvt<wchar_t, char, mbstate_t>
  66. {
  67. unsigned long _Maxcode_;
  68. codecvt_mode _Mode_;
  69. public:
  70. typedef wchar_t intern_type;
  71. typedef char extern_type;
  72. typedef mbstate_t state_type;
  73. _LIBCPP_ALWAYS_INLINE
  74. explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
  75. codecvt_mode _Mode)
  76. : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
  77. _Mode_(_Mode) {}
  78. protected:
  79. virtual result
  80. do_out(state_type& __st,
  81. const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
  82. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  83. virtual result
  84. do_in(state_type& __st,
  85. const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
  86. intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
  87. virtual result
  88. do_unshift(state_type& __st,
  89. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  90. virtual int do_encoding() const throw();
  91. virtual bool do_always_noconv() const throw();
  92. virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
  93. size_t __mx) const;
  94. virtual int do_max_length() const throw();
  95. };
  96. template <>
  97. class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
  98. : public codecvt<char16_t, char, mbstate_t>
  99. {
  100. unsigned long _Maxcode_;
  101. codecvt_mode _Mode_;
  102. public:
  103. typedef char16_t intern_type;
  104. typedef char extern_type;
  105. typedef mbstate_t state_type;
  106. _LIBCPP_ALWAYS_INLINE
  107. explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
  108. codecvt_mode _Mode)
  109. : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
  110. _Mode_(_Mode) {}
  111. protected:
  112. virtual result
  113. do_out(state_type& __st,
  114. const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
  115. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  116. virtual result
  117. do_in(state_type& __st,
  118. const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
  119. intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
  120. virtual result
  121. do_unshift(state_type& __st,
  122. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  123. virtual int do_encoding() const throw();
  124. virtual bool do_always_noconv() const throw();
  125. virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
  126. size_t __mx) const;
  127. virtual int do_max_length() const throw();
  128. };
  129. template <>
  130. class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
  131. : public codecvt<char32_t, char, mbstate_t>
  132. {
  133. unsigned long _Maxcode_;
  134. codecvt_mode _Mode_;
  135. public:
  136. typedef char32_t intern_type;
  137. typedef char extern_type;
  138. typedef mbstate_t state_type;
  139. _LIBCPP_ALWAYS_INLINE
  140. explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
  141. codecvt_mode _Mode)
  142. : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
  143. _Mode_(_Mode) {}
  144. protected:
  145. virtual result
  146. do_out(state_type& __st,
  147. const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
  148. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  149. virtual result
  150. do_in(state_type& __st,
  151. const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
  152. intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
  153. virtual result
  154. do_unshift(state_type& __st,
  155. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  156. virtual int do_encoding() const throw();
  157. virtual bool do_always_noconv() const throw();
  158. virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
  159. size_t __mx) const;
  160. virtual int do_max_length() const throw();
  161. };
  162. template <class _Elem, unsigned long _Maxcode = 0x10ffff,
  163. codecvt_mode _Mode = (codecvt_mode)0>
  164. class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8
  165. : public __codecvt_utf8<_Elem>
  166. {
  167. public:
  168. _LIBCPP_ALWAYS_INLINE
  169. explicit codecvt_utf8(size_t __refs = 0)
  170. : __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
  171. _LIBCPP_ALWAYS_INLINE
  172. ~codecvt_utf8() {}
  173. };
  174. // codecvt_utf16
  175. template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
  176. template <>
  177. class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false>
  178. : public codecvt<wchar_t, char, mbstate_t>
  179. {
  180. unsigned long _Maxcode_;
  181. codecvt_mode _Mode_;
  182. public:
  183. typedef wchar_t intern_type;
  184. typedef char extern_type;
  185. typedef mbstate_t state_type;
  186. _LIBCPP_ALWAYS_INLINE
  187. explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
  188. codecvt_mode _Mode)
  189. : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
  190. _Mode_(_Mode) {}
  191. protected:
  192. virtual result
  193. do_out(state_type& __st,
  194. const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
  195. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  196. virtual result
  197. do_in(state_type& __st,
  198. const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
  199. intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
  200. virtual result
  201. do_unshift(state_type& __st,
  202. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  203. virtual int do_encoding() const throw();
  204. virtual bool do_always_noconv() const throw();
  205. virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
  206. size_t __mx) const;
  207. virtual int do_max_length() const throw();
  208. };
  209. template <>
  210. class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true>
  211. : public codecvt<wchar_t, char, mbstate_t>
  212. {
  213. unsigned long _Maxcode_;
  214. codecvt_mode _Mode_;
  215. public:
  216. typedef wchar_t intern_type;
  217. typedef char extern_type;
  218. typedef mbstate_t state_type;
  219. _LIBCPP_ALWAYS_INLINE
  220. explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
  221. codecvt_mode _Mode)
  222. : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
  223. _Mode_(_Mode) {}
  224. protected:
  225. virtual result
  226. do_out(state_type& __st,
  227. const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
  228. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  229. virtual result
  230. do_in(state_type& __st,
  231. const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
  232. intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
  233. virtual result
  234. do_unshift(state_type& __st,
  235. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  236. virtual int do_encoding() const throw();
  237. virtual bool do_always_noconv() const throw();
  238. virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
  239. size_t __mx) const;
  240. virtual int do_max_length() const throw();
  241. };
  242. template <>
  243. class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
  244. : public codecvt<char16_t, char, mbstate_t>
  245. {
  246. unsigned long _Maxcode_;
  247. codecvt_mode _Mode_;
  248. public:
  249. typedef char16_t intern_type;
  250. typedef char extern_type;
  251. typedef mbstate_t state_type;
  252. _LIBCPP_ALWAYS_INLINE
  253. explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
  254. codecvt_mode _Mode)
  255. : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
  256. _Mode_(_Mode) {}
  257. protected:
  258. virtual result
  259. do_out(state_type& __st,
  260. const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
  261. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  262. virtual result
  263. do_in(state_type& __st,
  264. const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
  265. intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
  266. virtual result
  267. do_unshift(state_type& __st,
  268. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  269. virtual int do_encoding() const throw();
  270. virtual bool do_always_noconv() const throw();
  271. virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
  272. size_t __mx) const;
  273. virtual int do_max_length() const throw();
  274. };
  275. template <>
  276. class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
  277. : public codecvt<char16_t, char, mbstate_t>
  278. {
  279. unsigned long _Maxcode_;
  280. codecvt_mode _Mode_;
  281. public:
  282. typedef char16_t intern_type;
  283. typedef char extern_type;
  284. typedef mbstate_t state_type;
  285. _LIBCPP_ALWAYS_INLINE
  286. explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
  287. codecvt_mode _Mode)
  288. : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
  289. _Mode_(_Mode) {}
  290. protected:
  291. virtual result
  292. do_out(state_type& __st,
  293. const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
  294. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  295. virtual result
  296. do_in(state_type& __st,
  297. const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
  298. intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
  299. virtual result
  300. do_unshift(state_type& __st,
  301. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  302. virtual int do_encoding() const throw();
  303. virtual bool do_always_noconv() const throw();
  304. virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
  305. size_t __mx) const;
  306. virtual int do_max_length() const throw();
  307. };
  308. template <>
  309. class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
  310. : public codecvt<char32_t, char, mbstate_t>
  311. {
  312. unsigned long _Maxcode_;
  313. codecvt_mode _Mode_;
  314. public:
  315. typedef char32_t intern_type;
  316. typedef char extern_type;
  317. typedef mbstate_t state_type;
  318. _LIBCPP_ALWAYS_INLINE
  319. explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
  320. codecvt_mode _Mode)
  321. : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
  322. _Mode_(_Mode) {}
  323. protected:
  324. virtual result
  325. do_out(state_type& __st,
  326. const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
  327. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  328. virtual result
  329. do_in(state_type& __st,
  330. const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
  331. intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
  332. virtual result
  333. do_unshift(state_type& __st,
  334. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  335. virtual int do_encoding() const throw();
  336. virtual bool do_always_noconv() const throw();
  337. virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
  338. size_t __mx) const;
  339. virtual int do_max_length() const throw();
  340. };
  341. template <>
  342. class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
  343. : public codecvt<char32_t, char, mbstate_t>
  344. {
  345. unsigned long _Maxcode_;
  346. codecvt_mode _Mode_;
  347. public:
  348. typedef char32_t intern_type;
  349. typedef char extern_type;
  350. typedef mbstate_t state_type;
  351. _LIBCPP_ALWAYS_INLINE
  352. explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
  353. codecvt_mode _Mode)
  354. : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
  355. _Mode_(_Mode) {}
  356. protected:
  357. virtual result
  358. do_out(state_type& __st,
  359. const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
  360. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  361. virtual result
  362. do_in(state_type& __st,
  363. const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
  364. intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
  365. virtual result
  366. do_unshift(state_type& __st,
  367. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  368. virtual int do_encoding() const throw();
  369. virtual bool do_always_noconv() const throw();
  370. virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
  371. size_t __mx) const;
  372. virtual int do_max_length() const throw();
  373. };
  374. template <class _Elem, unsigned long _Maxcode = 0x10ffff,
  375. codecvt_mode _Mode = (codecvt_mode)0>
  376. class _LIBCPP_TYPE_VIS_ONLY codecvt_utf16
  377. : public __codecvt_utf16<_Elem, _Mode & little_endian>
  378. {
  379. public:
  380. _LIBCPP_ALWAYS_INLINE
  381. explicit codecvt_utf16(size_t __refs = 0)
  382. : __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
  383. _LIBCPP_ALWAYS_INLINE
  384. ~codecvt_utf16() {}
  385. };
  386. // codecvt_utf8_utf16
  387. template <class _Elem> class __codecvt_utf8_utf16;
  388. template <>
  389. class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t>
  390. : public codecvt<wchar_t, char, mbstate_t>
  391. {
  392. unsigned long _Maxcode_;
  393. codecvt_mode _Mode_;
  394. public:
  395. typedef wchar_t intern_type;
  396. typedef char extern_type;
  397. typedef mbstate_t state_type;
  398. _LIBCPP_ALWAYS_INLINE
  399. explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
  400. codecvt_mode _Mode)
  401. : codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
  402. _Mode_(_Mode) {}
  403. protected:
  404. virtual result
  405. do_out(state_type& __st,
  406. const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
  407. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  408. virtual result
  409. do_in(state_type& __st,
  410. const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
  411. intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
  412. virtual result
  413. do_unshift(state_type& __st,
  414. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  415. virtual int do_encoding() const throw();
  416. virtual bool do_always_noconv() const throw();
  417. virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
  418. size_t __mx) const;
  419. virtual int do_max_length() const throw();
  420. };
  421. template <>
  422. class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
  423. : public codecvt<char32_t, char, mbstate_t>
  424. {
  425. unsigned long _Maxcode_;
  426. codecvt_mode _Mode_;
  427. public:
  428. typedef char32_t intern_type;
  429. typedef char extern_type;
  430. typedef mbstate_t state_type;
  431. _LIBCPP_ALWAYS_INLINE
  432. explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
  433. codecvt_mode _Mode)
  434. : codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
  435. _Mode_(_Mode) {}
  436. protected:
  437. virtual result
  438. do_out(state_type& __st,
  439. const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
  440. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  441. virtual result
  442. do_in(state_type& __st,
  443. const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
  444. intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
  445. virtual result
  446. do_unshift(state_type& __st,
  447. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  448. virtual int do_encoding() const throw();
  449. virtual bool do_always_noconv() const throw();
  450. virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
  451. size_t __mx) const;
  452. virtual int do_max_length() const throw();
  453. };
  454. template <>
  455. class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
  456. : public codecvt<char16_t, char, mbstate_t>
  457. {
  458. unsigned long _Maxcode_;
  459. codecvt_mode _Mode_;
  460. public:
  461. typedef char16_t intern_type;
  462. typedef char extern_type;
  463. typedef mbstate_t state_type;
  464. _LIBCPP_ALWAYS_INLINE
  465. explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
  466. codecvt_mode _Mode)
  467. : codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
  468. _Mode_(_Mode) {}
  469. protected:
  470. virtual result
  471. do_out(state_type& __st,
  472. const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
  473. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  474. virtual result
  475. do_in(state_type& __st,
  476. const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
  477. intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
  478. virtual result
  479. do_unshift(state_type& __st,
  480. extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
  481. virtual int do_encoding() const throw();
  482. virtual bool do_always_noconv() const throw();
  483. virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end,
  484. size_t __mx) const;
  485. virtual int do_max_length() const throw();
  486. };
  487. template <class _Elem, unsigned long _Maxcode = 0x10ffff,
  488. codecvt_mode _Mode = (codecvt_mode)0>
  489. class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8_utf16
  490. : public __codecvt_utf8_utf16<_Elem>
  491. {
  492. public:
  493. _LIBCPP_ALWAYS_INLINE
  494. explicit codecvt_utf8_utf16(size_t __refs = 0)
  495. : __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
  496. _LIBCPP_ALWAYS_INLINE
  497. ~codecvt_utf8_utf16() {}
  498. };
  499. _LIBCPP_END_NAMESPACE_STD
  500. #endif // _LIBCPP_SGX_CONFIG
  501. #endif // _LIBCPP_CODECVT