| 1 | #ifndef _melder_trust_h_ |
| 2 | #define _melder_trust_h_ |
| 3 | /* melder_trust.h |
| 4 | * |
| 5 | * Copyright (C) 2024,2025 Paul Boersma |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | * See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | /* |
| 22 | SYNOPSIS (2024-12-14) |
| 23 | |
| 24 | Melder_checkTrust (interpreter, args...); |
| 25 | */ |
| 26 | |
| 27 | namespace MelderTrust { |
| 28 | extern MelderString _buffer; |
| 29 | using Proc = void (*) (void *void_interpreter, conststring32 message); |
| 30 | void _defaultProc (void *void_interpreter, conststring32 message); |
| 31 | extern Proc _p_currentProc; |
| 32 | } |
| 33 | |
| 34 | template <typename... Arg> |
| 35 | void Melder_checkTrust (void *void_interpreter, const Arg... arg) { |
| 36 | MelderString_copy (& MelderTrust::_buffer, arg...); |
| 37 | (*MelderTrust::_p_currentProc) (void_interpreter, MelderTrust::_buffer.string); |
| 38 | } |
| 39 | |
| 40 | void Melder_setTrustProc (MelderTrust::Proc p_proc); |
| 41 | |
| 42 | /* End of file melder_trust.h */ |
| 43 | #endif |