1 #ifndef QPID_COMMONOPTIONS_H
2 #define QPID_COMMONOPTIONS_H
29 # pragma warning(push)
30 # pragma warning(disable : 4251 4275)
33 #include <boost/program_options.hpp>
34 #include <boost/format.hpp>
47 namespace po=boost::program_options;
59 : po::typed_value<T>(&value), argName(arg) {}
60 std::string
name()
const {
return argName; }
74 po::value_semantic*
optValue(T& value,
const char* name) {
75 std::string valstr(boost::lexical_cast<std::string>(value));
83 po::value_semantic*
optValue(std::vector<T>& value,
const char* name) {
84 std::ostringstream os;
85 std::copy(value.begin(), value.end(), std::ostream_iterator<T>(os,
" "));
86 std::string val=os.str();
88 val.erase(val.end()-1);
93 inline po::value_semantic*
optValue(
bool& value) {
return po::bool_switch(&value); }
135 struct Options :
public po::options_description {
149 const std::string& configfile=std::string(),
150 bool allowUnknown =
false);
156 const std::string& theArg);
158 boost::program_options::options_description_easy_init
addOptions() {
159 return add_options();
170 const std::string& configfile=std::string(),
171 const std::string& clientConfigFile=std::string());