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
FieldType.hpp
1 // Copyright 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_DATA_FIELDTYPE_HPP_INCLUDED
5 #define FIRE_DATA_FIELDTYPE_HPP_INCLUDED
6 
7 #include <string>
8 #include <sstream>
9 #include <exception>
10 
11 namespace fire {
12 namespace source {
13 namespace vector {
14 namespace FieldType {
15 
19 enum FieldType {
20  UNKNOWN = -1,
21  BLOB = 1,
22  DATETIME,
23  DOUBLE,
24  GEOMETRY,
25  INTEGER,
26  TEXT,
27  BOOLEAN
28 };
29 
35 inline std::string toString(const FieldType& t) {
36  std::stringstream ss;
37  ss << "fire::source::vector::FieldType";
38  switch (t) {
39  case BLOB:
40  ss << "::BLOB";
41  break;
42  case BOOLEAN:
43  ss << "::BOOLEAN";
44  break;
45  case DATETIME:
46  ss << "::DATETIME";
47  break;
48  case DOUBLE:
49  ss << "::DOUBLE";
50  break;
51  case GEOMETRY:
52  ss << "::GEOMETRY";
53  break;
54  case INTEGER:
55  ss << "::INTEGER";
56  break;
57  case TEXT:
58  ss << "::TEXT";
59  break;
60  case UNKNOWN:
61  default:
62  ss << "::UNKNOWN";
63  break;
64  }
65 
66  return ss.str();
67 }
68 
74 inline FieldType fromString(const std::string& val) {
75  FieldType list[] = {
76  UNKNOWN,
77  BLOB,
78  BOOLEAN,
79  DATETIME,
80  DOUBLE,
81  GEOMETRY,
82  INTEGER,
83  TEXT
84  };
85 
86  int len = sizeof(list)/sizeof(FieldType);
87  for (int i = 0; i < len; i++) {
88  FieldType item = list[i];
89  if (toString(item) == val)
90  return item;
91  }
92 
93  return UNKNOWN;
94 }
95 
96 } // namespace FieldType
97 } // namespace vector
98 } // namespace source
99 } // namespace fire
100 
101 #endif
BooleanOperator fromString(const std::string &string)
Restituisce il valore di un operatore booleano data una stringa che rappresenta il valore dell'operat...
Definition: BooleanOperator.hpp:88
std::string toString(const BooleanOperator &booleanOperator)
Restituisce la stringa che rappresenta il valore di un operatore booleano dato il valore di un operat...
Definition: BooleanOperator.hpp:40