Fire Core  8.0.0.alpha
GIS framework per tutti gli usi
 Tutto Classi Namespace Funzioni Variabili Ridefinizioni di tipo (typedef) Tipi enumerati (enum) Valori del tipo enumerato Friend
Field.hpp
1 // Copyright 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_DATA_FIELD_HPP_INCLUDED
5 #define FIRE_DATA_FIELD_HPP_INCLUDED
6 
7 #include <QtCore/QString>
8 #include <QtCore/QVariant>
9 #include <boost/shared_ptr.hpp>
10 #include <boost/thread/mutex.hpp>
11 #include <fire/gear/threading/types.hpp>
12 
13 #include <map>
14 #include <string>
15 
16 #include "fire/gis/export.hpp"
17 #include "fire/source/vector/FieldType.hpp"
18 
19 namespace fire {
20 namespace source {
21 namespace vector {
22 
23 namespace shared {
24 class FieldSh;
25 } // namespace shared
26 
30 class FIRE_GIS_DLL Field {
31  public:
36  SRID = 1,
37  GEOMTYPE = 2,
38  DIMENSION = 3,
39  PRECISION = 4,
40  SCALE = 5,
41  LENGTH = 6
42  };
43 
44  typedef shared::FieldSh FieldShp;
45  typedef std::map< ExtraParamFieldType, int > MapExtraParam;
46 
47  static std::string qString2stdString(QString const & qs);
48  static QString stdString2qString(std::string const & str);
49  static FieldType::FieldType qType2fType(QVariant::Type const & t);
50  static QVariant::Type fType2qType(FieldType::FieldType const & t);
51 
52  friend class shared::FieldSh;
53 
57  ~Field();
58 
63  Field(Field const & rhs);
64 
65  protected:
74  Field(std::string const & name,
75  const FieldType::FieldType &type,
76  bool const & nullable,
77  bool const & iskeypart,
78  int const & nativeType);
79 
85  bool operator!=(Field const & r) const;
86 
92  bool operator==(Field const & r) const;
93 
99  bool isEqualsStricted(Field const & r) const;
100 
105  std::string getName() const;
106 
111  FieldType::FieldType getType() const;
112 
117  int getNativeType() const;
118 
123  bool isNullable() const;
124 
129  bool isKeyPart() const;
130 
135  void setName(std::string const & name);
136 
141  void setType(FieldType::FieldType const & ft);
142 
147  void setNullable(bool const & nullable);
148 
153  void setKeyPart(bool const & keypart);
154 
160  void addExtraParam(const ExtraParamFieldType id, const int& val);
161 
169  const int getExtraParam(const ExtraParamFieldType id) const;
170 
176  bool existsExtraParam(const ExtraParamFieldType id) const;
177 
178  private:
179  Field& operator=(Field const & rhs);
180 
181  std::string _name;
182  FieldType::FieldType _type;
183  int _nativeType;
184  bool _isNullable;
185  bool _isKeyPart;
186  std::string _default;
187  MapExtraParam _extraParam;
188 
189  mutable boost::mutex _mtx;
190 };
191 
192 } // namespace vector
193 } // namespace source
194 } // namespace fire
195 
196 #endif
Definition: Field.hpp:30
Definition: FieldSh.hpp:21
ExtraParamFieldType
Chiavi dei parametri descrittivi extra impostabili sul Field.
Definition: Field.hpp:35