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

Method assignPositional

pdal/util/ProgramArgs.hpp:671–698  ·  view source on GitHub ↗

Set the argument's value from the command-line args. List-based arguments consume ALL positional arguments until one is found that can't be converted to the type of the bound variable. \note Not intended to be called from user code. \param vals The list of command-line args. */

Source from the content-addressed store, hash-verified

669 \param vals The list of command-line args.
670 */
671 virtual void assignPositional(ArgValList& vals)
672 {
673 if (m_positional == PosType::None || m_set)
674 return;
675
676 int cnt = 0;
677 for (size_t i = vals.firstUnconsumed(); i < vals.size(); ++i)
678 {
679 const std::string& val = vals[i];
680 if ((val.size() && val[0] == '-') || vals.consumed(i))
681 continue;
682 try
683 {
684 setValue(val);
685 vals.consume(i);
686 cnt++;
687 }
688 catch (arg_error&)
689 {
690 break;
691 }
692 }
693 if (cnt == 0 && m_positional == PosType::Required)
694 {
695 throw arg_error("Missing value for positional argument '" +
696 m_longname + "'.");
697 }
698 }
699
700 /**
701 Return whether a default value was provided for the argument.

Callers

nothing calls this directly

Calls 5

setValueFunction · 0.85
firstUnconsumedMethod · 0.80
consumedMethod · 0.80
consumeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected