Debian Codegraph @

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

raw
1 /*
2 * Copyright (C) 2021 Linux Studio Plugins Project <https://lsp-plug.in/>
3 * (C) 2021 Vladimir Sadovnikov <[email protected]>
4 *
5 * This file is part of lsp-runtime-lib
6 * Created on: 14 февр. 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_OBJECT_H_
23 #define LSP_PLUG_IN_FMT_JSON_DOM_OBJECT_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 object type
34 */
35 class Object: public Node
36 {
37 public:
38 inline Object(): Node() {}
39 inline Object(const Node &src): Node(src) {}
40 inline Object(const Node *src): Node(src) {}
41
42 public:
43 Object &operator = (const Node &src) { copy_ref(&src); return *this; }
44 Object &operator = (const Node *src) { copy_ref(src); return *this; }
45
46 Object &assign(const Node &src) { copy_ref(&src); return *this; }
47 Object &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 static Object *allocate();
55
56 static Object build();
57
58 public:
59 size_t size() const;
60 size_t capacity() const;
61
62 Node get(const char *field);
63 Node get(const LSPString *field);
64
65 bool contains(const char *field) const;
66 bool contains(const LSPString *field) const;
67
68 status_t remove(const char *field);
69 status_t remove(const LSPString *field);
70
71 status_t set(const char *field, const Node *node);
72 status_t set(const LSPString *field, const Node *node);
73
74 status_t set(const char *field, const Node &node);
75 status_t set(const LSPString *field, const Node &node);
76
77 status_t fields(lltl::parray<LSPString> *list);
78 };
79 }
80 }
81
82 #endif /* LSP_PLUG_IN_FMT_JSON_DOM_OBJECT_H_ */