| 915 | */ |
| 916 | template <class T = uint32_t> |
| 917 | static inline std::optional<T> ParseInteger(std::string_view arg, int base = 10, bool clamp = false) |
| 918 | { |
| 919 | StringConsumer consumer{arg}; |
| 920 | consumer.SkipUntilCharNotIn(StringConsumer::WHITESPACE_NO_NEWLINE); |
| 921 | auto result = consumer.TryReadIntegerBase<T>(base, clamp); |
| 922 | consumer.SkipUntilCharNotIn(StringConsumer::WHITESPACE_NO_NEWLINE); |
| 923 | if (consumer.AnyBytesLeft()) return std::nullopt; |
| 924 | return result; |
| 925 | } |
| 926 | |
| 927 | #endif /* STRING_CONSUMER_HPP */ |
no test coverage detected