Have cooling-type use the common argument.hpp
The cooling-type application should use the common
header file for the ArgumentParser class now that one
is available.
Also fixed where a static ArgumentParser constant was
being initialized.
Change-Id: I1fb0dfe3bd0c6e0200ad7c718ef2a3def5476f3f
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/argument.hpp b/argument.hpp
index c314006..9d0ab06 100644
--- a/argument.hpp
+++ b/argument.hpp
@@ -30,7 +30,7 @@
static void usage(char** argv);
- static constexpr auto true_string = "true";
+ static const std::string true_string;
static const std::string empty_string;
private:
diff --git a/control/argument.cpp b/control/argument.cpp
index 2852dee..d9b832d 100644
--- a/control/argument.cpp
+++ b/control/argument.cpp
@@ -82,6 +82,7 @@
const char* ArgumentParser::optionstr = "ich?";
+const std::string ArgumentParser::true_string = "true";
const std::string ArgumentParser::empty_string = "";
}
diff --git a/cooling-type/argument.cpp b/cooling-type/argument.cpp
index f0a78c2..cfd8b25 100644
--- a/cooling-type/argument.cpp
+++ b/cooling-type/argument.cpp
@@ -21,9 +21,9 @@
namespace phosphor
{
-namespace cooling
+namespace fan
{
-namespace type
+namespace util
{
ArgumentParser::ArgumentParser(int argc, char** argv)
@@ -99,6 +99,7 @@
const char* ArgumentParser::optionstr = "p:d:e:aw?h";
+const std::string ArgumentParser::true_string = "true";
const std::string ArgumentParser::empty_string = "";
}
diff --git a/cooling-type/argument.hpp b/cooling-type/argument.hpp
deleted file mode 100644
index cc64891..0000000
--- a/cooling-type/argument.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#pragma once
-
-#include <getopt.h>
-#include <map>
-#include <string>
-
-namespace phosphor
-{
-namespace cooling
-{
-namespace type
-{
-
-class ArgumentParser
-{
- public:
- ArgumentParser(int argc, char** argv);
- ArgumentParser() = delete;
- ArgumentParser(const ArgumentParser&) = delete;
- ArgumentParser(ArgumentParser&&) = default;
- ArgumentParser& operator=(const ArgumentParser&) = delete;
- ArgumentParser& operator=(ArgumentParser&&) = default;
- ~ArgumentParser() = default;
- const std::string& operator[](const std::string& opt);
-
- static void usage(char** argv);
-
- static constexpr auto true_string = "true";
- static const std::string empty_string;
-
- private:
- std::map<const std::string, std::string> arguments;
-
- static const option options[];
- static const char* optionstr;
-};
-
-}
-}
-}
-// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
diff --git a/cooling-type/main.cpp b/cooling-type/main.cpp
index caa4e88..288f1b9 100644
--- a/cooling-type/main.cpp
+++ b/cooling-type/main.cpp
@@ -6,6 +6,7 @@
#include "cooling_type.hpp"
using namespace phosphor::cooling::type;
+using namespace phosphor::fan::util;
using namespace phosphor::logging;
int main(int argc, char* argv[])