| 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 |
#include <lsp-plug.in/fmt/config/IConfigHandler.h> |
| 23 |
|
| 24 |
namespace lsp |
| 25 |
{ |
| 26 |
namespace config |
| 27 |
{ |
| 28 |
|
| 29 |
IConfigHandler::IConfigHandler() |
| 30 |
{ |
| 31 |
} |
| 32 |
|
| 33 |
IConfigHandler::~IConfigHandler() |
| 34 |
{ |
| 35 |
} |
| 36 |
|
| 37 |
status_t IConfigHandler::start() |
| 38 |
{ |
| 39 |
return STATUS_OK; |
| 40 |
} |
| 41 |
|
| 42 |
status_t IConfigHandler::finish(status_t res) |
| 43 |
{ |
| 44 |
return res; |
| 45 |
} |
| 46 |
|
| 47 |
status_t IConfigHandler::handle(const param_t *param) |
| 48 |
{ |
| 49 |
if (param == NULL) |
| 50 |
return STATUS_BAD_ARGUMENTS; |
| 51 |
|
| 52 |
switch (param->flags & SF_TYPE_MASK) |
| 53 |
{ |
| 54 |
case SF_TYPE_I32: return handle_i32(¶m->name, param->v.i32, param->flags); |
| 55 |
case SF_TYPE_U32: return handle_u32(¶m->name, param->v.u32, param->flags); |
| 56 |
case SF_TYPE_I64: return handle_i64(¶m->name, param->v.i64, param->flags); |
| 57 |
case SF_TYPE_U64: return handle_u64(¶m->name, param->v.u64, param->flags); |
| 58 |
case SF_TYPE_F32: return handle_f32(¶m->name, param->v.f32, param->flags); |
| 59 |
case SF_TYPE_F64: return handle_f64(¶m->name, param->v.f64, param->flags); |
| 60 |
case SF_TYPE_BOOL: return handle_bool(¶m->name, param->v.bval, param->flags); |
| 61 |
case SF_TYPE_BLOB: return handle_blob(¶m->name, ¶m->v.blob, param->flags); |
| 62 |
case SF_TYPE_STR: |
| 63 |
{ |
| 64 |
LSPString tmp; |
| 65 |
if (!tmp.set_utf8(param->v.str)) |
| 66 |
return STATUS_NO_MEM; |
| 67 |
return handle_string(¶m->name, &tmp, param->flags); |
| 68 |
} |
| 69 |
|
| 70 |
default: |
| 71 |
break; |
| 72 |
} |
| 73 |
|
| 74 |
return STATUS_BAD_TYPE; |
| 75 |
} |
| 76 |
|
| 77 |
status_t IConfigHandler::handle_i32(const LSPString *name, int32_t value, size_t flags) |
| 78 |
{ |
| 79 |
return STATUS_OK; |
| 80 |
} |
| 81 |
|
| 82 |
status_t IConfigHandler::handle_u32(const LSPString *name, uint32_t value, size_t flags) |
| 83 |
{ |
| 84 |
return STATUS_OK; |
| 85 |
} |
| 86 |
|
| 87 |
status_t IConfigHandler::handle_f32(const LSPString *name, float value, size_t flags) |
| 88 |
{ |
| 89 |
return STATUS_OK; |
| 90 |
} |
| 91 |
|
| 92 |
status_t IConfigHandler::handle_i64(const LSPString *name, int64_t value, size_t flags) |
| 93 |
{ |
| 94 |
return STATUS_OK; |
| 95 |
} |
| 96 |
|
| 97 |
status_t IConfigHandler::handle_u64(const LSPString *name, uint64_t value, size_t flags) |
| 98 |
{ |
| 99 |
return STATUS_OK; |
| 100 |
} |
| 101 |
|
| 102 |
status_t IConfigHandler::handle_f64(const LSPString *name, double value, size_t flags) |
| 103 |
{ |
| 104 |
return STATUS_OK; |
| 105 |
} |
| 106 |
|
| 107 |
status_t IConfigHandler::handle_string(const LSPString *name, const LSPString *value, size_t flags) |
| 108 |
{ |
| 109 |
return STATUS_OK; |
| 110 |
} |
| 111 |
|
| 112 |
status_t IConfigHandler::handle_bool(const LSPString *name, bool value, size_t flags) |
| 113 |
{ |
| 114 |
return STATUS_OK; |
| 115 |
} |
| 116 |
|
| 117 |
status_t IConfigHandler::handle_blob(const LSPString *name, const blob_t *value, size_t flags) |
| 118 |
{ |
| 119 |
return STATUS_OK; |
| 120 |
} |
| 121 |
|
| 122 |
} /* namespace config */ |
| 123 |
} /* namespace lsp */ |