diff options
author | artemp <artem@mapnik.org> | 2014-02-10 12:18:52 +0000 |
---|---|---|
committer | artemp <artem@mapnik.org> | 2014-02-10 12:18:52 +0000 |
commit | 5e87cfed5aa060768185d7a2800b4c746a6ffa49 (patch) | |
tree | c05be25df7a35025afe9446e25975ab4956d35b9 /src/style | |
parent | e8bd180f0049e126d784dc2a359a025d0a94e4ca (diff) | |
download | qtlocation-mapboxgl-5e87cfed5aa060768185d7a2800b4c746a6ffa49.tar.gz |
c++ - prefer switch over long-ish if/else (be nice to compiler)
Diffstat (limited to 'src/style')
-rw-r--r-- | src/style/value.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/style/value.cpp b/src/style/value.cpp index 8da66966fc..99086f3774 100644 --- a/src/style/value.cpp +++ b/src/style/value.cpp @@ -1,25 +1,28 @@ #include <llmr/style/value.hpp> llmr::Value llmr::parseValue(pbf data) { - while (data.next()) { - if (data.tag == 1) { // string_value + while (data.next()) + { + switch (data.tag) + { + case 1: // string_value return data.string(); - } else if (data.tag == 2) { // float_value + case 2: // float_value return data.float32(); - } else if (data.tag == 3) { // double_value + case 3: // double_value return data.float64(); - } else if (data.tag == 4) { // int_value + case 4: // int_value return data.varint<int64_t>(); - } else if (data.tag == 5) { // uint_value + case 5: // uint_value return data.varint<uint64_t>(); - } else if (data.tag == 6) { // sint_value + case 6: // sint_value return data.svarint<int64_t>(); - } else if (data.tag == 7) { // bool_value + case 7: // bool_value return data.boolean(); - } else { + default: data.skip(); + break; } } - return false; } |