diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2018-05-25 16:39:22 +0930 |
---|---|---|
committer | Andrew Jeffery <andrew@aj.id.au> | 2019-03-18 15:27:01 +1030 |
commit | c41bf5b7fdf4599101fe31e7d2e998aebfca7f92 (patch) | |
tree | 85eef0553a865a57ab126cbc6a4386e03a63100c /argument.hpp | |
parent | e0844ff447abad01fa6f902caab3839336d1518d (diff) | |
download | phosphor-led-sysfs-c41bf5b7fdf4599101fe31e7d2e998aebfca7f92.tar.gz phosphor-led-sysfs-c41bf5b7fdf4599101fe31e7d2e998aebfca7f92.zip |
Add OpenBMC C++ clang-format file and format code
Change-Id: Ib3a388bf5392159440682265b577fba023c3c3aa
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Diffstat (limited to 'argument.hpp')
-rw-r--r-- | argument.hpp | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/argument.hpp b/argument.hpp index 9c91615..81876da 100644 --- a/argument.hpp +++ b/argument.hpp @@ -1,6 +1,7 @@ #ifndef __ARGUMENT_H #define __ARGUMENT_H #include <getopt.h> + #include <map> #include <string> @@ -13,43 +14,43 @@ namespace led */ class ArgumentParser { - public: - ArgumentParser() = delete; - ~ArgumentParser() = default; - ArgumentParser(const ArgumentParser&) = delete; - ArgumentParser& operator=(const ArgumentParser&) = delete; - ArgumentParser(ArgumentParser&&) = default; - ArgumentParser& operator=(ArgumentParser&&) = default; - - /** @brief Constructs Argument object - * - * @param argc - the main function's argc passed as is - * @param argv - the main function's argv passed as is - * @return Object constructed - */ - ArgumentParser(int argc, char** argv); - - /** @brief Given a option, returns its argument(optarg) */ - const std::string& operator[](const std::string& opt); - - /** @brief Displays usage */ - static void usage(char** argv); - - /** @brief Set to 'true' when an option is passed */ - static const std::string true_string; - - /** @brief Set to '' when an option is not passed */ - static const std::string empty_string; - - private: - /** @brief Option to argument mapping */ - std::map<const std::string, std::string> arguments; - - /** @brief Array of struct options as needed by getopt_long */ - static const option options[]; - - /** @brief optstring as needed by getopt_long */ - static const char* optionstr; + public: + ArgumentParser() = delete; + ~ArgumentParser() = default; + ArgumentParser(const ArgumentParser&) = delete; + ArgumentParser& operator=(const ArgumentParser&) = delete; + ArgumentParser(ArgumentParser&&) = default; + ArgumentParser& operator=(ArgumentParser&&) = default; + + /** @brief Constructs Argument object + * + * @param argc - the main function's argc passed as is + * @param argv - the main function's argv passed as is + * @return Object constructed + */ + ArgumentParser(int argc, char** argv); + + /** @brief Given a option, returns its argument(optarg) */ + const std::string& operator[](const std::string& opt); + + /** @brief Displays usage */ + static void usage(char** argv); + + /** @brief Set to 'true' when an option is passed */ + static const std::string true_string; + + /** @brief Set to '' when an option is not passed */ + static const std::string empty_string; + + private: + /** @brief Option to argument mapping */ + std::map<const std::string, std::string> arguments; + + /** @brief Array of struct options as needed by getopt_long */ + static const option options[]; + + /** @brief optstring as needed by getopt_long */ + static const char* optionstr; }; } // namespace led |