CoolFace
Datasetpublic

dlxjj/imradv3

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes262downloads
binding_eval.h35 linesDownload Raw Back to src
1#pragma once2#include "binding_property.h"3#include "cppgen.h"4 5template <class T>6T bindable<T>::eval(const UIContext& ctx) const {7    if (empty())8        return {};9    if (has_value())10        return value();11    const auto *var = ctx.codeGen->GetVar(str);12    if (var) {13        T val;14        std::istringstream is(var->init);15        if (is >> std::boolalpha >> val)16            return val;17    }18    return {};19}20 21template <class T>22T field_ref<T>::eval(const UIContext &ctx) const23{24    if (empty())25        return {};26    const auto *var = ctx.codeGen->GetVar(str);27    if (!var)28        return {};29    T val;30    std::istringstream is(var->init);31    if (is >> std::boolalpha >> val)32        return val;33    return {};34}35