| 165 | } |
| 166 | |
| 167 | static bool parseBoolean(const std::string& value) |
| 168 | { |
| 169 | static const std::map<std::string, bool> boolvalues = { |
| 170 | {"false", false}, |
| 171 | {"f", false}, |
| 172 | {"no", false}, |
| 173 | {"n", false}, |
| 174 | {"0", false}, |
| 175 | {"true", true }, |
| 176 | {"t", true }, |
| 177 | {"yes", true }, |
| 178 | {"y", true }, |
| 179 | {"1", true }, |
| 180 | }; |
| 181 | |
| 182 | const auto& it = boolvalues.find(value); |
| 183 | if (it == boolvalues.end()) |
| 184 | error("invalid boolean value"); |
| 185 | return it->second; |
| 186 | } |
| 187 | |
| 188 | static int32_t parseEnum( |
| 189 | const google::protobuf::FieldDescriptor* field, const std::string& value) |