Commit 20c304fa0166e67d7cdce1e7cd93030a2b272ac1
1 parent
9d6830e8
Adding more documentation to fix some warnings
Showing
5 changed files
with
16 additions
and
5 deletions
docs/Doxyfile
| @@ -334,7 +334,7 @@ BUILTIN_STL_SUPPORT = NO | @@ -334,7 +334,7 @@ BUILTIN_STL_SUPPORT = NO | ||
| 334 | # enable parsing support. | 334 | # enable parsing support. |
| 335 | # The default value is: NO. | 335 | # The default value is: NO. |
| 336 | 336 | ||
| 337 | -CPP_CLI11_SUPPORT = NO | 337 | +CPP_CLI_SUPPORT = NO |
| 338 | 338 | ||
| 339 | # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: | 339 | # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: |
| 340 | # http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen | 340 | # http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen |
include/CLI/FormatterFwd.hpp
| @@ -86,9 +86,11 @@ class FormatterBase { | @@ -86,9 +86,11 @@ class FormatterBase { | ||
| 86 | class FormatterLambda final : public FormatterBase { | 86 | class FormatterLambda final : public FormatterBase { |
| 87 | using funct_t = std::function<std::string(const App *, std::string, AppFormatMode)>; | 87 | using funct_t = std::function<std::string(const App *, std::string, AppFormatMode)>; |
| 88 | 88 | ||
| 89 | + /// The lambda to hold and run | ||
| 89 | funct_t lambda_; | 90 | funct_t lambda_; |
| 90 | 91 | ||
| 91 | public: | 92 | public: |
| 93 | + /// Create a FormatterLambda with a lambda function | ||
| 92 | explicit FormatterLambda(funct_t funct) : lambda_(std::move(funct)) {} | 94 | explicit FormatterLambda(funct_t funct) : lambda_(std::move(funct)) {} |
| 93 | 95 | ||
| 94 | /// This will simply call the lambda function | 96 | /// This will simply call the lambda function |
include/CLI/Option.hpp
| @@ -51,6 +51,7 @@ template <typename CRTP> class OptionBase { | @@ -51,6 +51,7 @@ template <typename CRTP> class OptionBase { | ||
| 51 | /// Policy for multiple arguments when `expected_ == 1` (can be set on bool flags, too) | 51 | /// Policy for multiple arguments when `expected_ == 1` (can be set on bool flags, too) |
| 52 | MultiOptionPolicy multi_option_policy_{MultiOptionPolicy::Throw}; | 52 | MultiOptionPolicy multi_option_policy_{MultiOptionPolicy::Throw}; |
| 53 | 53 | ||
| 54 | + /// Copy the contents to another similar class (one based on OptionBase) | ||
| 54 | template <typename T> void copy_to(T *other) const { | 55 | template <typename T> void copy_to(T *other) const { |
| 55 | other->group(group_); | 56 | other->group(group_); |
| 56 | other->required(required_); | 57 | other->required(required_); |
| @@ -440,7 +441,7 @@ class Option : public OptionBase<Option> { | @@ -440,7 +441,7 @@ class Option : public OptionBase<Option> { | ||
| 440 | /// The number of times the option expects to be included | 441 | /// The number of times the option expects to be included |
| 441 | int get_expected() const { return expected_; } | 442 | int get_expected() const { return expected_; } |
| 442 | 443 | ||
| 443 | - /// \breif The total number of expected values (including the type) | 444 | + /// \brief The total number of expected values (including the type) |
| 444 | /// This is positive if exactly this number is expected, and negitive for at least N values | 445 | /// This is positive if exactly this number is expected, and negitive for at least N values |
| 445 | /// | 446 | /// |
| 446 | /// v = fabs(size_type*expected) | 447 | /// v = fabs(size_type*expected) |
include/CLI/Timer.hpp
| @@ -83,6 +83,7 @@ class Timer { | @@ -83,6 +83,7 @@ class Timer { | ||
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | // LCOV_EXCL_START | 85 | // LCOV_EXCL_START |
| 86 | + /// This prints out a time string from a time | ||
| 86 | std::string make_time_str(double time) const { | 87 | std::string make_time_str(double time) const { |
| 87 | auto print_it = [](double x, std::string unit) { | 88 | auto print_it = [](double x, std::string unit) { |
| 88 | char buffer[50]; | 89 | char buffer[50]; |
include/CLI/Validators.hpp
| @@ -30,11 +30,14 @@ namespace CLI { | @@ -30,11 +30,14 @@ namespace CLI { | ||
| 30 | struct Validator { | 30 | struct Validator { |
| 31 | /// This is the type name, if empty the type name will not be changed | 31 | /// This is the type name, if empty the type name will not be changed |
| 32 | std::string tname; | 32 | std::string tname; |
| 33 | - std::function<std::string(const std::string &filename)> func; | 33 | + |
| 34 | + /// This it the base function that is to be called. | ||
| 35 | + /// Returns a string error message if validation fails. | ||
| 36 | + std::function<std::string(const std::string &)> func; | ||
| 34 | 37 | ||
| 35 | /// This is the required operator for a validator - provided to help | 38 | /// This is the required operator for a validator - provided to help |
| 36 | - /// users (CLI11 uses the func directly) | ||
| 37 | - std::string operator()(const std::string &filename) const { return func(filename); }; | 39 | + /// users (CLI11 uses the member `func` directly) |
| 40 | + std::string operator()(const std::string &str) const { return func(str); }; | ||
| 38 | 41 | ||
| 39 | /// Combining validators is a new validator | 42 | /// Combining validators is a new validator |
| 40 | Validator operator&(const Validator &other) const { | 43 | Validator operator&(const Validator &other) const { |
| @@ -165,6 +168,10 @@ const detail::NonexistentPathValidator NonexistentPath; | @@ -165,6 +168,10 @@ const detail::NonexistentPathValidator NonexistentPath; | ||
| 165 | 168 | ||
| 166 | /// Produce a range (factory). Min and max are inclusive. | 169 | /// Produce a range (factory). Min and max are inclusive. |
| 167 | struct Range : public Validator { | 170 | struct Range : public Validator { |
| 171 | + /// This produces a range with min and max inclusive. | ||
| 172 | + /// | ||
| 173 | + /// Note that the constructor is templated, but the struct is not, so C++17 is not | ||
| 174 | + /// needed to provide nice syntax for Range(a,b). | ||
| 168 | template <typename T> Range(T min, T max) { | 175 | template <typename T> Range(T min, T max) { |
| 169 | std::stringstream out; | 176 | std::stringstream out; |
| 170 | out << detail::type_name<T>() << " in [" << min << " - " << max << "]"; | 177 | out << detail::type_name<T>() << " in [" << min << " - " << max << "]"; |