0.9.6: io.hpp Source File

| 0.9.6

- Main Page
- Modules
- Files

- File List

io.hpp
Go to the documentation of this file.
1
47 #pragma once
48
49 // Dependency:
50 #include "../glm.hpp"
51 #include "../gtx/quaternion.hpp"
52
53 #if(defined(GLM_MESSAGES) && !defined(glm_ext))
54 # pragma message("GLM: GLM_GTX_io extension included")
55 #endif
56
57 #include <iosfwd> // std::basic_ostream<> (fwd)
58 #include <locale> // std::locale, std::locale::facet, std::locale::id
59 #include <utility> // std::pair<>
60
61 namespace glm
62 {
65
66 namespace io
67 {
68 enum order_type { column_major, row_major};
69
70 template <typename CTy>
71 class format_punct : public std::locale::facet
72 {
73 typedef CTy char_type;
74
75 public:
76
77 static std::locale::id id;
78
79 bool formatted;
80 unsigned precision;
81 unsigned width;
82 char_type separator;
83 char_type delim_left;
84 char_type delim_right;
85 char_type space;
86 char_type newline;
87 order_type order;
88
89 explicit format_punct(size_t a = 0);
90 explicit format_punct(format_punct const&);
91 };
92
93 template <typename CTy, typename CTr = std::char_traits<CTy> >
94 class basic_state_saver {
95
96 public:
97
98 explicit basic_state_saver(std::basic_ios<CTy,CTr>&);
99 ~basic_state_saver();
100
101 private:
102
103 typedef ::std::basic_ios<CTy,CTr> state_type;
104 typedef typename state_type::char_type char_type;
105 typedef ::std::ios_base::fmtflags flags_type;
106 typedef ::std::streamsize streamsize_type;
107 typedef ::std::locale const locale_type;
108
109 state_type& state_;
110 flags_type flags_;
111 streamsize_type precision_;
112 streamsize_type width_;
113 char_type fill_;
114 locale_type locale_;
115
116 basic_state_saver& operator=(basic_state_saver const&);
117 };
118
119 typedef basic_state_saver<char> state_saver;
120 typedef basic_state_saver<wchar_t> wstate_saver;
121
122 template <typename CTy, typename CTr = std::char_traits<CTy> >
123 class basic_format_saver
124 {
125 public:
126
127 explicit basic_format_saver(std::basic_ios<CTy,CTr>&);
128 ~basic_format_saver();
129
130 private:
131
132 basic_state_saver<CTy> const bss_;
133
134 basic_format_saver& operator=(basic_format_saver const&);
135 };
136
137 typedef basic_format_saver<char> format_saver;
138 typedef basic_format_saver<wchar_t> wformat_saver;
139
140 struct precision
141 {
142 unsigned value;
143
144 explicit precision(unsigned);
145 };
146
147 struct width
148 {
149 unsigned value;
150
151 explicit width(unsigned);
152 };
153
154 template <typename CTy>
155 struct delimeter
156 {
157 CTy value[3];
158
159 explicit delimeter(CTy /* left */, CTy /* right */, CTy /* separator */ = ',');
160 };
161
162 struct order
163 {
164 order_type value;
165
166 explicit order(order_type);
167 };
168
169 // functions, inlined (inline)
170
171 template <typename FTy, typename CTy, typename CTr>
172 FTy const& get_facet(std::basic_ios<CTy,CTr>&);
173 template <typename FTy, typename CTy, typename CTr>
174 std::basic_ios<CTy,CTr>& formatted(std::basic_ios<CTy,CTr>&);
175 template <typename FTy, typename CTy, typename CTr>
176 std::basic_ios<CTy,CTr>& unformattet(std::basic_ios<CTy,CTr>&);
177
178 template <typename CTy, typename CTr>
179 std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, precision const&);
180 template <typename CTy, typename CTr>
181 std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, width const&);
182 template <typename CTy, typename CTr>
183 std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, delimeter<CTy> const&);
184 template <typename CTy, typename CTr>
185 std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, order const&);
186 }//namespace io
187
188 template <typename CTy, typename CTr, typename T, precision P>
189 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tquat<T,P> const&);
190 template <typename CTy, typename CTr, typename T, precision P>
191 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec2<T,P> const&);
192 template <typename CTy, typename CTr, typename T, precision P>
193 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec3<T,P> const&);
194 template <typename CTy, typename CTr, typename T, precision P>
195 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec4<T,P> const&);
196 template <typename CTy, typename CTr, typename T, precision P>
197 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x2<T,P> const&);
198 template <typename CTy, typename CTr, typename T, precision P>
199 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x3<T,P> const&);
200 template <typename CTy, typename CTr, typename T, precision P>
201 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x4<T,P> const&);
202 template <typename CTy, typename CTr, typename T, precision P>
203 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x2<T,P> const&);
204 template <typename CTy, typename CTr, typename T, precision P>
205 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x3<T,P> const&);
206 template <typename CTy, typename CTr, typename T, precision P>
207 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x4<T,P> const&);
208 template <typename CTy, typename CTr, typename T, precision P>
209 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x2<T,P> const&);
210 template <typename CTy, typename CTr, typename T, precision P>
211 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x3<T,P> const&);
212 template <typename CTy, typename CTr, typename T, precision P>
213 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x4<T,P> const&);
214
215 template <typename CTy, typename CTr, typename T, precision P>
216 GLM_FUNC_DECL std::basic_ostream<CTy,CTr> & operator<<(
217 std::basic_ostream<CTy,CTr> &,
218 std::pair<tmat4x4<T,P> const,
219 tmat4x4<T,P> const> const &);
220
222 }//namespace glm
223
224 #include "io.inl"
glm
Definition: _noise.hpp:39