diff options
author | Mark Spruiell <mes@zeroc.com> | 2006-11-10 16:07:44 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2006-11-10 16:07:44 +0000 |
commit | dbb9a7cd36c97ec38d6920b1a124fc35c48e854f (patch) | |
tree | 6996f9fb1e5cccaa6479fc648f7ae596a060ca17 | |
parent | Do not compile *F.cpp files (diff) | |
download | ice-dbb9a7cd36c97ec38d6920b1a124fc35c48e854f.tar.bz2 ice-dbb9a7cd36c97ec38d6920b1a124fc35c48e854f.tar.xz ice-dbb9a7cd36c97ec38d6920b1a124fc35c48e854f.zip |
adding ice_print to exceptions
-rwxr-xr-x | cpp/include/IceUtil/Options.h | 2 | ||||
-rwxr-xr-x | cpp/src/IceUtil/Options.cpp | 22 |
2 files changed, 22 insertions, 2 deletions
diff --git a/cpp/include/IceUtil/Options.h b/cpp/include/IceUtil/Options.h index d320d9aa9e2..2e1f0b2ba18 100755 --- a/cpp/include/IceUtil/Options.h +++ b/cpp/include/IceUtil/Options.h @@ -29,6 +29,7 @@ public: APIException(const char*, int, const ::std::string&); virtual ~APIException() throw(); virtual ::std::string ice_name() const; + virtual void ice_print(std::ostream&) const; virtual ::IceUtil::Exception* ice_clone() const; virtual void ice_throw() const; @@ -48,6 +49,7 @@ public: BadOptException(const char*, int, const ::std::string&); virtual ~BadOptException() throw(); virtual ::std::string ice_name() const; + virtual void ice_print(std::ostream&) const; virtual ::IceUtil::Exception* ice_clone() const; virtual void ice_throw() const; diff --git a/cpp/src/IceUtil/Options.cpp b/cpp/src/IceUtil/Options.cpp index 0e9fef64713..236fdaf2d24 100755 --- a/cpp/src/IceUtil/Options.cpp +++ b/cpp/src/IceUtil/Options.cpp @@ -30,6 +30,16 @@ IceUtil::APIException::ice_name() const return _name; } +void +IceUtil::APIException::ice_print(ostream& out) const +{ + Exception::ice_print(out); + if(!reason.empty()) + { + out << ": " << reason; + } +} + IceUtil::Exception* IceUtil::APIException::ice_clone() const { @@ -46,7 +56,6 @@ ostream& IceUtil::operator<<(ostream& out, const IceUtil::APIException& ex) { ex.ice_print(out); - out << ": " << ex.reason; return out; } @@ -67,6 +76,16 @@ IceUtil::BadOptException::ice_name() const return _name; } +void +IceUtil::BadOptException::ice_print(ostream& out) const +{ + Exception::ice_print(out); + if(!reason.empty()) + { + out << ": " << reason; + } +} + IceUtil::Exception* IceUtil::BadOptException::ice_clone() const { @@ -83,7 +102,6 @@ ostream& IceUtil::operator<<(ostream& out, const IceUtil::BadOptException& ex) { ex.ice_print(out); - out << ": " << ex.reason; return out; } |