| 10 | // when reading its value as a std::string |
| 11 | |
| 12 | class StringVariable { |
| 13 | public: |
| 14 | EXPORT StringVariable() : _value(""){}; |
| 15 | EXPORT StringVariable(std::string str) : _value(std::move(str)){}; |
| 16 | EXPORT StringVariable(const char *str) : _value(str){}; |
| 17 | EXPORT operator std::string() const; |
| 18 | EXPORT operator QVariant() const; |
| 19 | EXPORT void operator=(std::string); |
| 20 | EXPORT void operator=(const char *value); |
| 21 | EXPORT const char *c_str(); |
| 22 | EXPORT const char *c_str() const; |
| 23 | EXPORT bool empty() const; |
| 24 | |
| 25 | EXPORT const std::string &UnresolvedValue() const { return _value; } |
| 26 | |
| 27 | EXPORT void Load(obs_data_t *obj, const char *name); |
| 28 | EXPORT void Save(obs_data_t *obj, const char *name) const; |
| 29 | |
| 30 | EXPORT void ResolveVariables(); |
| 31 | |
| 32 | private: |
| 33 | void Resolve() const; |
| 34 | |
| 35 | std::string _value = ""; |
| 36 | mutable std::string _resolvedValue = ""; |
| 37 | mutable std::chrono::high_resolution_clock::time_point _lastResolve{}; |
| 38 | }; |
| 39 | |
| 40 | std::string SubstitueVariables(std::string str); |
| 41 | |