Make sure we don't have any required positional args after non-required positional args. */
| 1662 | non-required positional args. |
| 1663 | */ |
| 1664 | void validate() |
| 1665 | { |
| 1666 | bool opt = false; |
| 1667 | for (auto ai = m_args.begin(); ai != m_args.end(); ++ai) |
| 1668 | { |
| 1669 | Arg *arg = ai->get(); |
| 1670 | if (arg->positional() == Arg::PosType::Optional) |
| 1671 | opt = true; |
| 1672 | if (opt && (arg->positional() == Arg::PosType::Required)) |
| 1673 | throw arg_error("Found required positional argument '" + |
| 1674 | arg->longname() + "' after optional positional argument."); |
| 1675 | } |
| 1676 | } |
| 1677 | |
| 1678 | std::vector<std::unique_ptr<Arg>> m_args; /// Storage for arguments |
| 1679 | std::map<std::string, Arg *> m_shortargs; /// Map from shortname to args |
nothing calls this directly
no test coverage detected