| 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: 30 апр. 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_FMT_CONFIG_ICONFIGHANDLER_H_ |
| 23 |
#define LSP_PLUG_IN_FMT_CONFIG_ICONFIGHANDLER_H_ |
| 24 |
|
| 25 |
#include <lsp-plug.in/runtime/version.h> |
| 26 |
#include <lsp-plug.in/common/status.h> |
| 27 |
#include <lsp-plug.in/fmt/config/types.h> |
| 28 |
|
| 29 |
namespace lsp |
| 30 |
{ |
| 31 |
namespace config |
| 32 |
{ |
| 33 |
/** |
| 34 |
* Configuration handler |
| 35 |
*/ |
| 36 |
class IConfigHandler |
| 37 |
{ |
| 38 |
public: |
| 39 |
explicit IConfigHandler(); |
| 40 |
IConfigHandler(const IConfigHandler &) = delete; |
| 41 |
IConfigHandler(IConfigHandler &&) = delete; |
| 42 |
virtual ~IConfigHandler(); |
| 43 |
|
| 44 |
IConfigHandler & operator = (const IConfigHandler &) = delete; |
| 45 |
IConfigHandler & operator = (IConfigHandler &&) = delete; |
| 46 |
|
| 47 |
public: |
| 48 |
/** |
| 49 |
* Indicates begin of parsing config |
| 50 |
* @return status of operation |
| 51 |
*/ |
| 52 |
virtual status_t start(); |
| 53 |
|
| 54 |
/** |
| 55 |
* Indicates end of parsing config |
| 56 |
* @param res final result |
| 57 |
* @return status of operation |
| 58 |
*/ |
| 59 |
virtual status_t finish(status_t res); |
| 60 |
|
| 61 |
/** |
| 62 |
* Handle parameter. By default it dispatches calls to other handle_* methods |
| 63 |
* @param param parameter to handle |
| 64 |
* @return status of operation |
| 65 |
*/ |
| 66 |
virtual status_t handle(const param_t *param); |
| 67 |
|
| 68 |
virtual status_t handle_i32(const LSPString *name, int32_t value, size_t flags); |
| 69 |
|
| 70 |
virtual status_t handle_u32(const LSPString *name, uint32_t value, size_t flags); |
| 71 |
|
| 72 |
virtual status_t handle_f32(const LSPString *name, float value, size_t flags); |
| 73 |
|
| 74 |
virtual status_t handle_i64(const LSPString *name, int64_t value, size_t flags); |
| 75 |
|
| 76 |
virtual status_t handle_u64(const LSPString *name, uint64_t value, size_t flags); |
| 77 |
|
| 78 |
virtual status_t handle_f64(const LSPString *name, double value, size_t flags); |
| 79 |
|
| 80 |
virtual status_t handle_string(const LSPString *name, const LSPString *value, size_t flags); |
| 81 |
|
| 82 |
virtual status_t handle_bool(const LSPString *name, bool value, size_t flags); |
| 83 |
|
| 84 |
virtual status_t handle_blob(const LSPString *name, const blob_t *value, size_t flags); |
| 85 |
|
| 86 |
}; |
| 87 |
|
| 88 |
} /* namespace config */ |
| 89 |
} /* namespace lsp */ |
| 90 |
|
| 91 |
#endif /* LSP_PLUG_IN_FMT_CONFIG_ICONFIGHANDLER_H_ */ |