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