Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/ratio/ratio_io.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 // ratio_io | |
2 // | |
3 // (C) Copyright Howard Hinnant | |
4 // (C) Copyright 2010 Vicente J. Botet Escriba | |
5 // Use, modification and distribution are subject to the Boost Software License, | |
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
7 // http://www.boost.org/LICENSE_1_0.txt). | |
8 // | |
9 // This code was adapted by Vicente from Howard Hinnant's experimental work | |
10 // on chrono i/o under lvm/libc++ to Boost | |
11 | |
12 #ifndef BOOST_RATIO_RATIO_IO_HPP | |
13 #define BOOST_RATIO_RATIO_IO_HPP | |
14 | |
15 /* | |
16 | |
17 ratio_io synopsis | |
18 | |
19 #include <ratio> | |
20 #include <string> | |
21 | |
22 namespace boost | |
23 { | |
24 | |
25 template <class Ratio, class CharT> | |
26 struct ratio_string | |
27 { | |
28 static basic_string<CharT> prefix(); | |
29 static basic_string<CharT> symbol(); | |
30 }; | |
31 | |
32 } // boost | |
33 | |
34 */ | |
35 #include <boost/ratio/config.hpp> | |
36 | |
37 #ifdef BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0 | |
38 #include <boost/ratio/detail/ratio_io.hpp> | |
39 #else | |
40 | |
41 #include <boost/config.hpp> | |
42 #include <boost/ratio/ratio.hpp> | |
43 #include <boost/type_traits/integral_constant.hpp> | |
44 #include <string> | |
45 #include <sstream> | |
46 | |
47 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
48 #include <boost/ratio/ratio_static_string.hpp> | |
49 #include <boost/static_string/static_string.hpp> | |
50 #endif | |
51 | |
52 #if defined(BOOST_NO_CXX11_UNICODE_LITERALS) || defined(BOOST_NO_CXX11_CHAR16_T) || defined(BOOST_NO_CXX11_CHAR32_T) || defined(BOOST_NO_CXX11_U16STRING) || defined(BOOST_NO_CXX11_U32STRING) | |
53 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
54 #undef BOOST_RATIO_HAS_UNICODE_SUPPORT | |
55 #endif | |
56 #else | |
57 #define BOOST_RATIO_HAS_UNICODE_SUPPORT 1 | |
58 #endif | |
59 | |
60 namespace boost { | |
61 | |
62 //template <class Ratio> | |
63 //struct ratio_string_is_localizable : false_type {}; | |
64 //template <class Ratio> | |
65 //struct ratio_string_id : integral_constant<int,0> {}; | |
66 | |
67 template <class Ratio, class CharT> | |
68 struct ratio_string | |
69 { | |
70 static std::basic_string<CharT> symbol() {return prefix();} | |
71 static std::basic_string<CharT> prefix(); | |
72 }; | |
73 | |
74 template <class Ratio, class CharT> | |
75 std::basic_string<CharT> | |
76 ratio_string<Ratio, CharT>::prefix() | |
77 { | |
78 std::basic_ostringstream<CharT> os; | |
79 os << CharT('[') << Ratio::num << CharT('/') | |
80 << Ratio::den << CharT(']'); | |
81 return os.str(); | |
82 } | |
83 | |
84 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
85 namespace ratio_detail { | |
86 template <class Ratio, class CharT> | |
87 struct ratio_string_static | |
88 { | |
89 static std::string symbol() { | |
90 return std::basic_string<CharT>( | |
91 static_string::c_str< | |
92 typename ratio_static_string<Ratio, CharT>::symbol | |
93 >::value); | |
94 } | |
95 static std::string prefix() { | |
96 return std::basic_string<CharT>( | |
97 static_string::c_str< | |
98 typename ratio_static_string<Ratio, CharT>::prefix | |
99 >::value); | |
100 } | |
101 }; | |
102 } | |
103 #endif | |
104 // atto | |
105 //template <> | |
106 //struct ratio_string_is_localizable<atto> : true_type {}; | |
107 // | |
108 //template <> | |
109 //struct ratio_string_id<atto> : integral_constant<int,-18> {}; | |
110 | |
111 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
112 template <typename CharT> | |
113 struct ratio_string<atto, CharT> : | |
114 ratio_detail::ratio_string_static<atto,CharT> | |
115 {}; | |
116 | |
117 #else | |
118 template <> | |
119 struct ratio_string<atto, char> | |
120 { | |
121 static std::string symbol() {return std::string(1, 'a');} | |
122 static std::string prefix() {return std::string("atto");} | |
123 }; | |
124 | |
125 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
126 | |
127 template <> | |
128 struct ratio_string<atto, char16_t> | |
129 { | |
130 static std::u16string symbol() {return std::u16string(1, u'a');} | |
131 static std::u16string prefix() {return std::u16string(u"atto");} | |
132 }; | |
133 | |
134 template <> | |
135 struct ratio_string<atto, char32_t> | |
136 { | |
137 static std::u32string symbol() {return std::u32string(1, U'a');} | |
138 static std::u32string prefix() {return std::u32string(U"atto");} | |
139 }; | |
140 | |
141 #endif | |
142 | |
143 #ifndef BOOST_NO_STD_WSTRING | |
144 template <> | |
145 struct ratio_string<atto, wchar_t> | |
146 { | |
147 static std::wstring symbol() {return std::wstring(1, L'a');} | |
148 static std::wstring prefix() {return std::wstring(L"atto");} | |
149 }; | |
150 #endif | |
151 #endif | |
152 | |
153 // femto | |
154 | |
155 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
156 template <typename CharT> | |
157 struct ratio_string<femto, CharT> : | |
158 ratio_detail::ratio_string_static<femto,CharT> | |
159 {}; | |
160 | |
161 #else | |
162 | |
163 template <> | |
164 struct ratio_string<femto, char> | |
165 { | |
166 static std::string symbol() {return std::string(1, 'f');} | |
167 static std::string prefix() {return std::string("femto");} | |
168 }; | |
169 | |
170 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
171 | |
172 template <> | |
173 struct ratio_string<femto, char16_t> | |
174 { | |
175 static std::u16string symbol() {return std::u16string(1, u'f');} | |
176 static std::u16string prefix() {return std::u16string(u"femto");} | |
177 }; | |
178 | |
179 template <> | |
180 struct ratio_string<femto, char32_t> | |
181 { | |
182 static std::u32string symbol() {return std::u32string(1, U'f');} | |
183 static std::u32string prefix() {return std::u32string(U"femto");} | |
184 }; | |
185 | |
186 #endif | |
187 | |
188 #ifndef BOOST_NO_STD_WSTRING | |
189 template <> | |
190 struct ratio_string<femto, wchar_t> | |
191 { | |
192 static std::wstring symbol() {return std::wstring(1, L'f');} | |
193 static std::wstring prefix() {return std::wstring(L"femto");} | |
194 }; | |
195 #endif | |
196 #endif | |
197 | |
198 // pico | |
199 | |
200 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
201 template <typename CharT> | |
202 struct ratio_string<pico, CharT> : | |
203 ratio_detail::ratio_string_static<pico,CharT> | |
204 {}; | |
205 | |
206 #else | |
207 template <> | |
208 struct ratio_string<pico, char> | |
209 { | |
210 static std::string symbol() {return std::string(1, 'p');} | |
211 static std::string prefix() {return std::string("pico");} | |
212 }; | |
213 | |
214 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
215 | |
216 template <> | |
217 struct ratio_string<pico, char16_t> | |
218 { | |
219 static std::u16string symbol() {return std::u16string(1, u'p');} | |
220 static std::u16string prefix() {return std::u16string(u"pico");} | |
221 }; | |
222 | |
223 template <> | |
224 struct ratio_string<pico, char32_t> | |
225 { | |
226 static std::u32string symbol() {return std::u32string(1, U'p');} | |
227 static std::u32string prefix() {return std::u32string(U"pico");} | |
228 }; | |
229 | |
230 #endif | |
231 | |
232 #ifndef BOOST_NO_STD_WSTRING | |
233 template <> | |
234 struct ratio_string<pico, wchar_t> | |
235 { | |
236 static std::wstring symbol() {return std::wstring(1, L'p');} | |
237 static std::wstring prefix() {return std::wstring(L"pico");} | |
238 }; | |
239 #endif | |
240 #endif | |
241 | |
242 // nano | |
243 | |
244 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
245 template <typename CharT> | |
246 struct ratio_string<nano, CharT> : | |
247 ratio_detail::ratio_string_static<nano,CharT> | |
248 {}; | |
249 | |
250 #else | |
251 template <> | |
252 struct ratio_string<nano, char> | |
253 { | |
254 static std::string symbol() {return std::string(1, 'n');} | |
255 static std::string prefix() {return std::string("nano");} | |
256 }; | |
257 | |
258 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
259 | |
260 template <> | |
261 struct ratio_string<nano, char16_t> | |
262 { | |
263 static std::u16string symbol() {return std::u16string(1, u'n');} | |
264 static std::u16string prefix() {return std::u16string(u"nano");} | |
265 }; | |
266 | |
267 template <> | |
268 struct ratio_string<nano, char32_t> | |
269 { | |
270 static std::u32string symbol() {return std::u32string(1, U'n');} | |
271 static std::u32string prefix() {return std::u32string(U"nano");} | |
272 }; | |
273 | |
274 #endif | |
275 | |
276 #ifndef BOOST_NO_STD_WSTRING | |
277 template <> | |
278 struct ratio_string<nano, wchar_t> | |
279 { | |
280 static std::wstring symbol() {return std::wstring(1, L'n');} | |
281 static std::wstring prefix() {return std::wstring(L"nano");} | |
282 }; | |
283 #endif | |
284 #endif | |
285 | |
286 // micro | |
287 | |
288 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
289 template <typename CharT> | |
290 struct ratio_string<micro, CharT> : | |
291 ratio_detail::ratio_string_static<micro,CharT> | |
292 {}; | |
293 | |
294 #else | |
295 template <> | |
296 struct ratio_string<micro, char> | |
297 { | |
298 static std::string symbol() {return std::string("\xC2\xB5");} | |
299 static std::string prefix() {return std::string("micro");} | |
300 }; | |
301 | |
302 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
303 | |
304 template <> | |
305 struct ratio_string<micro, char16_t> | |
306 { | |
307 static std::u16string symbol() {return std::u16string(1, u'\xB5');} | |
308 static std::u16string prefix() {return std::u16string(u"micro");} | |
309 }; | |
310 | |
311 template <> | |
312 struct ratio_string<micro, char32_t> | |
313 { | |
314 static std::u32string symbol() {return std::u32string(1, U'\xB5');} | |
315 static std::u32string prefix() {return std::u32string(U"micro");} | |
316 }; | |
317 | |
318 #endif | |
319 | |
320 #ifndef BOOST_NO_STD_WSTRING | |
321 template <> | |
322 struct ratio_string<micro, wchar_t> | |
323 { | |
324 static std::wstring symbol() {return std::wstring(1, L'\xB5');} | |
325 static std::wstring prefix() {return std::wstring(L"micro");} | |
326 }; | |
327 #endif | |
328 #endif | |
329 | |
330 // milli | |
331 | |
332 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
333 template <typename CharT> | |
334 struct ratio_string<milli, CharT> : | |
335 ratio_detail::ratio_string_static<milli,CharT> | |
336 {}; | |
337 | |
338 #else | |
339 template <> | |
340 struct ratio_string<milli, char> | |
341 { | |
342 static std::string symbol() {return std::string(1, 'm');} | |
343 static std::string prefix() {return std::string("milli");} | |
344 }; | |
345 | |
346 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
347 | |
348 template <> | |
349 struct ratio_string<milli, char16_t> | |
350 { | |
351 static std::u16string symbol() {return std::u16string(1, u'm');} | |
352 static std::u16string prefix() {return std::u16string(u"milli");} | |
353 }; | |
354 | |
355 template <> | |
356 struct ratio_string<milli, char32_t> | |
357 { | |
358 static std::u32string symbol() {return std::u32string(1, U'm');} | |
359 static std::u32string prefix() {return std::u32string(U"milli");} | |
360 }; | |
361 | |
362 #endif | |
363 | |
364 #ifndef BOOST_NO_STD_WSTRING | |
365 template <> | |
366 struct ratio_string<milli, wchar_t> | |
367 { | |
368 static std::wstring symbol() {return std::wstring(1, L'm');} | |
369 static std::wstring prefix() {return std::wstring(L"milli");} | |
370 }; | |
371 #endif | |
372 #endif | |
373 | |
374 // centi | |
375 | |
376 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
377 template <typename CharT> | |
378 struct ratio_string<centi, CharT> : | |
379 ratio_detail::ratio_string_static<centi,CharT> | |
380 {}; | |
381 | |
382 #else | |
383 template <> | |
384 struct ratio_string<centi, char> | |
385 { | |
386 static std::string symbol() {return std::string(1, 'c');} | |
387 static std::string prefix() {return std::string("centi");} | |
388 }; | |
389 | |
390 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
391 | |
392 template <> | |
393 struct ratio_string<centi, char16_t> | |
394 { | |
395 static std::u16string symbol() {return std::u16string(1, u'c');} | |
396 static std::u16string prefix() {return std::u16string(u"centi");} | |
397 }; | |
398 | |
399 template <> | |
400 struct ratio_string<centi, char32_t> | |
401 { | |
402 static std::u32string symbol() {return std::u32string(1, U'c');} | |
403 static std::u32string prefix() {return std::u32string(U"centi");} | |
404 }; | |
405 | |
406 #endif | |
407 | |
408 #ifndef BOOST_NO_STD_WSTRING | |
409 template <> | |
410 struct ratio_string<centi, wchar_t> | |
411 { | |
412 static std::wstring symbol() {return std::wstring(1, L'c');} | |
413 static std::wstring prefix() {return std::wstring(L"centi");} | |
414 }; | |
415 #endif | |
416 #endif | |
417 | |
418 // deci | |
419 | |
420 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
421 template <typename CharT> | |
422 struct ratio_string<deci, CharT> : | |
423 ratio_detail::ratio_string_static<deci,CharT> | |
424 {}; | |
425 | |
426 #else | |
427 | |
428 template <> | |
429 struct ratio_string<deci, char> | |
430 { | |
431 static std::string symbol() {return std::string(1, 'd');} | |
432 static std::string prefix() {return std::string("deci");} | |
433 }; | |
434 | |
435 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
436 | |
437 template <> | |
438 struct ratio_string<deci, char16_t> | |
439 { | |
440 static std::u16string symbol() {return std::u16string(1, u'd');} | |
441 static std::u16string prefix() {return std::u16string(u"deci");} | |
442 }; | |
443 | |
444 template <> | |
445 struct ratio_string<deci, char32_t> | |
446 { | |
447 static std::u32string symbol() {return std::u32string(1, U'd');} | |
448 static std::u32string prefix() {return std::u32string(U"deci");} | |
449 }; | |
450 | |
451 #endif | |
452 | |
453 #ifndef BOOST_NO_STD_WSTRING | |
454 template <> | |
455 struct ratio_string<deci, wchar_t> | |
456 { | |
457 static std::wstring symbol() {return std::wstring(1, L'd');} | |
458 static std::wstring prefix() {return std::wstring(L"deci");} | |
459 }; | |
460 #endif | |
461 #endif | |
462 | |
463 // unit | |
464 | |
465 // deca | |
466 | |
467 | |
468 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
469 template <typename CharT> | |
470 struct ratio_string<deca, CharT> : | |
471 ratio_detail::ratio_string_static<deca,CharT> | |
472 {}; | |
473 | |
474 #else | |
475 template <> | |
476 struct ratio_string<deca, char> | |
477 { | |
478 static std::string symbol() {return std::string("da");} | |
479 static std::string prefix() {return std::string("deca");} | |
480 }; | |
481 | |
482 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
483 | |
484 template <> | |
485 struct ratio_string<deca, char16_t> | |
486 { | |
487 static std::u16string symbol() {return std::u16string(u"da");} | |
488 static std::u16string prefix() {return std::u16string(u"deca");} | |
489 }; | |
490 | |
491 template <> | |
492 struct ratio_string<deca, char32_t> | |
493 { | |
494 static std::u32string symbol() {return std::u32string(U"da");} | |
495 static std::u32string prefix() {return std::u32string(U"deca");} | |
496 }; | |
497 | |
498 #endif | |
499 | |
500 #ifndef BOOST_NO_STD_WSTRING | |
501 template <> | |
502 struct ratio_string<deca, wchar_t> | |
503 { | |
504 static std::wstring symbol() {return std::wstring(L"da");} | |
505 static std::wstring prefix() {return std::wstring(L"deca");} | |
506 }; | |
507 #endif | |
508 #endif | |
509 | |
510 // hecto | |
511 | |
512 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
513 template <typename CharT> | |
514 struct ratio_string<hecto, CharT> : | |
515 ratio_detail::ratio_string_static<hecto,CharT> | |
516 {}; | |
517 | |
518 #else | |
519 template <> | |
520 struct ratio_string<hecto, char> | |
521 { | |
522 static std::string symbol() {return std::string(1, 'h');} | |
523 static std::string prefix() {return std::string("hecto");} | |
524 }; | |
525 | |
526 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
527 | |
528 template <> | |
529 struct ratio_string<hecto, char16_t> | |
530 { | |
531 static std::u16string symbol() {return std::u16string(1, u'h');} | |
532 static std::u16string prefix() {return std::u16string(u"hecto");} | |
533 }; | |
534 | |
535 template <> | |
536 struct ratio_string<hecto, char32_t> | |
537 { | |
538 static std::u32string symbol() {return std::u32string(1, U'h');} | |
539 static std::u32string prefix() {return std::u32string(U"hecto");} | |
540 }; | |
541 | |
542 #endif | |
543 | |
544 #ifndef BOOST_NO_STD_WSTRING | |
545 template <> | |
546 struct ratio_string<hecto, wchar_t> | |
547 { | |
548 static std::wstring symbol() {return std::wstring(1, L'h');} | |
549 static std::wstring prefix() {return std::wstring(L"hecto");} | |
550 }; | |
551 #endif | |
552 #endif | |
553 | |
554 // kilo | |
555 | |
556 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
557 template <typename CharT> | |
558 struct ratio_string<kilo, CharT> : | |
559 ratio_detail::ratio_string_static<kilo,CharT> | |
560 {}; | |
561 | |
562 #else | |
563 template <> | |
564 struct ratio_string<kilo, char> | |
565 { | |
566 static std::string symbol() {return std::string(1, 'k');} | |
567 static std::string prefix() {return std::string("kilo");} | |
568 }; | |
569 | |
570 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
571 | |
572 template <> | |
573 struct ratio_string<kilo, char16_t> | |
574 { | |
575 static std::u16string symbol() {return std::u16string(1, u'k');} | |
576 static std::u16string prefix() {return std::u16string(u"kilo");} | |
577 }; | |
578 | |
579 template <> | |
580 struct ratio_string<kilo, char32_t> | |
581 { | |
582 static std::u32string symbol() {return std::u32string(1, U'k');} | |
583 static std::u32string prefix() {return std::u32string(U"kilo");} | |
584 }; | |
585 | |
586 #endif | |
587 | |
588 #ifndef BOOST_NO_STD_WSTRING | |
589 template <> | |
590 struct ratio_string<kilo, wchar_t> | |
591 { | |
592 static std::wstring symbol() {return std::wstring(1, L'k');} | |
593 static std::wstring prefix() {return std::wstring(L"kilo");} | |
594 }; | |
595 #endif | |
596 #endif | |
597 | |
598 // mega | |
599 | |
600 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
601 template <typename CharT> | |
602 struct ratio_string<mega, CharT> : | |
603 ratio_detail::ratio_string_static<mega,CharT> | |
604 {}; | |
605 | |
606 #else | |
607 | |
608 template <> | |
609 struct ratio_string<mega, char> | |
610 { | |
611 static std::string symbol() {return std::string(1, 'M');} | |
612 static std::string prefix() {return std::string("mega");} | |
613 }; | |
614 | |
615 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
616 | |
617 template <> | |
618 struct ratio_string<mega, char16_t> | |
619 { | |
620 static std::u16string symbol() {return std::u16string(1, u'M');} | |
621 static std::u16string prefix() {return std::u16string(u"mega");} | |
622 }; | |
623 | |
624 template <> | |
625 struct ratio_string<mega, char32_t> | |
626 { | |
627 static std::u32string symbol() {return std::u32string(1, U'M');} | |
628 static std::u32string prefix() {return std::u32string(U"mega");} | |
629 }; | |
630 | |
631 #endif | |
632 | |
633 #ifndef BOOST_NO_STD_WSTRING | |
634 template <> | |
635 struct ratio_string<mega, wchar_t> | |
636 { | |
637 static std::wstring symbol() {return std::wstring(1, L'M');} | |
638 static std::wstring prefix() {return std::wstring(L"mega");} | |
639 }; | |
640 #endif | |
641 #endif | |
642 | |
643 // giga | |
644 | |
645 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
646 template <typename CharT> | |
647 struct ratio_string<giga, CharT> : | |
648 ratio_detail::ratio_string_static<giga,CharT> | |
649 {}; | |
650 | |
651 #else | |
652 | |
653 template <> | |
654 struct ratio_string<giga, char> | |
655 { | |
656 static std::string symbol() {return std::string(1, 'G');} | |
657 static std::string prefix() {return std::string("giga");} | |
658 }; | |
659 | |
660 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
661 | |
662 template <> | |
663 struct ratio_string<giga, char16_t> | |
664 { | |
665 static std::u16string symbol() {return std::u16string(1, u'G');} | |
666 static std::u16string prefix() {return std::u16string(u"giga");} | |
667 }; | |
668 | |
669 template <> | |
670 struct ratio_string<giga, char32_t> | |
671 { | |
672 static std::u32string symbol() {return std::u32string(1, U'G');} | |
673 static std::u32string prefix() {return std::u32string(U"giga");} | |
674 }; | |
675 | |
676 #endif | |
677 | |
678 #ifndef BOOST_NO_STD_WSTRING | |
679 template <> | |
680 struct ratio_string<giga, wchar_t> | |
681 { | |
682 static std::wstring symbol() {return std::wstring(1, L'G');} | |
683 static std::wstring prefix() {return std::wstring(L"giga");} | |
684 }; | |
685 #endif | |
686 #endif | |
687 | |
688 // tera | |
689 | |
690 //template <> | |
691 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
692 template <typename CharT> | |
693 struct ratio_string<tera, CharT> : | |
694 ratio_detail::ratio_string_static<tera,CharT> | |
695 {}; | |
696 | |
697 #else | |
698 template <> | |
699 struct ratio_string<tera, char> | |
700 { | |
701 static std::string symbol() {return std::string(1, 'T');} | |
702 static std::string prefix() {return std::string("tera");} | |
703 }; | |
704 | |
705 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
706 | |
707 template <> | |
708 struct ratio_string<tera, char16_t> | |
709 { | |
710 static std::u16string symbol() {return std::u16string(1, u'T');} | |
711 static std::u16string prefix() {return std::u16string(u"tera");} | |
712 }; | |
713 | |
714 template <> | |
715 struct ratio_string<tera, char32_t> | |
716 { | |
717 static std::u32string symbol() {return std::u32string(1, U'T');} | |
718 static std::u32string prefix() {return std::u32string(U"tera");} | |
719 }; | |
720 | |
721 #endif | |
722 | |
723 #ifndef BOOST_NO_STD_WSTRING | |
724 template <> | |
725 struct ratio_string<tera, wchar_t> | |
726 { | |
727 static std::wstring symbol() {return std::wstring(1, L'T');} | |
728 static std::wstring prefix() {return std::wstring(L"tera");} | |
729 }; | |
730 #endif | |
731 #endif | |
732 | |
733 // peta | |
734 | |
735 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
736 template <typename CharT> | |
737 struct ratio_string<peta, CharT> : | |
738 ratio_detail::ratio_string_static<peta,CharT> | |
739 {}; | |
740 | |
741 #else | |
742 template <> | |
743 struct ratio_string<peta, char> | |
744 { | |
745 static std::string symbol() {return std::string(1, 'P');} | |
746 static std::string prefix() {return std::string("peta");} | |
747 }; | |
748 | |
749 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
750 | |
751 template <> | |
752 struct ratio_string<peta, char16_t> | |
753 { | |
754 static std::u16string symbol() {return std::u16string(1, u'P');} | |
755 static std::u16string prefix() {return std::u16string(u"peta");} | |
756 }; | |
757 | |
758 template <> | |
759 struct ratio_string<peta, char32_t> | |
760 { | |
761 static std::u32string symbol() {return std::u32string(1, U'P');} | |
762 static std::u32string prefix() {return std::u32string(U"peta");} | |
763 }; | |
764 | |
765 #endif | |
766 | |
767 #ifndef BOOST_NO_STD_WSTRING | |
768 template <> | |
769 struct ratio_string<peta, wchar_t> | |
770 { | |
771 static std::wstring symbol() {return std::wstring(1, L'P');} | |
772 static std::wstring prefix() {return std::wstring(L"peta");} | |
773 }; | |
774 #endif | |
775 #endif | |
776 | |
777 // exa | |
778 | |
779 #ifdef BOOST_RATIO_HAS_STATIC_STRING | |
780 template <typename CharT> | |
781 struct ratio_string<exa, CharT> : | |
782 ratio_detail::ratio_string_static<exa,CharT> | |
783 {}; | |
784 | |
785 #else | |
786 template <> | |
787 struct ratio_string<exa, char> | |
788 { | |
789 static std::string symbol() {return std::string(1, 'E');} | |
790 static std::string prefix() {return std::string("exa");} | |
791 }; | |
792 | |
793 #if defined BOOST_RATIO_HAS_UNICODE_SUPPORT | |
794 | |
795 template <> | |
796 struct ratio_string<exa, char16_t> | |
797 { | |
798 static std::u16string symbol() {return std::u16string(1, u'E');} | |
799 static std::u16string prefix() {return std::u16string(u"exa");} | |
800 }; | |
801 | |
802 template <> | |
803 struct ratio_string<exa, char32_t> | |
804 { | |
805 static std::u32string symbol() {return std::u32string(1, U'E');} | |
806 static std::u32string prefix() {return std::u32string(U"exa");} | |
807 }; | |
808 | |
809 #endif | |
810 | |
811 #ifndef BOOST_NO_STD_WSTRING | |
812 template <> | |
813 struct ratio_string<exa, wchar_t> | |
814 { | |
815 static std::wstring symbol() {return std::wstring(1, L'E');} | |
816 static std::wstring prefix() {return std::wstring(L"exa");} | |
817 }; | |
818 #endif | |
819 #endif | |
820 | |
821 } | |
822 | |
823 #endif // BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0 | |
824 #endif // BOOST_RATIO_RATIO_IO_HPP |