00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #pragma once
00044
00045
00046 #include "../glm.hpp"
00047 #include "../gtx/quaternion.hpp"
00048
00049 #if(defined(GLM_MESSAGES) && !defined(glm_ext))
00050 # pragma message("GLM: GLM_GTX_io extension included")
00051 #endif
00052
00053 #include <iosfwd>
00054 #include <locale>
00055 #include <utility>
00056
00057 namespace glm
00058 {
00061
00062 namespace io
00063 {
00064 enum order_type { column_major, row_major};
00065
00066 template <typename CTy>
00067 class format_punct : public std::locale::facet
00068 {
00069 typedef CTy char_type;
00070
00071 public:
00072
00073 static std::locale::id id;
00074
00075 bool formatted;
00076 unsigned precision;
00077 unsigned width;
00078 char_type separator;
00079 char_type delim_left;
00080 char_type delim_right;
00081 char_type space;
00082 char_type newline;
00083 order_type order;
00084
00085 explicit format_punct(size_t a = 0);
00086 explicit format_punct(format_punct const&);
00087 };
00088
00089 template <typename CTy, typename CTr = std::char_traits<CTy> >
00090 class basic_state_saver {
00091
00092 public:
00093
00094 explicit basic_state_saver(std::basic_ios<CTy,CTr>&);
00095 ~basic_state_saver();
00096
00097 private:
00098
00099 typedef ::std::basic_ios<CTy,CTr> state_type;
00100 typedef typename state_type::char_type char_type;
00101 typedef ::std::ios_base::fmtflags flags_type;
00102 typedef ::std::streamsize streamsize_type;
00103 typedef ::std::locale const locale_type;
00104
00105 state_type& state_;
00106 flags_type flags_;
00107 streamsize_type precision_;
00108 streamsize_type width_;
00109 char_type fill_;
00110 locale_type locale_;
00111
00112 basic_state_saver& operator=(basic_state_saver const&);
00113 };
00114
00115 typedef basic_state_saver<char> state_saver;
00116 typedef basic_state_saver<wchar_t> wstate_saver;
00117
00118 template <typename CTy, typename CTr = std::char_traits<CTy> >
00119 class basic_format_saver
00120 {
00121 public:
00122
00123 explicit basic_format_saver(std::basic_ios<CTy,CTr>&);
00124 ~basic_format_saver();
00125
00126 private:
00127
00128 basic_state_saver<CTy> const bss_;
00129
00130 basic_format_saver& operator=(basic_format_saver const&);
00131 };
00132
00133 typedef basic_format_saver<char> format_saver;
00134 typedef basic_format_saver<wchar_t> wformat_saver;
00135
00136 struct precision
00137 {
00138 unsigned value;
00139
00140 explicit precision(unsigned);
00141 };
00142
00143 struct width
00144 {
00145 unsigned value;
00146
00147 explicit width(unsigned);
00148 };
00149
00150 template <typename CTy>
00151 struct delimeter
00152 {
00153 CTy value[3];
00154
00155 explicit delimeter(CTy , CTy , CTy = ',');
00156 };
00157
00158 struct order
00159 {
00160 order_type value;
00161
00162 explicit order(order_type);
00163 };
00164
00165
00166
00167 template <typename FTy, typename CTy, typename CTr>
00168 FTy const& get_facet(std::basic_ios<CTy,CTr>&);
00169 template <typename FTy, typename CTy, typename CTr>
00170 std::basic_ios<CTy,CTr>& formatted(std::basic_ios<CTy,CTr>&);
00171 template <typename FTy, typename CTy, typename CTr>
00172 std::basic_ios<CTy,CTr>& unformattet(std::basic_ios<CTy,CTr>&);
00173
00174 template <typename CTy, typename CTr>
00175 std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, precision const&);
00176 template <typename CTy, typename CTr>
00177 std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, width const&);
00178 template <typename CTy, typename CTr>
00179 std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, delimeter<CTy> const&);
00180 template <typename CTy, typename CTr>
00181 std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, order const&);
00182 }
00183
00184 namespace detail
00185 {
00186 template <typename CTy, typename CTr, typename T, precision P>
00187 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tquat<T,P> const&);
00188 template <typename CTy, typename CTr, typename T, precision P>
00189 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec2<T,P> const&);
00190 template <typename CTy, typename CTr, typename T, precision P>
00191 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec3<T,P> const&);
00192 template <typename CTy, typename CTr, typename T, precision P>
00193 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec4<T,P> const&);
00194 template <typename CTy, typename CTr, typename T, precision P>
00195 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x2<T,P> const&);
00196 template <typename CTy, typename CTr, typename T, precision P>
00197 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x3<T,P> const&);
00198 template <typename CTy, typename CTr, typename T, precision P>
00199 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x4<T,P> const&);
00200 template <typename CTy, typename CTr, typename T, precision P>
00201 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x2<T,P> const&);
00202 template <typename CTy, typename CTr, typename T, precision P>
00203 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x3<T,P> const&);
00204 template <typename CTy, typename CTr, typename T, precision P>
00205 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x4<T,P> const&);
00206 template <typename CTy, typename CTr, typename T, precision P>
00207 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x2<T,P> const&);
00208 template <typename CTy, typename CTr, typename T, precision P>
00209 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x3<T,P> const&);
00210 template <typename CTy, typename CTr, typename T, precision P>
00211 GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x4<T,P> const&);
00212
00213 template <typename CTy, typename CTr, typename T, precision P>
00214 GLM_FUNC_DECL std::basic_ostream<CTy,CTr> & operator<<(
00215 std::basic_ostream<CTy,CTr> &,
00216 std::pair<tmat4x4<T,P> const,
00217 tmat4x4<T,P> const> const &);
00218 }
00219
00221 }
00222
00223 #include "io.inl"