mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-03 08:55:41 +02:00
Make the string_value of mvt_value std::optional
This commit is contained in:
@@ -329,7 +329,7 @@ std::string mvt_tile::encode() {
|
||||
|
||||
switch (pbv.type) {
|
||||
case mvt_string:
|
||||
value_writer.add_string(1, pbv.string_value);
|
||||
value_writer.add_string(1, *(pbv.string_value));
|
||||
break;
|
||||
case mvt_float:
|
||||
value_writer.add_float(2, pbv.numeric_value.float_value);
|
||||
@@ -458,7 +458,7 @@ bool mvt_value::operator<(const mvt_value &o) const {
|
||||
if (type == o.type) {
|
||||
switch (type) {
|
||||
case mvt_string:
|
||||
return string_value < o.string_value;
|
||||
return *string_value < *(o.string_value);
|
||||
|
||||
case mvt_float:
|
||||
return numeric_value.float_value < o.numeric_value.float_value;
|
||||
@@ -494,7 +494,7 @@ bool mvt_value::operator==(const mvt_value &o) const {
|
||||
if (type == o.type) {
|
||||
switch (type) {
|
||||
case mvt_string:
|
||||
return string_value == o.string_value;
|
||||
return *string_value == *(o.string_value);
|
||||
|
||||
case mvt_float:
|
||||
return numeric_value.float_value == o.numeric_value.float_value;
|
||||
@@ -550,7 +550,7 @@ static std::string quote(std::string const &s) {
|
||||
std::string mvt_value::toString() const {
|
||||
switch (type) {
|
||||
case mvt_string:
|
||||
return quote(string_value);
|
||||
return quote(*string_value);
|
||||
case mvt_int:
|
||||
return std::to_string(numeric_value.int_value);
|
||||
case mvt_double: {
|
||||
@@ -767,7 +767,7 @@ serial_val mvt_value_to_serial_val(mvt_value const &v) {
|
||||
switch (v.type) {
|
||||
case mvt_string:
|
||||
sv.type = mvt_string;
|
||||
sv.s = v.string_value;
|
||||
sv.s = *(v.string_value);
|
||||
break;
|
||||
case mvt_float:
|
||||
sv.type = mvt_double;
|
||||
@@ -809,7 +809,7 @@ serial_val mvt_value_to_serial_val(mvt_value const &v) {
|
||||
long long mvt_value_to_long_long(mvt_value const &v) {
|
||||
switch (v.type) {
|
||||
case mvt_string:
|
||||
return atoll(v.string_value.c_str());
|
||||
return atoll(v.string_value->c_str());
|
||||
case mvt_float:
|
||||
return v.numeric_value.float_value;
|
||||
case mvt_double:
|
||||
|
||||
Reference in New Issue
Block a user