Debian Codegraph @

modules/lsp-runtime-lib/include/lsp-plug.in/resource/Environment.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_RESOURCE_ENVIRONMENT_H_
23 #define LSP_PLUG_IN_RESOURCE_ENVIRONMENT_H_
24
25 #include <lsp-plug.in/runtime/version.h>
26 #include <lsp-plug.in/runtime/LSPString.h>
27 #include <lsp-plug.in/common/status.h>
28 #include <lsp-plug.in/lltl/pphash.h>
29
30 namespace lsp
31 {
32 namespace resource
33 {
34 /**
35 * Key-value environment variables (adaptor around lltl::pphash)
36 */
37 class Environment
38 {
39 private:
40 Environment &operator = (const Environment &);
41 Environment(const Environment &);
42
43 protected:
44 lltl::pphash<LSPString, LSPString> vEnv;
45
46 public:
47 explicit Environment();
48 ~Environment();
49
50 public:
51 const LSPString *get(const char *key) const;
52 const LSPString *get(const LSPString *key) const;
53 const LSPString *get(const LSPString *key, const LSPString *dfl) const;
54
55 const char *get_utf8(const char *key) const;
56 const char *get_utf8(const char *key, const char *dfl) const;
57 const char *get_utf8(const LSPString *key) const;
58
59 bool contains(const char *key) const;
60 bool contains(const LSPString *key) const;
61
62 status_t set(const char *key, const char *value);
63 status_t set(const char *key, const LSPString *value);
64 status_t set(const LSPString *key, const char *value);
65 status_t set(const LSPString *key, const LSPString *value);
66
67 status_t remove(const char *key);
68 status_t remove(const LSPString *key);
69
70 Environment *clone();
71 };
72 }
73 }
74
75
76 #endif /* LSP_PLUG_IN_RESOURCE_ENVIRONMENT_H_ */