@@ -12,13 +12,11 @@ namespace crrgenerator {
1212struct Cell {
1313 enum class Type { EMPTY,
1414 STRING,
15- INTEGER,
16- DOUBLE };
15+ INTEGER };
1716
1817 Type type = Type::EMPTY;
1918 std::string string_value;
2019 int64_t int_value = 0 ;
21- double double_value = 0.0 ;
2220
2321 Cell () = default ;
2422 explicit Cell (const std::string& value)
@@ -27,34 +25,21 @@ struct Cell {
2725 explicit Cell (int64_t value)
2826 : type(Type::INTEGER)
2927 , int_value(value) {}
30- explicit Cell (double value)
31- : type(Type::DOUBLE)
32- , double_value(value) {}
3328
3429 bool is_empty () const { return type == Type::EMPTY; }
3530 bool is_string () const { return type == Type::STRING; }
3631 bool is_integer () const { return type == Type::INTEGER; }
37- bool is_double () const { return type == Type::DOUBLE; }
38- bool is_number () const { return is_integer () || is_double (); }
32+ bool is_number () const { return is_integer (); }
3933
4034 int64_t as_int () const {
4135 if (is_integer ()) return int_value;
42- if (is_double ()) return static_cast <int64_t >(double_value);
4336 if (is_string ()) return std::stoll (string_value);
4437 return 0 ;
4538 }
4639
47- double as_double () const {
48- if (is_double ()) return double_value;
49- if (is_integer ()) return static_cast <double >(int_value);
50- if (is_string ()) return std::stod (string_value);
51- return 0.0 ;
52- }
53-
5440 std::string as_string () const {
5541 if (is_string ()) return string_value;
5642 if (is_integer ()) return std::to_string (int_value);
57- if (is_double ()) return std::to_string (double_value);
5843 return " " ;
5944 }
6045};
0 commit comments