Flutter Engine
The Flutter Engine
fml
status.h
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef FLUTTER_FML_STATUS_H_
6
#define FLUTTER_FML_STATUS_H_
7
8
#include <string_view>
9
10
namespace
fml
{
11
12
enum class
StatusCode
{
13
kOk
,
14
kCancelled
,
15
kUnknown,
16
kInvalidArgument,
17
kDeadlineExceeded
,
18
kNotFound
,
19
kAlreadyExists
,
20
kPermissionDenied
,
21
kResourceExhausted
,
22
kFailedPrecondition
,
23
kAborted
,
24
kOutOfRange
,
25
kUnimplemented
,
26
kInternal
,
27
kUnavailable
,
28
kDataLoss
,
29
kUnauthenticated
30
};
31
32
/// Class that represents the resolution of the execution of a procedure. This
33
/// is used similarly to how exceptions might be used, typically as the return
34
/// value to a synchronous procedure or an argument to an asynchronous callback.
35
class
Status
final {
36
public
:
37
/// Creates an 'ok' status.
38
Status
();
39
40
Status
(
fml::StatusCode
code
, std::string_view
message
);
41
42
fml::StatusCode
code
()
const
;
43
44
/// A noop that helps with static analysis tools if you decide to ignore an
45
/// error.
46
void
IgnoreError
()
const
;
47
48
/// @return 'true' when the code is kOk.
49
bool
ok
()
const
;
50
51
std::string_view
message
()
const
;
52
53
private
:
54
fml::StatusCode
code_;
55
std::string_view message_;
56
};
57
58
inline
Status::Status
() : code_(
fml
::
StatusCode
::
kOk
), message_() {}
59
60
inline
Status::Status
(
fml::StatusCode
code
, std::string_view
message
)
61
: code_(
code
), message_(
message
) {}
62
63
inline
fml::StatusCode
Status::code
()
const
{
64
return
code_;
65
}
66
67
inline
void
Status::IgnoreError
()
const
{
68
// noop
69
}
70
71
inline
bool
Status::ok
()
const
{
72
return
code_ ==
fml::StatusCode::kOk
;
73
}
74
75
inline
std::string_view
Status::message
()
const
{
76
return
message_;
77
}
78
79
}
// namespace fml
80
81
#endif
// FLUTTER_FML_STATUS_H_
fml::Status
Definition:
status.h:35
fml::Status::Status
Status()
Creates an 'ok' status.
Definition:
status.h:58
fml::Status::ok
bool ok() const
Definition:
status.h:71
fml::Status::code
fml::StatusCode code() const
Definition:
status.h:63
fml::Status::IgnoreError
void IgnoreError() const
Definition:
status.h:67
fml::Status::message
std::string_view message() const
Definition:
status.h:75
message
Win32Message message
Definition:
keyboard_unittests.cc:139
fml
Definition:
ascii_trie.cc:9
fml::StatusCode
StatusCode
Definition:
status.h:12
fml::StatusCode::kFailedPrecondition
@ kFailedPrecondition
fml::StatusCode::kDataLoss
@ kDataLoss
fml::StatusCode::kDeadlineExceeded
@ kDeadlineExceeded
fml::StatusCode::kResourceExhausted
@ kResourceExhausted
fml::StatusCode::kUnavailable
@ kUnavailable
fml::StatusCode::kUnimplemented
@ kUnimplemented
fml::StatusCode::kInternal
@ kInternal
fml::StatusCode::kCancelled
@ kCancelled
fml::StatusCode::kAlreadyExists
@ kAlreadyExists
fml::StatusCode::kNotFound
@ kNotFound
fml::StatusCode::kAborted
@ kAborted
fml::StatusCode::kUnauthenticated
@ kUnauthenticated
fml::StatusCode::kPermissionDenied
@ kPermissionDenied
fml::StatusCode::kOk
@ kOk
fml::StatusCode::kOutOfRange
@ kOutOfRange
valgrind.code
code
Definition:
valgrind.py:29
Generated on Sun Jun 23 2024 21:54:58 for Flutter Engine by
1.9.4