From a6ceffdb63689af5ca9b61794738507acd7c7118 Mon Sep 17 00:00:00 2001 From: Stephan van Veen Date: Mon, 13 May 2019 22:29:35 +0200 Subject: [PATCH] Extend doxygen documentation --- include/argparse.hpp | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/include/argparse.hpp b/include/argparse.hpp index 4313c8b..6e7ac31 100644 --- a/include/argparse.hpp +++ b/include/argparse.hpp @@ -152,14 +152,20 @@ public: return !(*this == aRhs); } - // Entry point for template types other than std::vector and std::list + /* + * Entry point for template non-container types + * @throws std::logic_error in case of incompatible types + */ template std::enable_if_t , bool> operator==(const T& aRhs) const { return get() == aRhs; } - // Template specialization for containers + /* + * Template specialization for containers + * @throws std::logic_error in case of incompatible types + */ template std::enable_if_t , bool> operator==(const T& aRhs) const { @@ -180,7 +186,10 @@ public: return (starts_with(aName, "--") || starts_with(aName, "-")); } - // Getter for template types other than std::vector and std::list + /* + * Getter for template non-container types + * @throws std::logic_error in case of incompatible types + */ template enable_if_not_container get() const { @@ -193,7 +202,10 @@ public: throw std::logic_error("No value provided"); } - // Getter for container types + /* + * Getter for container types + * @throws std::logic_error in case of incompatible types + */ template enable_if_container get() const { @@ -297,7 +309,10 @@ class ArgumentParser { parse_args_validate(); } - // Getter enabled for all template types other than std::vector and std::list + /* Getter enabled for all template types other than std::vector and std::list + * @throws std::logic_error in case of an invalid argument name + * @throws std::logic_error in case of incompatible types + */ template T get(const std::string& aArgumentName) { auto tIterator = mArgumentMap.find(aArgumentName); @@ -307,8 +322,10 @@ class ArgumentParser { throw std::logic_error("No such argument"); } - // Indexing operator. Return a reference to an Argument object - // Used in conjuction with Argument.operator== e.g., parser["foo"] == true + /* Indexing operator. Return a reference to an Argument object + * Used in conjuction with Argument.operator== e.g., parser["foo"] == true + * @throws std::logic_error in case of an invalid argument name + */ Argument& operator[](const std::string& aArgumentName) { auto tIterator = mArgumentMap.find(aArgumentName); if (tIterator != mArgumentMap.end()) {