diff --git a/Status.hxx.in b/Status.hxx.in index ed46d5c2bc875fa50f954f1f61189cce469d56a0..16efaefdf3397e013d90cecb19f2e4ec285432be 100644 --- a/Status.hxx.in +++ b/Status.hxx.in @@ -55,7 +55,10 @@ public: #endif /** Return true on "Success", false otherwise. */ - explicit operator bool() const { return this->Kind_ == Kind::Success; } + bool IsSuccess() const { return this->Kind_ == Kind::Success; } + + /** Return true on "Success", false otherwise. */ + explicit operator bool() const { return this->IsSuccess(); } /** Return the kind of status. */ Kind GetKind() const { return this->Kind_; } diff --git a/testStatus.cxx b/testStatus.cxx index f85ef422dbf322347f9828b66fe620b00eb78fe9..0a767a8547d57871fb5d2e033aba8a451c340884 100644 --- a/testStatus.cxx +++ b/testStatus.cxx @@ -31,6 +31,10 @@ int testStatus(int, char* []) std::cerr << "Status Success constructor does not produce Success\n"; res = false; } + if (!status.IsSuccess()) { + std::cerr << "Status Success gives false IsSuccess\n"; + res = false; + } if (!status) { std::cerr << "Status Success kind is not true\n"; res = false; @@ -55,6 +59,10 @@ int testStatus(int, char* []) std::cerr << "Status POSIX constructor does not produce POSIX\n"; res = false; } + if (status.IsSuccess()) { + std::cerr << "Status POSIX gives true IsSuccess\n"; + res = false; + } if (status) { std::cerr << "Status POSIX kind is not false\n"; res = false; @@ -87,6 +95,10 @@ int testStatus(int, char* []) std::cerr << "Status Windows constructor does not produce Windows\n"; res = false; } + if (status.IsSuccess()) { + std::cerr << "Status Windows gives true IsSuccess\n"; + res = false; + } if (status) { std::cerr << "Status Windows kind is not false\n"; res = false;