diff options
author | Jay Berkenbilt <ejb@ql.org> | 2008-04-29 14:55:25 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2008-04-29 14:55:25 +0200 |
commit | 9a0b88bf7777c153dc46ace22db74ef24d51583a (patch) | |
tree | f567ac1cf2bf5071a611eb49323a935b6ac938ff /libqpdf/QEXC.cc | |
download | qpdf-9a0b88bf7777c153dc46ace22db74ef24d51583a.tar.zst |
update release date to actual daterelease-qpdf-2.0
git-svn-id: svn+q:///qpdf/trunk@599 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'libqpdf/QEXC.cc')
-rw-r--r-- | libqpdf/QEXC.cc | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/libqpdf/QEXC.cc b/libqpdf/QEXC.cc new file mode 100644 index 00000000..c65afbb6 --- /dev/null +++ b/libqpdf/QEXC.cc @@ -0,0 +1,67 @@ + +#include <qpdf/QEXC.hh> +#include <string.h> +#include <errno.h> + +QEXC::Base::Base() +{ + // nothing needed +} + +QEXC::Base::Base(std::string const& message) : + message(message) +{ + // nothing needed +} + +std::string const& +QEXC::Base::unparse() const +{ + return this->message; +} + +void +QEXC::Base::setMessage(std::string const& message) +{ + this->message = message; +} + +const char* +QEXC::Base::what() const throw() +{ + // Since unparse() returns a const string reference, its + // implementors must arrange to have it return a reference to a + // string that is not going to disappear. It is therefore safe + // for us to return it's c_str() pointer. + return this->unparse().c_str(); +} + +QEXC::General::General() +{ + // nothing needed +} + +QEXC::General::General(std::string const& message) : + Base(message) +{ + // nothing needed +} + +QEXC::System::System(std::string const& prefix, int sys_errno) +{ + // Note: using sys_errno in case errno is a macro. + this->sys_errno = sys_errno; + this->setMessage(prefix + ": " + strerror(sys_errno)); +} + +int +QEXC::System::getErrno() const +{ + return this->sys_errno; +} + +QEXC::Internal::Internal(std::string const& message) : + Base("INTERNAL ERROR: " + message) +{ + // nothing needed +} |