#include "base/command_line.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
+#include "cloud_print/gcp20/prototype/gcp20_switches.h"
namespace command_line_reader {
-const char kHttpPortSwitch[] = "http-port";
-const char kTtlSwitch[] = "ttl";
-const char kServiceNameSwitch[] = "service-name";
-const char kDomainNameSwitch[] = "domain-name";
-const char kStatePathSwitch[] = "state-path";
-
uint16 ReadHttpPort(uint16 default_value) {
uint32 http_port = 0;
std::string http_port_string =
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kHttpPortSwitch);
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kHttpPort);
if (!base::StringToUint(http_port_string, &http_port))
http_port = default_value;
uint32 ttl = 0;
if (!base::StringToUint(
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kTtlSwitch),
- &ttl)) {
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kTtl),
+ &ttl)) {
ttl = default_value;
}
std::string ReadServiceNamePrefix(const std::string& default_value) {
std::string service_name =
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kServiceNameSwitch);
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kServiceName);
return service_name.empty() ? default_value : service_name;
}
std::string ReadDomainName(const std::string& default_value) {
std::string domain_name =
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kDomainNameSwitch);
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kDomainName);
if (domain_name.empty())
return default_value;
}
std::string ReadStatePath(const std::string& default_value) {
- std::string filename =
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kStatePathSwitch);
+ std::string filename = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kStatePath);
if (filename.empty())
return default_value;