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 #ifndef OPENMESH_IO_OPTIONS_HH
00028 #define OPENMESH_IO_OPTIONS_HH
00029
00030
00031
00032
00033
00034
00035 #include <OpenMesh/Core/System/config.hh>
00036
00037
00038
00039
00040
00041 namespace OpenMesh {
00042 namespace IO {
00043
00044
00045
00046
00047
00052
00053
00054
00055
00072 class Options
00073 {
00074 public:
00075 typedef int enum_type;
00076 typedef enum_type value_type;
00077
00080 enum Flag {
00081 Default = 0x0000,
00082 Binary = 0x0001,
00083 MSB = 0x0002,
00084 LSB = 0x0004,
00085 Swap = 0x0006,
00086 VertexNormal = 0x0010,
00087 VertexColor = 0x0020,
00088 VertexTexCoord = 0x0040,
00089 FaceNormal = 0x0100,
00090 FaceColor = 0x0200
00091 };
00092
00093
00094 public:
00095
00097 Options() : flags_( Default )
00098 { }
00099
00100
00102 Options(const Options& _opt) : flags_(_opt.flags_)
00103 { }
00104
00105
00107 Options(Flag _flg) : flags_( _flg)
00108 { }
00109
00110
00112 Options(const value_type _flgs) : flags_( _flgs)
00113 { }
00114
00115
00116 ~Options()
00117 { }
00118
00120 void cleanup(void)
00121 { flags_ = Default; }
00122
00124 void clear(void)
00125 { flags_ = 0; }
00126
00128 bool is_empty(void) const { return !flags_; }
00129
00130 public:
00131
00132
00134
00135
00136 Options& operator = ( const Options& _rhs )
00137 { flags_ = _rhs.flags_; return *this; }
00138
00139 Options& operator = ( const value_type _rhs )
00140 { flags_ = _rhs; return *this; }
00141
00143
00144
00146
00147
00148 Options& operator -= ( const value_type _rhs )
00149 { flags_ &= ~_rhs; return *this; }
00150
00151 Options& unset( const value_type _rhs)
00152 { return (*this -= _rhs); }
00153
00155
00156
00157
00159
00160
00161 Options& operator += ( const value_type _rhs )
00162 { flags_ |= _rhs; return *this; }
00163
00164 Options& set( const value_type _rhs)
00165 { return (*this += _rhs); }
00166
00168
00169 public:
00170
00171
00172
00173 bool check(const value_type _rhs) const
00174 {
00175 return (flags_ & _rhs)==_rhs;
00176 }
00177
00178 bool vertex_has_normal() const { return check(VertexNormal); }
00179 bool vertex_has_color() const { return check(VertexColor); }
00180 bool vertex_has_texcoord() const { return check(VertexTexCoord); }
00181 bool face_has_normal() const { return check(FaceNormal); }
00182 bool face_has_color() const { return check(FaceColor); }
00183
00184
00186 bool operator == (const value_type _rhs) const
00187 { return flags_ == _rhs; }
00188
00189
00191 bool operator != (const value_type _rhs) const
00192 { return flags_ != _rhs; }
00193
00194
00196 operator value_type () const { return flags_; }
00197
00198 private:
00199
00200 bool operator && (const value_type _rhs) const;
00201
00202 value_type flags_;
00203 };
00204
00205
00206
00207
00208
00209
00211
00212
00213
00214 }
00215 }
00216
00217 #endif
00218