Debian Codegraph @

modules/lsp-runtime-lib/include/lsp-plug.in/fmt/json/dom/Array.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: 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_ARRAY_H_
23 #define LSP_PLUG_IN_FMT_JSON_DOM_ARRAY_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 array type
34 */
35 class Array: public Node
36 {
37 public:
38 inline Array(): Node() {}
39 inline Array(const Node &src): Node(src) {}
40 inline Array(const Node *src): Node(src) {}
41
42 public:
43 Array &operator = (const Node &src) { copy_ref(&src); return *this; }
44 Array &operator = (const Node *src) { copy_ref(src); return *this; }
45
46 Array &assign(const Node &src) { copy_ref(&src); return *this; }
47 Array &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 Array *allocate();
55
56 static Array build();
57
58 public:
59 size_t size() const;
60 size_t capacity() const;
61
62 Node get(size_t index);
63
64 status_t add(const Node *node);
65 status_t add(const Node &node);
66 status_t append(const Node *node);
67 status_t append(const Node &node);
68 status_t prepend(const Node *node);
69 status_t prepend(const Node &node);
70 status_t insert(size_t index, const Node *node);
71 status_t insert(size_t index, const Node &node);
72 status_t remove(size_t index);
73 status_t remove_n(size_t index, size_t count);
74 };
75 }
76 }
77
78
79 #endif /* LSP_PLUG_IN_FMT_JSON_DOM_ARRAY_H_ */