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