From 76a4367b57a24eda575abd68e9bcfeae0b9c1401 Mon Sep 17 00:00:00 2001 From: MoAlyousef Date: Fri, 11 Sep 2020 13:24:56 +0300 Subject: [PATCH] add getter --- src/error.cpp | 4 +++- src/error.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/error.cpp b/src/error.cpp index 1a3038f..69706fc 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -6,7 +6,9 @@ namespace cmkr::error { Status::Status(Code ec) noexcept : ec_(ec) {} -Status::operator int() noexcept { return static_cast(ec_); } +Status::operator int() const noexcept { return static_cast(ec_); } + +Status::Code Status::code() const noexcept { return ec_; } } // namespace cmkr::error diff --git a/src/error.h b/src/error.h index dae2227..80c2150 100644 --- a/src/error.h +++ b/src/error.h @@ -12,7 +12,8 @@ struct Status { BuildError, }; Status(Code ec) noexcept; - operator int() noexcept; + operator int() const noexcept; + Code code() const noexcept; private: Code ec_ = Code::Success;