source: mainline/uspace/lib/cpp/src/iomanip.cpp@ 8fd0675f

Last change on this file since 8fd0675f was b57ba05, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Update headers in C++ files

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 * SPDX-FileCopyrightText: 2018 Jaroslav Jindrak
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <__bits/io/iomanip_objs.hpp>
8#include <iomanip>
9
10namespace std
11{
12 namespace aux
13 {
14 /**
15 * Manipulator return types:
16 */
17
18 resetiosflags_t::resetiosflags_t(ios_base::fmtflags m)
19 : mask{m}
20 { /* DUMMY BODY */ }
21
22 void resetiosflags_t::operator()(ios_base& str) const
23 {
24 str.setf(ios_base::fmtflags{0}, mask);
25 }
26
27 setiosflags_t::setiosflags_t(ios_base::fmtflags m)
28 : mask{m}
29 { /* DUMMY BODY */ }
30
31 void setiosflags_t::operator()(ios_base& str) const
32 {
33 str.setf(mask);
34 }
35
36 setbase_t::setbase_t(int b)
37 : base{b}
38 { /* DUMMY BODY */ }
39
40 void setbase_t::operator()(ios_base& str) const
41 {
42 str.setf(
43 base == 8 ? ios_base::oct :
44 base == 10 ? ios_base::dec :
45 base == 16 ? ios_base::hex :
46 ios_base::fmtflags{0},
47 ios_base::basefield
48 );
49 }
50
51 setprecision_t::setprecision_t(int p)
52 : prec{p}
53 { /* DUMMY BODY */ }
54
55 void setprecision_t::operator()(ios_base& str) const
56 {
57 str.precision(prec);
58 }
59
60 setw_t::setw_t(int w)
61 : width{w}
62 { /* DUMMY BODY */ }
63
64 void setw_t::operator()(ios_base& str) const
65 {
66 str.width(width);
67 }
68 }
69
70 /**
71 * Manipulators:
72 */
73
74 aux::manip_wrapper<aux::resetiosflags_t> resetiosflags(ios_base::fmtflags mask)
75 {
76 return aux::manip_wrapper<aux::resetiosflags_t>{mask};
77 }
78
79 aux::manip_wrapper<aux::setiosflags_t> setiosflags(ios_base::fmtflags mask)
80 {
81 return aux::manip_wrapper<aux::setiosflags_t>{mask};
82 }
83
84 aux::manip_wrapper<aux::setbase_t> setbase(int base)
85 {
86 return aux::manip_wrapper<aux::setbase_t>{base};
87 }
88
89 aux::manip_wrapper<aux::setprecision_t> setprecision(int prec)
90 {
91 return aux::manip_wrapper<aux::setprecision_t>{prec};
92 }
93
94 aux::manip_wrapper<aux::setw_t> setw(int width)
95 {
96 return aux::manip_wrapper<aux::setw_t>{width};
97 }
98}
Note: See TracBrowser for help on using the repository browser.