diff options
author | Alan Conway <aconway@apache.org> | 2006-10-12 18:52:49 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2006-10-12 18:52:49 +0000 |
commit | c256b20602a42a3d33f36bb0e8d9692906d282a6 (patch) | |
tree | 0fba6619fbb98c3511785143ca30647c5e6a4469 /cpp/broker/inc/Configuration.h | |
parent | 1e6a034ccd8e260e615195bf193aed7d37b928a8 (diff) | |
download | qpid-python-c256b20602a42a3d33f36bb0e8d9692906d282a6.tar.gz |
Converted broker to a class for use in tests, plugins etc.
qpid::Exception base class for all exceptions, inherits std::exception.
Require boost on all platforms: http://www.boost.org, 'yum boost' on fedora.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@463376 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/broker/inc/Configuration.h')
-rw-r--r-- | cpp/broker/inc/Configuration.h | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/cpp/broker/inc/Configuration.h b/cpp/broker/inc/Configuration.h index 5ec70a839b..aaabdd23a0 100644 --- a/cpp/broker/inc/Configuration.h +++ b/cpp/broker/inc/Configuration.h @@ -21,11 +21,12 @@ #include <cstdlib> #include <iostream> #include <vector> +#include "Exception.h" namespace qpid { namespace broker { class Configuration{ - class Option{ + class Option { const std::string flag; const std::string name; const std::string desc; @@ -56,6 +57,7 @@ namespace qpid { int getValue() const; virtual bool needsValue() const; virtual void setValue(const std::string& value); + virtual void setValue(int _value) { value = _value; } }; class StringOption : public Option{ @@ -82,6 +84,7 @@ namespace qpid { bool getValue() const; virtual bool needsValue() const; virtual void setValue(const std::string& value); + virtual void setValue(bool _value) { value = _value; } }; BoolOption trace; @@ -96,10 +99,9 @@ namespace qpid { std::vector<Option*> options; public: - class ParseException{ - public: - const std::string& error; - ParseException(const std::string& _error) : error(_error) {} + class ParseException : public Exception { + public: + ParseException(const std::string& msg) : Exception(msg) {} }; @@ -108,13 +110,21 @@ namespace qpid { void parse(int argc, char** argv); - bool isHelp(); - bool isTrace(); - int getPort(); - int getWorkerThreads(); - int getMaxConnections(); - int getConnectionBacklog(); - const std::string& getAcceptor(); + bool isHelp() const; + bool isTrace() const; + int getPort() const; + int getWorkerThreads() const; + int getMaxConnections() const; + int getConnectionBacklog() const; + std::string getAcceptor() const; + + void setHelp(bool b) { help.setValue(b); } + void setTrace(bool b) { trace.setValue(b); } + void setPort(int i) { port.setValue(i); } + void setWorkerThreads(int i) { workerThreads.setValue(i); } + void setMaxConnections(int i) { maxConnections.setValue(i); } + void setConnectionBacklog(int i) { connectionBacklog.setValue(i); } + void setAcceptor(const std::string& val) { acceptor.setValue(val); } void usage(); }; |