Debian Codegraph @

modules/lsp-runtime-lib/include/lsp-plug.in/i18n/IDictionary.h

raw
1 /*
2 * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
3 * (C) 2020 Vladimir Sadovnikov <[email protected]>
4 *
5 * This file is part of lsp-runtime-lib
6 * Created on: 26 февр. 2020 г.
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_I18N_IDICTIONARY_H_
23 #define LSP_PLUG_IN_I18N_IDICTIONARY_H_
24
25 #include <lsp-plug.in/runtime/version.h>
26 #include <lsp-plug.in/common/status.h>
27 #include <lsp-plug.in/runtime/LSPString.h>
28 #include <lsp-plug.in/io/Path.h>
29
30 namespace lsp
31 {
32 namespace i18n
33 {
34 class IDictionary
35 {
36 private:
37 IDictionary & operator = (const IDictionary &);
38
39 public:
40 explicit IDictionary();
41 virtual ~IDictionary();
42
43 public:
44 /**
45 * Initialize dictionary
46 * @param path the location of the dictionary
47 * @return status of operation
48 */
49 virtual status_t init(const char *path);
50
51 /**
52 * Initialize dictionary
53 * @param path the location of the dictionary
54 * @return status of operation
55 */
56 virtual status_t init(const LSPString *path);
57
58 /**
59 * Initialize dictionary
60 * @param path the location of the dictionary
61 * @return status of operation
62 */
63 virtual status_t init(const io::Path *path);
64
65 /**
66 * Lookup for a key
67 * @param key non-null UTF-8 encoded key value
68 * @param value pointer to store the value (may be NULL)
69 * @return status of operation
70 */
71 virtual status_t lookup(const char *key, LSPString *value);
72
73 /**
74 * Lookup for a key
75 * @param key non-null key value
76 * @param value pointer to store the value (may be NULL)
77 * @return status of operation
78 */
79 virtual status_t lookup(const LSPString *key, LSPString *value);
80
81 /**
82 * Lookup for a dictionary
83 * @param key non-null UTF-8 encoded key value
84 * @param value pointer to store the value (may be NULL)
85 * @return status of operation
86 */
87 virtual status_t lookup(const char *key, IDictionary **value);
88
89 /**
90 * Lookup for a dictionary
91 * @param key non-null key value
92 * @param value pointer to store the value (may be NULL)
93 * @return status of operation
94 */
95 virtual status_t lookup(const LSPString *key, IDictionary **value);
96
97 /**
98 * Get the element by index of element
99 * @param index index of the element
100 * @param key the key name
101 * @param value pointer to store the value
102 * @return status of operation
103 */
104 virtual status_t get_value(size_t index, LSPString *key, LSPString *value);
105
106 /**
107 * Get the child dictionary by index of element
108 * @param index index of the element
109 * @param key the key name
110 * @param dict dictionary to return
111 * @return pointer to child dictionary or NULL if there is no such child
112 */
113 virtual status_t get_child(size_t index, LSPString *key, IDictionary **dict);
114
115 /**
116 * Return size of dictionary in elements
117 * @return size of dictionary in elements
118 */
119 virtual size_t size();
120 };
121 }
122
123 } /* namespace lsp */
124
125 #endif /* LSP_PLUG_IN_I18N_IDICTIONARY_H_ */