Minor changes in utils::Status (#9288)
* Minor changes in utils::Status - << operator doesn't have to be friend - simplify getErrorMessage to not use strlen internally * Replace std::ostream to utils::io::ostream
This commit is contained in:
@@ -15,13 +15,11 @@
|
||||
*/
|
||||
#include <utils/Status.h>
|
||||
|
||||
namespace utils {
|
||||
std::string_view Status::getErrorMessage() const {
|
||||
const char* ptr = mErrorMessage.c_str();
|
||||
return (ptr != nullptr) ? ptr : "";
|
||||
}
|
||||
#include <utils/ostream.h>
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Status& status) {
|
||||
namespace utils {
|
||||
|
||||
utils::io::ostream& operator<<(utils::io::ostream& os, const Status& status) {
|
||||
os << "Status: ";
|
||||
switch (status.getCode()) {
|
||||
case StatusCode::OK: os << "Ok";
|
||||
|
||||
Reference in New Issue
Block a user