| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * This file is part of the Falcon Player (FPP) and is Copyright (C) | ||
| 4 | * 2013-2022 by the Falcon Player Developers. | ||
| 5 | * | ||
| 6 | * The Falcon Player (FPP) is free software, and is covered under | ||
| 7 | * multiple Open Source licenses. Please see the included 'LICENSES' | ||
| 8 | * file for descriptions of what files are covered by each license. | ||
| 9 | * | ||
| 10 | * This source file is covered under the LGPL v2.1 as described in the | ||
| 11 | * included LICENSE.LGPL file. | ||
| 12 | */ | ||
| 13 | |||
| 14 | // PLUGIN ABI: native plugins compile against this header and are loaded with | ||
| 15 | // dlopen(), so parts of it are baked into binaries FPP did not build. | ||
| 16 | // - ExpressionProcessor::ExpressionVariable is `new`ed by plugins, so its | ||
| 17 | // size and members are fixed (it has no pimpl; ExpressionProcessor does). | ||
| 18 | // Any such change must bump FPP_PLUGIN_API_VERSION in Plugin.h. Without the | ||
| 19 | // bump, a plugin built against the previous header still loads and silently | ||
| 20 | // uses the old layout - FPP 10.2 shipped exactly that and crash-looped fppd. | ||
| 21 | // See .claude/PLUGIN-ABI.md for which plugins use what. | ||
| 22 | |||
| 23 | #include <string> | ||
| 24 | |||
| 25 | class ExpressionProcessorData; | ||
| 26 | |||
| 27 | class ExpressionProcessor { | ||
| 28 | public: | ||
| 29 | class ExpressionVariable { | ||
| 30 | public: | ||
| 31 | ExpressionVariable(const std::string& n); | ||
| 32 | ~ExpressionVariable(); | ||
| 33 | 186732 | const std::string& getName() const { return name; }; | |
| 34 | |||
| 35 | void setValue(const std::string& s); | ||
| 36 | 2 | const std::string& getValue() const { return sValue; }; | |
| 37 | |||
| 38 | private: | ||
| 39 | std::string name; | ||
| 40 | std::string sValue; | ||
| 41 | double dValue; | ||
| 42 | |||
| 43 | friend class ExpressionProcessorData; | ||
| 44 | }; | ||
| 45 | |||
| 46 | ExpressionProcessor(); | ||
| 47 | ~ExpressionProcessor(); | ||
| 48 | |||
| 49 | // the ExpressionVariable MUST be locked in memory | ||
| 50 | // as the address of the values may be used directly | ||
| 51 | void bindVariable(ExpressionVariable* var); | ||
| 52 | bool compile(const std::string& s); | ||
| 53 | |||
| 54 | std::string evaluate(const std::string& type); | ||
| 55 | |||
| 56 | private: | ||
| 57 | ExpressionProcessorData* data; | ||
| 58 | }; | ||
| 59 |