argument: Support multiple arguments
This will be used in future patches. Right now this should retain
similar behavior to the current argument parsing semantics. The
difference is we now require arguments to be specified only once and
error if they are specified multiple times.
Change-Id: I21e4cf9734f045c2b0991f7ed0ec6e6a569eec7d
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/argument.hpp b/argument.hpp
index ee9e8c8..1c07c5c 100644
--- a/argument.hpp
+++ b/argument.hpp
@@ -3,6 +3,7 @@
#include <getopt.h>
#include <map>
#include <string>
+#include <vector>
namespace phosphor
{
@@ -35,7 +36,7 @@
*
* @return argument which is a standard optarg
*/
- const std::string& operator[](const std::string& opt);
+ const std::vector<std::string>& operator[](const std::string& opt);
/** @brief Displays usage
*
@@ -46,12 +47,9 @@
/** @brief Set to 'true' when an option is passed */
static const std::string trueString;
- /** @brief Set to '' when an option is not passed */
- static const std::string emptyString;
-
private:
/** @brief Option to argument mapping */
- std::map<const std::string, std::string> arguments;
+ std::map<const std::string, std::vector<std::string> > arguments;
/** @brief Array of struct options as needed by getopt_long */
static const option options[];