diff options
-rw-r--r-- | .gitmodules | 4 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | args.hxx | 18 | ||||
m--------- | pages | 0 |
4 files changed, 12 insertions, 13 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3386d8f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "pages"] + path = pages + url = github.com:Taywee/args.git + branch = gh-pages @@ -46,8 +46,9 @@ clean: rm -rv $(EXECUTABLE) $(OBJECTS) $(DEPENDENCIES) doc pages: + -rm -r pages/* doxygen Doxyfile - cp -rv doc/html/* . + cp -rv doc/html/* pages/ doc/man: doxygen Doxyfile @@ -585,7 +585,9 @@ namespace args std::function<bool(const Group &)> validator; public: + /// If help is empty, this group will not be printed in help output Group(const std::string &help = std::string(), const std::function<bool(const Group &)> &validator = Validators::DontCare) : Base(help), validator(validator) {} + /// If help is empty, this group will not be printed in help output Group(Group &group, const std::string &help = std::string(), const std::function<bool(const Group &)> &validator = Validators::DontCare) : Base(help), validator(validator) { group.Add(*this); @@ -673,7 +675,7 @@ namespace args /** Get all this group's children */ - const std::vector<Base *> Children() const + const std::vector<Base *> &Children() const { return children; } @@ -813,17 +815,9 @@ namespace args static bool AllChildGroups(const Group &group) { - for (const auto child: group.Children()) - { - if (const auto group = dynamic_cast<Group *>(child)) - { - if (!group->Matched()) - { - return false; - } - } - } - return true; + return std::find_if(std::begin(group.Children()), std::end(group.Children()), [](const Base* child) -> bool { + return dynamic_cast<const Group *>(child) && !child->Matched(); + }) == std::end(group.Children()); } static bool DontCare(const Group &group) diff --git a/pages b/pages new file mode 160000 +Subproject 7d3fe5fa0a244947faf0e0307bb493f68d09d8d |