Value parseValue(protozero::pbf_reader data) { while (data.next()) { switch (data.tag()) { case 1: // string_value return data.get_string(); case 2: // float_value return static_cast<double>(data.get_float()); case 3: // double_value return data.get_double(); case 4: // int_value return data.get_int64(); case 5: // uint_value return data.get_uint64(); case 6: // sint_value return data.get_sint64(); case 7: // bool_value return data.get_bool(); default: data.skip(); break; } } return false; }
void validate_value(protozero::pbf_reader value) { using namespace osrm; while (value.next()) { switch (value.tag()) { case util::vector_tile::VARIANT_TYPE_BOOL: value.get_bool(); break; case util::vector_tile::VARIANT_TYPE_DOUBLE: value.get_double(); break; case util::vector_tile::VARIANT_TYPE_FLOAT: value.get_float(); break; case util::vector_tile::VARIANT_TYPE_STRING: value.get_string(); break; case util::vector_tile::VARIANT_TYPE_UINT64: value.get_uint64(); break; case util::vector_tile::VARIANT_TYPE_SINT64: value.get_sint64(); break; } } }
VectorTileFeature::VectorTileFeature(protozero::pbf_reader feature_pbf, const VectorTileLayer& layer_) : layer(layer_) { while (feature_pbf.next()) { switch (feature_pbf.tag()) { case 1: // id id = { feature_pbf.get_uint64() }; break; case 2: // tags tags_iter = feature_pbf.get_packed_uint32(); break; case 3: // type type = static_cast<FeatureType>(feature_pbf.get_enum()); break; case 4: // geometry geometry_iter = feature_pbf.get_packed_uint32(); break; default: feature_pbf.skip(); break; } } }