GLM  0.9.5
io.hpp
Go to the documentation of this file.
1 
39 #ifndef GLM_GTX_io
40 #define GLM_GTX_io
41 
42 // Dependency:
43 #include "../detail/setup.hpp"
44 #include "../gtc/quaternion.hpp"
45 
46 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
47 # pragma message("GLM: GLM_GTX_io extension included")
48 #endif
49 
50 #include <iosfwd> // std::basic_ostream<> (fwd)
51 #include <utility> // std::pair<>
52 
53 namespace glm
54 {
57 
58  namespace io
59  {
60 
61  class precision_guard {
62 
63  public:
64 
65  GLM_FUNC_DECL explicit precision_guard();
66  GLM_FUNC_DECL ~precision_guard();
67 
68  private:
69 
70  unsigned precision_;
71  unsigned value_width_;
72 
73  };
74 
75  class format_guard
76  {
77  public:
78  enum order_t { column_major, row_major, };
79 
80  GLM_FUNC_DECL explicit format_guard();
81  GLM_FUNC_DECL ~format_guard();
82 
83  private:
84 
85  order_t order_;
86  char cr_;
87  };
88 
89  // decimal places (dflt: 3)
90  GLM_FUNC_DECL unsigned& precision();
91 
92  // sign + value + '.' + decimals (dflt: 1 + 4 + 1 + precision())
93  GLM_FUNC_DECL unsigned& value_width();
94 
95  // matrix output order (dflt: row_major)
96  GLM_FUNC_DECL format_guard::order_t& order();
97 
98  // carriage/return char (dflt: '\n')
99  GLM_FUNC_DECL char& cr();
100 
101  // matrix output order -> column_major
102  GLM_FUNC_DECL std::ios_base& column_major(std::ios_base&);
103 
104  // matrix output order -> row_major
105  GLM_FUNC_DECL std::ios_base& row_major (std::ios_base&);
106 
107  // carriage/return char -> '\n'
108  GLM_FUNC_DECL std::ios_base& formatted (std::ios_base&);
109 
110  // carriage/return char -> ' '
111  GLM_FUNC_DECL std::ios_base& unformatted (std::ios_base&);
112 
113  }//namespace io
114 
115  namespace detail
116  {
117  template <typename CTy, typename CTr, typename T, precision P>
118  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tquat<T,P> const&);
119  template <typename CTy, typename CTr, typename T, precision P>
120  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec2<T,P> const&);
121  template <typename CTy, typename CTr, typename T, precision P>
122  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec3<T,P> const&);
123  template <typename CTy, typename CTr, typename T, precision P>
124  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec4<T,P> const&);
125  template <typename CTy, typename CTr, typename T, precision P>
126  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x2<T,P> const&);
127  template <typename CTy, typename CTr, typename T, precision P>
128  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x3<T,P> const&);
129  template <typename CTy, typename CTr, typename T, precision P>
130  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x4<T,P> const&);
131  template <typename CTy, typename CTr, typename T, precision P>
132  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x2<T,P> const&);
133  template <typename CTy, typename CTr, typename T, precision P>
134  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x3<T,P> const&);
135  template <typename CTy, typename CTr, typename T, precision P>
136  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x4<T,P> const&);
137  template <typename CTy, typename CTr, typename T, precision P>
138  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x2<T,P> const&);
139  template <typename CTy, typename CTr, typename T, precision P>
140  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x3<T,P> const&);
141  template <typename CTy, typename CTr, typename T, precision P>
142  GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x4<T,P> const&);
143 
145 }//namespace detail
146 }//namespace glm
147 
148 #include "io.inl"
149 
150 #endif//GLM_GTX_io