Commit 18163306293386e20fb87b298f8c881093a4a908
1 parent
11df3bec
clang-formatting new source
Showing
3 changed files
with
15 additions
and
20 deletions
examples/inter_argument_order.cpp
| ... | ... | @@ -17,7 +17,7 @@ int main(int argc, char **argv) { |
| 17 | 17 | // Standard parsing lines (copy and paste in) |
| 18 | 18 | try { |
| 19 | 19 | app.parse(argc, argv); |
| 20 | - } catch (const CLI::ParseError &e) { | |
| 20 | + } catch(const CLI::ParseError &e) { | |
| 21 | 21 | return app.exit(e); |
| 22 | 22 | } |
| 23 | 23 | |
| ... | ... | @@ -25,7 +25,7 @@ int main(int argc, char **argv) { |
| 25 | 25 | std::reverse(std::begin(foos), std::end(foos)); |
| 26 | 26 | std::reverse(std::begin(bars), std::end(bars)); |
| 27 | 27 | |
| 28 | - std::vector<std::tuple<std::string,int>> keyval; | |
| 28 | + std::vector<std::tuple<std::string, int>> keyval; | |
| 29 | 29 | for(auto option : app.parse_order()) { |
| 30 | 30 | if(option == foo) { |
| 31 | 31 | keyval.emplace_back("foo", foos.back()); |
| ... | ... | @@ -41,10 +41,8 @@ int main(int argc, char **argv) { |
| 41 | 41 | std::string name; |
| 42 | 42 | int value; |
| 43 | 43 | |
| 44 | - for(auto& tuple : keyval) { | |
| 44 | + for(auto &tuple : keyval) { | |
| 45 | 45 | std::tie(name, value) = tuple; |
| 46 | 46 | std::cout << name << " : " << value << std::endl; |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | - | |
| 50 | - | ... | ... |
include/CLI/App.hpp
| ... | ... | @@ -80,9 +80,9 @@ class App { |
| 80 | 80 | /// |
| 81 | 81 | /// This is faster and cleaner than storing just a list of strings and reparsing. This may contain the -- separator. |
| 82 | 82 | missing_t missing_; |
| 83 | - | |
| 83 | + | |
| 84 | 84 | /// This is a list of pointers to options with the orignal parse order |
| 85 | - std::vector<Option*> parse_order_; | |
| 85 | + std::vector<Option *> parse_order_; | |
| 86 | 86 | |
| 87 | 87 | ///@} |
| 88 | 88 | /// @name Subcommands |
| ... | ... | @@ -713,11 +713,9 @@ class App { |
| 713 | 713 | |
| 714 | 714 | return local_name == name_to_check; |
| 715 | 715 | } |
| 716 | - | |
| 716 | + | |
| 717 | 717 | /// This gets a vector of pointers with the original parse order |
| 718 | - const std::vector<Option*> &parse_order() const { | |
| 719 | - return parse_order_; | |
| 720 | - } | |
| 718 | + const std::vector<Option *> &parse_order() const { return parse_order_; } | |
| 721 | 719 | |
| 722 | 720 | ///@} |
| 723 | 721 | ... | ... |
tests/AppTest.cpp
| ... | ... | @@ -503,19 +503,18 @@ TEST_F(TApp, VectorFancyOpts) { |
| 503 | 503 | |
| 504 | 504 | TEST_F(TApp, OriginalOrder) { |
| 505 | 505 | std::vector<int> st1; |
| 506 | - CLI::Option* op1 = app.add_option("-a", st1); | |
| 506 | + CLI::Option *op1 = app.add_option("-a", st1); | |
| 507 | 507 | std::vector<int> st2; |
| 508 | - CLI::Option* op2 = app.add_option("-b", st2); | |
| 509 | - | |
| 508 | + CLI::Option *op2 = app.add_option("-b", st2); | |
| 509 | + | |
| 510 | 510 | args = {"-a", "1", "-b", "2", "-a3", "-a", "4"}; |
| 511 | - | |
| 511 | + | |
| 512 | 512 | run(); |
| 513 | - | |
| 514 | - EXPECT_EQ(st1, std::vector<int>({1,3,4})); | |
| 513 | + | |
| 514 | + EXPECT_EQ(st1, std::vector<int>({1, 3, 4})); | |
| 515 | 515 | EXPECT_EQ(st2, std::vector<int>({2})); |
| 516 | - | |
| 517 | - EXPECT_EQ(app.parse_order(), std::vector<CLI::Option*>({op1, op2, op1, op1})); | |
| 518 | - | |
| 516 | + | |
| 517 | + EXPECT_EQ(app.parse_order(), std::vector<CLI::Option *>({op1, op2, op1, op1})); | |
| 519 | 518 | } |
| 520 | 519 | |
| 521 | 520 | TEST_F(TApp, RequiresFlags) { | ... | ... |