File tree Expand file tree Collapse file tree 3 files changed +8
-37
lines changed Expand file tree Collapse file tree 3 files changed +8
-37
lines changed Original file line number Diff line number Diff line change 4
4
5
5
#pragma once
6
6
7
- #include < ArduinoJson/Misc/SafeBoolIdiom.hpp>
8
7
#include < ArduinoJson/Namespace.hpp>
9
8
#include < ArduinoJson/Polyfills/pgmspace_generic.hpp>
10
9
#include < ArduinoJson/Polyfills/preprocessor.hpp>
15
14
16
15
namespace ARDUINOJSON_NAMESPACE {
17
16
18
- class DeserializationError : public SafeBoolIdom <DeserializationError> {
17
+ class DeserializationError {
19
18
public:
20
19
enum Code {
21
20
Ok,
@@ -53,9 +52,9 @@ class DeserializationError : public SafeBoolIdom<DeserializationError> {
53
52
return lhs != rhs._code ;
54
53
}
55
54
56
- // Behaves like a bool
57
- operator bool_type () const {
58
- return _code != Ok ? safe_true () : safe_false () ;
55
+ // Returns true if there is an error
56
+ explicit operator bool () const {
57
+ return _code != Ok;
59
58
}
60
59
61
60
// Returns internal enum, useful for switch statement
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 4
4
5
5
#pragma once
6
6
7
- #include < ArduinoJson/Misc/SafeBoolIdiom.hpp>
8
-
9
7
#if ARDUINOJSON_ENABLE_STD_STREAM
10
8
# include < ostream>
11
9
#endif
@@ -14,7 +12,7 @@ namespace ARDUINOJSON_NAMESPACE {
14
12
15
13
// A string.
16
14
// https://arduinojson.org/v6/api/jsonstring/
17
- class JsonString : public SafeBoolIdom <JsonString> {
15
+ class JsonString {
18
16
public:
19
17
enum Ownership { Copied, Linked };
20
18
@@ -47,9 +45,9 @@ class JsonString : public SafeBoolIdom<JsonString> {
47
45
return _size;
48
46
}
49
47
50
- // safe bool idiom
51
- operator bool_type () const {
52
- return _data ? safe_true () : safe_false () ;
48
+ // Returns true if the string is non-null
49
+ explicit operator bool () const {
50
+ return _data != 0 ;
53
51
}
54
52
55
53
// Returns true if strings are equal.
You can’t perform that action at this time.
0 commit comments