Commit cb3b438d authored by Steven Murray's avatar Steven Murray
Browse files

Improved the const correctness of Errnum

parent 867f5d98
......@@ -43,26 +43,26 @@ void Errnum::ErrnumConstructorBottomHalf(const std::string & what) {
getMessage().str(w2.str());
}
void Errnum::throwOnReturnedErrno (int err, std::string context) {
void Errnum::throwOnReturnedErrno (const int err, const std::string &context) {
if (err) throw Errnum(err, context);
}
void Errnum::throwOnNonZero(int status, std::string context) {
void Errnum::throwOnNonZero(const int status, const std::string &context) {
if (status) throw Errnum(context);
}
void Errnum::throwOnZero(int status, std::string context) {
void Errnum::throwOnZero(const int status, const std::string &context) {
if (!status) throw Errnum(context);
}
void Errnum::throwOnNull(void * f, std::string context) {
void Errnum::throwOnNull(const void *const f, const std::string &context) {
if (NULL == f) throw Errnum(context);
}
void Errnum::throwOnNegative(int ret, std::string context) {
void Errnum::throwOnNegative(const int ret, const std::string &context) {
if (ret < 0) throw Errnum(context);
}
void Errnum::throwOnMinusOne(int ret, std::string context) {
void Errnum::throwOnMinusOne(const int ret, const std::string &context) {
if (-1 == ret) throw Errnum(context);
}
......@@ -29,12 +29,12 @@ namespace exception {
virtual ~Errnum() throw() {};
int errorNumber() const { return m_errnum; }
std::string strError() const { return m_strerror; }
static void throwOnReturnedErrno(int err, std::string context = "");
static void throwOnNonZero(int status, std::string context = "");
static void throwOnZero(int status, std::string context = "");
static void throwOnNull(void * f, std::string context = "");
static void throwOnNegative(int ret, std::string context = "");
static void throwOnMinusOne(int ret, std::string context = "");
static void throwOnReturnedErrno(const int err, const std::string &context = "");
static void throwOnNonZero(const int status, const std::string &context = "");
static void throwOnZero(const int status, const std::string &context = "");
static void throwOnNull(const void *const f, const std::string &context = "");
static void throwOnNegative(const int ret, const std::string &context = "");
static void throwOnMinusOne(const int ret, const std::string &context = "");
protected:
void ErrnumConstructorBottomHalf(const std::string & what);
int m_errnum;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment