Browse Source

require all strings to be set

master
Jørgen Sverre Lien Sellæg 5 years ago
parent
commit
658bad5f2e
  1. 17
      src/data.cpp

17
src/data.cpp

@ -50,4 +50,19 @@ json data::process(const json &input) {
return input; return input;
} }
bool data::validate(const json &input) {} bool data::validate(const json &input) {
const std::string name = input.value("name", "");
const std::string address = input.value("address", "");
const std::string phone = input.value("phone", "");
const std::string email = input.value("email", "");
const std::vector<std::string> strings{name, address, phone, email};
for (const auto &f : strings) {
if (f.size() == 0) {
return false;
}
}
return true;
}
Loading…
Cancel
Save