|
1 | 1 | /* |
2 | | - * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/> |
3 | | - * (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com> |
| 2 | + * Copyright (C) 2025 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 | + * (C) 2025 Vladimir Sadovnikov <sadko4u@gmail.com> |
4 | 4 | * |
5 | 5 | * This file is part of lsp-runtime-lib |
6 | 6 | * Created on: 16 сент. 2019 г. |
@@ -141,11 +141,86 @@ namespace lsp |
141 | 141 | */ |
142 | 142 | void destroy_value(value_t *value); |
143 | 143 |
|
| 144 | + /** |
| 145 | + * Ensure that value is integer and read it |
| 146 | + * @param dst pointer to store value |
| 147 | + * @param v value to read |
| 148 | + * @return status STATUS_BAD_TYPE error code on type mismatch |
| 149 | + */ |
144 | 150 | status_t fetch_int(ssize_t *dst, const value_t *v); |
| 151 | + |
| 152 | + /** |
| 153 | + * Ensure that value is floating-point and read it |
| 154 | + * @param dst pointer to store value |
| 155 | + * @param v value to read |
| 156 | + * @return status STATUS_BAD_TYPE error code on type mismatch |
| 157 | + */ |
145 | 158 | status_t fetch_float(float *dst, const value_t *v); |
| 159 | + |
| 160 | + /** |
| 161 | + * Ensure that value is floating-point and read it |
| 162 | + * @param dst pointer to store value |
| 163 | + * @param v value to read |
| 164 | + * @return status STATUS_BAD_TYPE error code on type mismatch |
| 165 | + */ |
| 166 | + status_t fetch_float(double *dst, const value_t *v); |
| 167 | + |
| 168 | + /** |
| 169 | + * Ensure that value is boolean and read it |
| 170 | + * @param dst pointer to store value |
| 171 | + * @param v value to read |
| 172 | + * @return status STATUS_BAD_TYPE error code on type mismatch |
| 173 | + */ |
146 | 174 | status_t fetch_bool(bool *dst, const value_t *v); |
| 175 | + |
| 176 | + /** |
| 177 | + * Ensure that value is string and read it |
| 178 | + * @param dst pointer to store value |
| 179 | + * @param v value to read |
| 180 | + * @return status STATUS_BAD_TYPE error code on type mismatch |
| 181 | + */ |
147 | 182 | status_t fetch_string(LSPString *dst, const value_t *v); |
148 | 183 |
|
| 184 | + /** |
| 185 | + * Try to cast value to int and fetch it |
| 186 | + * @param dst pointer to store value |
| 187 | + * @param v value to read |
| 188 | + * @return status of operation |
| 189 | + */ |
| 190 | + status_t fetch_as_int(ssize_t *dst, const value_t *v); |
| 191 | + |
| 192 | + /** |
| 193 | + * Try to cast value to floating-pont value and fetch it |
| 194 | + * @param dst pointer to store value |
| 195 | + * @param v value to read |
| 196 | + * @return status of operation |
| 197 | + */ |
| 198 | + status_t fetch_as_float(float *dst, const value_t *v); |
| 199 | + |
| 200 | + /** |
| 201 | + * Try to cast value to floating-pont value and fetch it |
| 202 | + * @param dst pointer to store value |
| 203 | + * @param v value to read |
| 204 | + * @return status of operation |
| 205 | + */ |
| 206 | + status_t fetch_as_float(double *dst, const value_t *v); |
| 207 | + |
| 208 | + /** |
| 209 | + * Try to cast value to boolean value and fetch it |
| 210 | + * @param dst pointer to store value |
| 211 | + * @param v value to read |
| 212 | + * @return status of operation |
| 213 | + */ |
| 214 | + status_t fetch_as_bool(bool *dst, const value_t *v); |
| 215 | + |
| 216 | + /** |
| 217 | + * Try to cast value to string and fetch it |
| 218 | + * @param dst pointer to store value |
| 219 | + * @param v value to read |
| 220 | + * @return status of operation |
| 221 | + */ |
| 222 | + status_t fetch_as_string(LSPString *dst, const value_t *v); |
| 223 | + |
149 | 224 | status_t cast_value(value_t *v, value_type_t type); |
150 | 225 | status_t cast_value(value_t *dst, const value_t *v, value_type_t type); |
151 | 226 |
|
|
0 commit comments