1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
content / browser / indexed_db / status.cc [blame]
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/indexed_db/status.h"
#include <string>
namespace content::indexed_db {
Status::Status() noexcept = default;
Status::Status(const Status& rhs) noexcept = default;
Status::Status(const leveldb::Status& status) noexcept : status_(status) {}
Status::~Status() = default;
Status& Status::operator=(const Status& rhs) = default;
Status& Status::operator=(const leveldb::Status& rhs) {
status_ = rhs;
return *this;
}
// static
Status Status::OK() {
return Status();
}
// static
Status Status::NotFound(const std::string& msg, const std::string& msg2) {
return Status(leveldb::Status::NotFound(msg, msg2));
}
// static
Status Status::Corruption(const std::string& msg, const std::string& msg2) {
return Status(leveldb::Status::Corruption(msg, msg2));
}
// static
Status Status::NotSupported(const std::string& msg, const std::string& msg2) {
return Status(leveldb::Status::NotSupported(msg, msg2));
}
// static
Status Status::InvalidArgument(const std::string& msg,
const std::string& msg2) {
return Status(leveldb::Status::InvalidArgument(msg, msg2));
}
// static
Status Status::IOError(const std::string& msg, const std::string& msg2) {
return Status(leveldb::Status::IOError(msg, msg2));
}
bool Status::IsNotFound() const {
return status_ && status_->IsNotFound();
}
bool Status::IsCorruption() const {
return status_ && status_->IsCorruption();
}
bool Status::IsIOError() const {
return status_ && status_->IsIOError();
}
bool Status::IsNotSupportedError() const {
return status_ && status_->IsNotSupportedError();
}
bool Status::IsInvalidArgument() const {
return status_ && status_->IsInvalidArgument();
}
std::string Status::ToString() const {
return status_ ? status_->ToString() : "OK";
}
} // namespace content::indexed_db