MCPcopy Create free account
hub / github.com/apple/foundationdb / validateOption

Function validateOption

fdbclient/MultiVersionTransaction.actor.cpp:2245–2254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2243namespace {
2244
2245void validateOption(Optional<StringRef> value, bool canBePresent, bool canBeAbsent, bool canBeEmpty = true) {
2246 ASSERT(canBePresent || canBeAbsent);
2247
2248 if (!canBePresent && value.present() && (!canBeEmpty || value.get().size() > 0)) {
2249 throw invalid_option_value();
2250 }
2251 if (!canBeAbsent && (!value.present() || (!canBeEmpty && value.get().size() == 0))) {
2252 throw invalid_option_value();
2253 }
2254}
2255
2256} // namespace
2257

Callers 1

Calls 3

getMethod · 0.65
presentMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected