0.9.9 API documenation
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 #ifndef GLM_ENABLE_EXPERIMENTAL
27 # error "GLM: GLM_GTX_io is an experimetal extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."
28 #endif
29 
30 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
31 # pragma message("GLM: GLM_GTX_io extension included")
32 #endif
33 
34 #include <iosfwd> // std::basic_ostream<> (fwd)
35 #include <locale> // std::locale, std::locale::facet, std::locale::id
36 #include <utility> // std::pair<>
37 
38 namespace glm
39 {
42 
43  namespace io
44  {
45  enum order_type { column_major, row_major};
46 
47  template <typename CTy>
48  class format_punct : public std::locale::facet
49  {
50  typedef CTy char_type;
51 
52  public:
53 
54  static std::locale::id id;
55 
56  bool formatted;
57  unsigned precision;
58  unsigned width;
59  char_type separator;
60  char_type delim_left;
61  char_type delim_right;
62  char_type space;
63  char_type newline;
64  order_type order;
65 
66  GLM_FUNC_DECL explicit format_punct(size_t a = 0);
67  GLM_FUNC_DECL explicit format_punct(format_punct const&);
68  };
69 
70  template <typename CTy, typename CTr = std::char_traits<CTy> >
71  class basic_state_saver {
72 
73  public:
74 
75  GLM_FUNC_DECL explicit basic_state_saver(std::basic_ios<CTy,CTr>&);
76  GLM_FUNC_DECL ~basic_state_saver();
77 
78  private:
79 
80  typedef ::std::basic_ios<CTy,CTr> state_type;
81  typedef typename state_type::char_type char_type;
82  typedef ::std::ios_base::fmtflags flags_type;
83  typedef ::std::streamsize streamsize_type;
84  typedef ::std::locale const locale_type;
85 
86  state_type& state_;
87  flags_type flags_;
88  streamsize_type precision_;
89  streamsize_type width_;
90  char_type fill_;
91  locale_type locale_;
92 
93  GLM_FUNC_DECL basic_state_saver& operator=(basic_state_saver const&);
94  };
95 
96  typedef basic_state_saver<char> state_saver;
97  typedef basic_state_saver<wchar_t> wstate_saver;
98 
99  template <typename CTy, typename CTr = std::char_traits<CTy> >
100  class basic_format_saver
101  {
102  public:
103 
104  GLM_FUNC_DECL explicit basic_format_saver(std::basic_ios<CTy,CTr>&);
105  GLM_FUNC_DECL ~basic_format_saver();
106 
107  private:
108 
109  basic_state_saver<CTy> const bss_;
110 
111  GLM_FUNC_DECL basic_format_saver& operator=(basic_format_saver const&);
112  };
113 
114  typedef basic_format_saver<char> format_saver;
115  typedef basic_format_saver<wchar_t> wformat_saver;
116 
117  struct precision
118  {
119  unsigned value;
120 
121  GLM_FUNC_DECL explicit precision(unsigned);
122  };
123 
124  struct width
125  {
126  unsigned value;
127 
128  GLM_FUNC_DECL explicit width(unsigned);
129  };
130 
131  template <typename CTy>
132  struct delimeter
133  {
134  CTy value[3];
135 
136  GLM_FUNC_DECL explicit delimeter(CTy /* left */, CTy /* right */, CTy /* separator */ = ',');
137  };
138 
139  struct order
140  {
141  order_type value;
142 
143  GLM_FUNC_DECL explicit order(order_type);
144  };
145 
146  // functions, inlined (inline)
147 
148  template <typename FTy, typename CTy, typename CTr>
149  FTy const& get_facet(std::basic_ios<CTy,CTr>&);
150  template <typename FTy, typename CTy, typename CTr>
151  std::basic_ios<CTy,CTr>& formatted(std::basic_ios<CTy,CTr>&);
152  template <typename FTy, typename CTy, typename CTr>
153  std::basic_ios<CTy,CTr>& unformattet(std::basic_ios<CTy,CTr>&);
154 
155  template <typename CTy, typename CTr>
156  std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, precision const&);
157  template <typename CTy, typename CTr>
158  std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, width const&);
159  template <typename CTy, typename CTr>
160  std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, delimeter<CTy> const&);
161  template <typename CTy, typename CTr>
162  std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, order const&);
163  }//namespace io
164 
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>&, tquat<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>&, tvec1<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>&, tvec2<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>&, tvec3<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>&, tvec4<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>&, tmat2x2<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>&, tmat2x3<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>&, tmat2x4<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>&, tmat3x2<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>&, tmat3x3<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>&, tmat3x4<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>&, tmat4x2<T,P> const&);
189  template <typename CTy, typename CTr, typename T, precision P>
190  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x3<T,P> const&);
191  template <typename CTy, typename CTr, typename T, precision P>
192  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x4<T,P> const&);
193 
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> &,
196  std::pair<tmat4x4<T,P> const, tmat4x4<T,P> const> const &);
197 
199 }//namespace glm
200 
201 #include "io.inl"
Definition: _noise.hpp:11