Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyer committed Sep 14, 2024
1 parent eef5dc8 commit a98b031
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 1 addition & 3 deletions library/private/options_tools.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ T parse(const std::string& str)

//----------------------------------------------------------------------------
/**
* Parse provided string into a bool
* Supported values are: `"true"`/`"false"`, `"1"`/`"0"`, `"yes"`/`"no"`, `"on"`/`"off"`
* (case-insensitive)
* Parse provided string into a bool. Supports boolapha values as well as "yes/no" and "on/off"
*/
template<>
bool parse(const std::string& str)
Expand Down
13 changes: 11 additions & 2 deletions library/public/options.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,17 @@ public:

/**
* Templated parsing method used internally to parse strings.
* Implemented only for types: bool, int, double, ratio_t,
* as well as vector for each of these types.
* Implemented for:
* - `bool` as `"true"`/`"false"`, `"1"`/`"0"`, `"yes"`/`"no"`, `"on"`/`"off"`
* (case-insensitive)
* - `int`: `"123"`, `"+123"`, `"-456"`
* - `double`: `"123.45"`, `"+123.45"`, `"-67.8"`, `"-1e3"`
* - `ratio_t`: as
* + a number, same a `double` above
* + a percentage: `"12.3%"` => `0.123`
* + a fraction: `"3/4"` => `0.75`
* - `vector<T>` where `T` is one of the above: the input is split on `","` and chunks are trimmed
* before parsing each element.
* See parsing documentation for more info. TODO.
* Throw an options::parsing_exception if parsing failed.
*/
Expand Down

0 comments on commit a98b031

Please sign in to comment.