feat(cpp-object-oriented-modular-refactoring): step 3 - foundation-google-style
This commit is contained in:
+20
-26
@@ -1,42 +1,36 @@
|
||||
#include "fesa/core/status.hpp"
|
||||
#include "fesa/core/status.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace fesa {
|
||||
|
||||
Status Status::ok() {
|
||||
return Status{true, std::nullopt, {}};
|
||||
Status Status::Ok() { return Status{true, std::nullopt, {}}; }
|
||||
|
||||
Status Status::Failure(std::vector<Diagnostic> diagnostics) {
|
||||
SortDiagnostics(diagnostics);
|
||||
return Status{false, std::nullopt, std::move(diagnostics)};
|
||||
}
|
||||
|
||||
Status Status::failure(std::vector<Diagnostic> diagnostics) {
|
||||
sortDiagnostics(diagnostics);
|
||||
return Status{false, std::nullopt, std::move(diagnostics)};
|
||||
Status Status::Failure(FailureCategory category,
|
||||
std::vector<Diagnostic> diagnostics) {
|
||||
SortDiagnostics(diagnostics);
|
||||
return Status{false, category, std::move(diagnostics)};
|
||||
}
|
||||
|
||||
Status Status::failure(
|
||||
FailureCategory category, std::vector<Diagnostic> diagnostics) {
|
||||
sortDiagnostics(diagnostics);
|
||||
return Status{false, category, std::move(diagnostics)};
|
||||
bool Status::IsOk() const noexcept { return is_ok_; }
|
||||
|
||||
std::optional<FailureCategory> Status::Category() const noexcept {
|
||||
return category_;
|
||||
}
|
||||
|
||||
bool Status::isOk() const noexcept {
|
||||
return isOk_;
|
||||
const std::vector<Diagnostic>& Status::Diagnostics() const noexcept {
|
||||
return diagnostics_;
|
||||
}
|
||||
|
||||
std::optional<FailureCategory> Status::failureCategory() const noexcept {
|
||||
return category_;
|
||||
}
|
||||
|
||||
const std::vector<Diagnostic>& Status::diagnostics() const noexcept {
|
||||
return diagnostics_;
|
||||
}
|
||||
|
||||
Status::Status(
|
||||
bool isOk,
|
||||
std::optional<FailureCategory> category,
|
||||
std::vector<Diagnostic> diagnostics)
|
||||
: isOk_{isOk},
|
||||
Status::Status(bool is_ok, std::optional<FailureCategory> category,
|
||||
std::vector<Diagnostic> diagnostics)
|
||||
: is_ok_{is_ok},
|
||||
category_{category},
|
||||
diagnostics_{std::move(diagnostics)} {}
|
||||
|
||||
} // namespace fesa
|
||||
} // namespace fesa
|
||||
|
||||
Reference in New Issue
Block a user