Expose Status::code()

This commit is contained in:
Igor Canadi 2014-05-14 16:23:40 -07:00
parent cdc53dc120
commit c07c9606ed

View File

@ -97,7 +97,6 @@ class Status {
// Returns the string "OK" for success. // Returns the string "OK" for success.
std::string ToString() const; std::string ToString() const;
private:
enum Code { enum Code {
kOk = 0, kOk = 0,
kNotFound = 1, kNotFound = 1,
@ -110,6 +109,10 @@ class Status {
kShutdownInProgress = 8 kShutdownInProgress = 8
}; };
Code code() const {
return code_;
}
private:
// A nullptr state_ (which is always the case for OK) means the message // A nullptr state_ (which is always the case for OK) means the message
// is empty. // is empty.
// of the following form: // of the following form:
@ -118,9 +121,6 @@ class Status {
Code code_; Code code_;
const char* state_; const char* state_;
Code code() const {
return code_;
}
explicit Status(Code code) : code_(code), state_(nullptr) { } explicit Status(Code code) : code_(code), state_(nullptr) { }
Status(Code code, const Slice& msg, const Slice& msg2); Status(Code code, const Slice& msg, const Slice& msg2);
static const char* CopyState(const char* s); static const char* CopyState(const char* s);