MCPcopy Create free account
hub / github.com/ElementsProject/elements / ToString

Method ToString

src/leveldb/util/status.cc:38–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38std::string Status::ToString() const {
39 if (state_ == nullptr) {
40 return "OK";
41 } else {
42 char tmp[30];
43 const char* type;
44 switch (code()) {
45 case kOk:
46 type = "OK";
47 break;
48 case kNotFound:
49 type = "NotFound: ";
50 break;
51 case kCorruption:
52 type = "Corruption: ";
53 break;
54 case kNotSupported:
55 type = "Not implemented: ";
56 break;
57 case kInvalidArgument:
58 type = "Invalid argument: ";
59 break;
60 case kIOError:
61 type = "IO error: ";
62 break;
63 default:
64 snprintf(tmp, sizeof(tmp),
65 "Unknown code(%d): ", static_cast<int>(code()));
66 type = tmp;
67 break;
68 }
69 std::string result(type);
70 uint32_t length;
71 memcpy(&length, state_, sizeof(length));
72 result.append(state_ + 5, length);
73 return result;
74 }
75}
76
77} // namespace leveldb

Callers 15

TESTFunction · 0.45
PrintEnvironmentMethod · 0.45
StopMethod · 0.45
RunMethod · 0.45
WriteMethod · 0.45
ReportMethod · 0.45
PrintEnvironmentMethod · 0.45
RunMethod · 0.45
OpenMethod · 0.45
DoWriteMethod · 0.45
DoDeleteMethod · 0.45
ReadWhileWritingMethod · 0.45

Calls 1

codeFunction · 0.85

Tested by 15

TESTFunction · 0.36
TESTFunction · 0.36
AddMethod · 0.36
TmpDirFunction · 0.36
TESTFunction · 0.36
GetMethod · 0.36
TestKeyFunction · 0.36
ReadMethod · 0.36
CorruptionMethod · 0.36
CorruptMethod · 0.36
TESTFunction · 0.36
PrintContentsFunction · 0.36