MCPcopy Create free account
hub / github.com/PDAL/PDAL / setValue

Method setValue

pdal/util/ProgramArgs.hpp:768–793  ·  view source on GitHub ↗

Set a an argument's value from a string. Throws an arg_error exception if \a s can't be converted to the argument's type. \note Not intended to be called from user code. \param s Value to set. */

Source from the content-addressed store, hash-verified

766 \param s Value to set.
767 */
768 virtual void setValue(const std::string& s)
769 {
770 T var;
771
772 m_rawVal = s;
773 auto status = Utils::fromString(s, var);
774 if (!status)
775 {
776 std::string error(m_error);
777
778 if (error.empty())
779 {
780 if (status.what().size())
781 error = "Invalid value for argument '" + m_longname +
782 "': " + status.what();
783 else
784 error = "Invalid value '" + s + "' for argument '" +
785 m_longname + "'.";
786 }
787 throw arg_val_error(error);
788 }
789 if (!m_set)
790 m_var.clear();
791 m_var.push_back(std::move(var));
792 m_set = true;
793 }
794
795 /**
796 Reset the argument's state.

Callers

nothing calls this directly

Calls 5

fromStringFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45
whatMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected