Debian Codegraph @

modules/lsp-runtime-lib/include/lsp-plug.in/fmt/json/dom/Double.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_DOUBLE_H_
23 #define LSP_PLUG_IN_FMT_JSON_DOM_DOUBLE_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 floating-point type
34 */
35 class Double: public Node
36 {
37 public:
38 inline Double(): Node() {}
39 inline Double(const Node &src): Node(src) {}
40 inline Double(const Node *src): Node(src) {}
41
42 public:
43 Double &operator = (const Node &src) { copy_ref(&src); return *this; }
44 Double &operator = (const Node *src) { copy_ref(src); return *this; }
45
46 Double &assign(const Node &src) { copy_ref(&src); return *this; }
47 Double &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(double value);
55
56 static Double *allocate(double value = 0.0);
57
58 static Double build(double value = 0.0);
59
60 public:
61 /**
62 * Try to cast value to Double and return the casted value
63 * @return Double value or 0 if cast was unsuccessful
64 */
65 double get() const;
66
67 /**
68 * Strict get: check that value is of Double type and return it
69 * @return Double value or 0 if value is not Double
70 */
71 double sget() const;
72
73 /**
74 * Cast value to Double
75 * @return success if value has been successful casted
76 */
77 status_t cast();
78
79 /**
80 * Cast to Double and set value
81 * @param value value to set
82 * @return success if property has been set
83 */
84 status_t set(double value);
85
86 /**
87 * Strict set: check that value is of Double type and change it
88 * @param value value to set
89 * @return success if value has been set
90 */
91 status_t sset(double value);
92 };
93
94 } /* namespace json */
95 } /* namespace lsp */
96
97
98
99 #endif /* LSP_PLUG_IN_FMT_JSON_DOM_DOUBLE_H_ */