LIEF: Library to Instrument Executable Formats
Version 1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
optional.hpp
Go to the documentation of this file.
1
/* Copyright 2021 - 2026 R. Thomas
2
* Copyright 2021 - 2026 Quarkslab
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
#ifndef LIEF_OPTIONAL_H
17
#define LIEF_OPTIONAL_H
18
#include "
LIEF/errors.hpp
"
19
20
namespace
LIEF
{
21
22
template
<
class
T>
23
class
optional
:
public
result
<T> {
24
public
:
25
using
result
<T>
::result
;
26
27
optional
() :
28
result
<T>(tl::make_unexpected(
lief_errors
::
not_found
))
29
{}
30
31
void
reset
() noexcept {
32
new
(
this
)
optional
();
33
}
34
};
35
36
inline
tl::unexpected<lief_errors>
nullopt
() {
37
return
make_error_code
(
lief_errors::not_found
);
38
}
39
40
}
41
42
#endif
LIEF::optional::reset
void reset() noexcept
Definition
optional.hpp:31
LIEF::optional::optional
optional()
Definition
optional.hpp:27
LIEF::result
Wrapper that contains an Object (T) or an error.
Definition
errors.hpp:75
errors.hpp
lief_errors
lief_errors
LIEF error codes definition.
Definition
errors.hpp:23
lief_errors::not_found
@ not_found
Definition
errors.hpp:25
make_error_code
tl::unexpected< lief_errors > make_error_code(lief_errors e)
Create an standard error code from lief_errors.
Definition
errors.hpp:52
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
LIEF::nullopt
tl::unexpected< lief_errors > nullopt()
Definition
optional.hpp:36
Generated by
1.17.0