Commit ab31f951 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

add configure_string helper method

parent 698afd45
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -190,5 +190,19 @@ ReturnCode configure_float_opt(
  return OK;
}

ReturnCode configure_string(
    const plist::Property& prop,
    std::string* value) {
  if (!plist::is_value(prop)) {
    return ReturnCode::errorf(
        "EARG",
        "incorrect number of arguments; expected: 1, got: $0",
        prop.size());
  }

  *value = prop;
  return OK;
}

} // namespace plotfx
+4 −0
Original line number Diff line number Diff line
@@ -103,6 +103,10 @@ ReturnCode configure_float(
    const plist::Property& prop,
    double* value);

ReturnCode configure_string(
    const plist::Property& prop,
    std::string* value);

ReturnCode configure_float_opt(
    const plist::Property& prop,
    std::optional<double>* value);