Debian Codegraph @

modules/lsp-runtime-lib/include/lsp-plug.in/fmt/json/dom/Boolean.h

raw
1 /*
2 * Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
3 * (C) 2023 Vladimir Sadovnikov <[email protected]>
4 *
5 * This file is part of lsp-runtime-lib
6 * Created on: 13 февр. 2021 г.
7 *
8 * lsp-runtime-lib is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version.
12 *
13 * lsp-runtime-lib is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with lsp-runtime-lib. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 #ifndef LSP_PLUG_IN_FMT_JSON_DOM_BOOLEAN_H_
23 #define LSP_PLUG_IN_FMT_JSON_DOM_BOOLEAN_H_
24
25 #include <lsp-plug.in/runtime/version.h>
26 #include <lsp-plug.in/fmt/json/dom/Node.h>
27
28 namespace lsp
29 {
30 namespace json
31 {
32 /**
33 * JSON node of boolean type
34 */
35 class Boolean: public Node
36 {
37 public:
38 inline Boolean(): Node() {}
39 inline Boolean(const Node &src): Node(src) {}
40 inline Boolean(const Node *src): Node(src) {}
41
42 public:
43 Boolean &operator = (const Node &src) { copy_ref(&src); return *this; }
44 Boolean &operator = (const Node *src) { copy_ref(src); return *this; }
45
46 Boolean &assign(const Node &src) { copy_ref(&src); return *this; }
47 Boolean &assign(const Node *src) { copy_ref(src); return *this; }
48
49 public:
50 virtual bool valid() const;
51
52 virtual status_t create();
53
54 status_t create(bool value);
55
56 static Boolean *allocate(bool value = false);
57
58 static Boolean build(bool value = false);
59
60 public:
61 /**
62 * Try to cast value to Boolean and return the casted value
63 * @return Boolean value or false if cast was unsuccessful
64 */
65 bool get() const;
66
67 /**
68 * Strict get: check that value is of Boolean type and return it
69 * @return Boolean value or false if value is not Boolean
70 */
71 bool sget() const;
72
73 /**
74 * Cast value to Boolean
75 * @return success if value has been successful casted
76 */
77 status_t cast();
78
79 /**
80 * Cast to Boolean and set value
81 * @param value value to set
82 * @return success if property has been set
83 */
84 status_t set(bool value);
85
86 /**
87 * Strict set: check that value is of Boolean type and change it
88 * @param value value to set
89 * @return success if value has been set
90 */
91 status_t sset(bool value);
92 };
93
94 } /* namespace json */
95 } /* namespace lsp */
96
97
98
99 #endif /* LSP_PLUG_IN_FMT_JSON_DOM_BOOLEAN_H_ */