OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
variantimp.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_ESM_VARIANTIMP_H
2 #define OPENMW_ESM_VARIANTIMP_H
3 
4 #include <string>
5 
6 #include "variant.hpp"
7 
8 namespace ESM
9 {
11  {
12  public:
13 
14  virtual ~VariantDataBase();
15 
16  virtual VariantDataBase *clone() const = 0;
17 
18  virtual std::string getString (bool default_ = false) const;
26 
27  virtual int getInteger (bool default_ = false) const;
34 
35  virtual float getFloat (bool default_ = false) const;
41 
42  virtual void setString (const std::string& value);
46 
47  virtual void setInteger (int value);
51 
52  virtual void setFloat (float value);
56 
57  virtual void read (ESMReader& esm, Variant::Format format, VarType type) = 0;
59 
60  virtual void write (ESMWriter& esm, Variant::Format format, VarType type) const = 0;
62 
63  virtual bool isEqual (const VariantDataBase& value) const = 0;
65 
66  };
67 
69  {
70  std::string mValue;
71 
72  public:
73 
74  VariantStringData (const VariantDataBase *data = 0);
77 
78  virtual VariantDataBase *clone() const;
79 
80  virtual std::string getString (bool default_ = false) const;
86 
87  virtual void setString (const std::string& value);
89 
90  virtual void read (ESMReader& esm, Variant::Format format, VarType type);
92 
93  virtual void write (ESMWriter& esm, Variant::Format format, VarType type) const;
95 
96  virtual bool isEqual (const VariantDataBase& value) const;
98  };
99 
101  {
102  int mValue;
103 
104  public:
105 
106  VariantIntegerData (const VariantDataBase *data = 0);
109 
110  virtual VariantDataBase *clone() const;
111 
112  virtual int getInteger (bool default_ = false) const;
117 
118  virtual float getFloat (bool default_ = false) const;
122 
123  virtual void setInteger (int value);
125 
126  virtual void setFloat (float value);
128 
129  virtual void read (ESMReader& esm, Variant::Format format, VarType type);
131 
132  virtual void write (ESMWriter& esm, Variant::Format format, VarType type) const;
134 
135  virtual bool isEqual (const VariantDataBase& value) const;
137  };
138 
140  {
141  float mValue;
142 
143  public:
144 
145  VariantFloatData (const VariantDataBase *data = 0);
148 
149  virtual VariantDataBase *clone() const;
150 
151  virtual int getInteger (bool default_ = false) const;
156 
157  virtual float getFloat (bool default_ = false) const;
161 
162  virtual void setInteger (int value);
164 
165  virtual void setFloat (float value);
167 
168  virtual void read (ESMReader& esm, Variant::Format format, VarType type);
170 
171  virtual void write (ESMWriter& esm, Variant::Format format, VarType type) const;
173 
174  virtual bool isEqual (const VariantDataBase& value) const;
176  };
177 }
178 
179 #endif
virtual void write(ESMWriter &esm, Variant::Format format, VarType type) const
If type is not supported by format, an exception is thrown.
Definition: variantimp.cpp:90
VarType
Definition: variant.hpp:12
virtual VariantDataBase * clone() const
Definition: variantimp.cpp:57
virtual void setFloat(float value)
Will throw an exception, if type is not compatible with float.
Definition: variantimp.cpp:138
VariantFloatData(const VariantDataBase *data=0)
Definition: variantimp.cpp:241
Definition: esmreader.hpp:21
virtual float getFloat(bool default_=false) const
Definition: variantimp.cpp:26
virtual void setString(const std::string &value)
Definition: variantimp.cpp:34
virtual void write(ESMWriter &esm, Variant::Format format, VarType type) const =0
If type is not supported by format, an exception is thrown.
virtual void read(ESMReader &esm, Variant::Format format, VarType type)=0
If type is not supported by format, an exception is thrown via ESMReader::fail.
Format
Definition: variant.hpp:32
VariantStringData(const VariantDataBase *data=0)
Definition: variantimp.cpp:51
virtual bool isEqual(const VariantDataBase &value) const
If the (C++) type of value does not match the type of *this, an exception is thrown.
Definition: variantimp.cpp:105
Definition: variantimp.hpp:68
virtual bool isEqual(const VariantDataBase &value) const
If the (C++) type of value does not match the type of *this, an exception is thrown.
Definition: variantimp.cpp:235
float mValue
Definition: variantimp.hpp:141
virtual void setInteger(int value)
Definition: variantimp.cpp:39
Definition: esmwriter.hpp:17
Definition: variantimp.hpp:10
VariantIntegerData(const VariantDataBase *data=0)
Definition: variantimp.cpp:112
virtual int getInteger(bool default_=false) const
Definition: variantimp.cpp:123
virtual std::string getString(bool default_=false) const
Definition: variantimp.cpp:10
std::string mValue
Definition: variantimp.hpp:70
virtual bool isEqual(const VariantDataBase &value) const =0
If the (C++) type of value does not match the type of *this, an exception is thrown.
Definition: variantimp.hpp:100
virtual void setInteger(int value)
Will throw an exception, if type is not compatible with integer.
Definition: variantimp.cpp:133
virtual void setInteger(int value)
Will throw an exception, if type is not compatible with integer.
Definition: variantimp.cpp:262
virtual ~VariantDataBase()
Definition: variantimp.cpp:8
virtual void write(ESMWriter &esm, Variant::Format format, VarType type) const
If type is not supported by format, an exception is thrown.
Definition: variantimp.cpp:195
virtual bool isEqual(const VariantDataBase &value) const
If the (C++) type of value does not match the type of *this, an exception is thrown.
Definition: variantimp.cpp:303
virtual void setString(const std::string &value)
Will throw an exception, if type is not compatible with string.
Definition: variantimp.cpp:67
virtual float getFloat(bool default_=false) const
Definition: variantimp.cpp:257
virtual VariantDataBase * clone() const =0
virtual VariantDataBase * clone() const
Definition: variantimp.cpp:118
virtual void read(ESMReader &esm, Variant::Format format, VarType type)
If type is not supported by format, an exception is thrown via ESMReader::fail.
Definition: variantimp.cpp:143
virtual void write(ESMWriter &esm, Variant::Format format, VarType type) const
If type is not supported by format, an exception is thrown.
Definition: variantimp.cpp:287
virtual void read(ESMReader &esm, Variant::Format format, VarType type)
If type is not supported by format, an exception is thrown via ESMReader::fail.
Definition: variantimp.cpp:72
virtual void read(ESMReader &esm, Variant::Format format, VarType type)
If type is not supported by format, an exception is thrown via ESMReader::fail.
Definition: variantimp.cpp:272
virtual float getFloat(bool default_=false) const
Definition: variantimp.cpp:128
int mValue
Definition: variantimp.hpp:102
Definition: variantimp.hpp:139
virtual VariantDataBase * clone() const
Definition: variantimp.cpp:247
virtual void setFloat(float value)
Definition: variantimp.cpp:44
virtual void setFloat(float value)
Will throw an exception, if type is not compatible with float.
Definition: variantimp.cpp:267
virtual int getInteger(bool default_=false) const
Definition: variantimp.cpp:252
virtual int getInteger(bool default_=false) const
Definition: variantimp.cpp:18
virtual std::string getString(bool default_=false) const
Definition: variantimp.cpp:62