Commit 9d6830e8d2da920699a861d880137b91369f6563

Authored by Henry Fredrick Schreiner
1 parent a4616805

Adding more to documentation

include/CLI/App.hpp
... ... @@ -1632,6 +1632,7 @@ class App {
1632 1632  
1633 1633 namespace FailureMessage {
1634 1634  
  1635 +/// Printout a clean, simple message on error (the default in CLI11 1.5+)
1635 1636 inline std::string simple(const App *app, const Error &e) {
1636 1637 std::string header = std::string(e.what()) + "\n";
1637 1638 if(app->get_help_ptr() != nullptr)
... ... @@ -1639,6 +1640,7 @@ inline std::string simple(const App *app, const Error &e) {
1639 1640 return header;
1640 1641 }
1641 1642  
  1643 +/// Printout the full help string on error (if this fn is set, the old default for CLI11)
1642 1644 inline std::string help(const App *app, const Error &e) {
1643 1645 std::string header = std::string("ERROR: ") + e.get_name() + ": " + e.what() + "\n";
1644 1646 header += app->help();
... ...
include/CLI/FormatterFwd.hpp
... ... @@ -97,6 +97,8 @@ class FormatterLambda final : public FormatterBase {
97 97 }
98 98 };
99 99  
  100 +/// This is the default Formatter for CLI11. It pretty prints help output, and is broken into quite a few
  101 +/// overridable methods, to be highly customizable with minimal effort.
100 102 class Formatter : public FormatterBase {
101 103 public:
102 104 Formatter() = default;
... ...
include/CLI/Option.hpp
... ... @@ -30,6 +30,8 @@ using Option_p = std::unique_ptr<Option>;
30 30  
31 31 enum class MultiOptionPolicy { Throw, TakeLast, TakeFirst, Join };
32 32  
  33 +/// This is the CRTP base class for Option and OptionDefaults. It was designed this way
  34 +/// to share parts of the class; an OptionDefaults can copy to an Option.
33 35 template <typename CRTP> class OptionBase {
34 36 friend App;
35 37  
... ... @@ -123,6 +125,8 @@ template &lt;typename CRTP&gt; class OptionBase {
123 125 }
124 126 };
125 127  
  128 +/// This is a version of OptionBase that only supports setting values,
  129 +/// for defaults. It is stored as the default option in an App.
126 130 class OptionDefaults : public OptionBase<OptionDefaults> {
127 131 public:
128 132 OptionDefaults() = default;
... ... @@ -287,7 +291,7 @@ class Option : public OptionBase&lt;Option&gt; {
287 291 return this;
288 292 }
289 293  
290   - /// Adds a validator
  294 + /// Adds a validator. Takes a const string& and returns an error message (empty if conversion/check is okay).
291 295 Option *check(std::function<std::string(const std::string &)> validator) {
292 296 validators_.emplace_back(validator);
293 297 return this;
... ...
include/CLI/Timer.hpp
... ... @@ -17,6 +17,7 @@
17 17  
18 18 namespace CLI {
19 19  
  20 +/// This is a simple timer with pretty printing. Creating the timer starts counting.
20 21 class Timer {
21 22 protected:
22 23 /// This is a typedef to make clocks easier to use
... ...
include/CLI/TypeTools.hpp
... ... @@ -12,18 +12,24 @@ namespace CLI {
12 12  
13 13 // Type tools
14 14  
15   -// We could check to see if C++14 is being used, but it does not hurt to redefine this
16   -// (even Google does this: https://github.com/google/skia/blob/master/include/private/SkTLogic.h)
17   -// It is not in the std namespace anyway, so no harm done.
  15 +/// A copy of enable_if_t from C++14, compatible with C++11.
  16 +///
  17 +/// We could check to see if C++14 is being used, but it does not hurt to redefine this
  18 +/// (even Google does this: https://github.com/google/skia/blob/master/include/private/SkTLogic.h)
  19 +/// It is not in the std namespace anyway, so no harm done.
18 20  
19 21 template <bool B, class T = void> using enable_if_t = typename std::enable_if<B, T>::type;
20 22  
  23 +/// Check to see if something is a vector (fail check by default)
21 24 template <typename T> struct is_vector { static const bool value = false; };
22 25  
  26 +/// Check to see if something is a vector (true if actually a vector)
23 27 template <class T, class A> struct is_vector<std::vector<T, A>> { static bool const value = true; };
24 28  
  29 +/// Check to see if something is bool (fail check by default)
25 30 template <typename T> struct is_bool { static const bool value = false; };
26 31  
  32 +/// Check to see if something is bool (true if actually a bool)
27 33 template <> struct is_bool<bool> { static bool const value = true; };
28 34  
29 35 namespace detail {
... ...