• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / mender-flash / 1298953322

21 May 2024 10:48AM UTC coverage: 67.203% (-24.7%) from 91.892%
1298953322

push

gitlab-ci

kacf
chore: Update license copyright to 2024

Signed-off-by: Lluis Campos <lluis.campos@northern.tech>
(cherry picked from commit a141966fa)

209 of 311 relevant lines covered (67.2%)

12.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/common/expected.hpp
1
// Copyright 2023 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
#ifndef MENDER_COMMON_EXPECTED_HPP
16
#define MENDER_COMMON_EXPECTED_HPP
17

18
#ifdef __cpp_lib_expected
19
#include <expected>
20
#else
21
#include <tl/expected.hpp>
22
#endif
23

24
#include <common/error.hpp>
25

26
#include <cassert>
27
#include <cstdint>
28
#include <string>
29
#include <vector>
30

31

32
namespace mender {
33
namespace common {
34
namespace expected {
35

36
using namespace std;
37

38
#ifdef __cpp_lib_expected
39
using std::expected;
40
using std::unexpected;
41
#else
42
using tl::expected;
43
template <typename V>
44
tl::unexpected<V> unexpected(V &&v) {
×
45
        return tl::make_unexpected(v);
×
46
}
47
template <typename V>
48
tl::unexpected<V> unexpected(V &v) {
49
        return tl::make_unexpected(v);
50
}
51
#endif
52

53
using ExpectedString = expected<string, error::Error>;
54
using ExpectedBytes = expected<vector<uint8_t>, error::Error>;
55
using ExpectedInt = expected<int, error::Error>;
56
using ExpectedBool = expected<bool, error::Error>;
57
using ExpectedSize = expected<size_t, error::Error>;
58
using ExpectedSize = expected<size_t, error::Error>;
59
using ExpectedBool = expected<bool, error::Error>;
60
using ExpectedLong = expected<long, error::Error>;
61
using ExpectedLongLong = expected<long long, error::Error>;
62

63
} // namespace expected
64
} // namespace common
65
} // namespace mender
66

67
#endif // MENDER_COMMON_EXPECTED_HPP
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc