// This code is auto-generated by Qul's qmltocpp tool from the file 'QulPerfOverlay.qml'
// WARNING! All changes made in this file will be lost!
#include "QulPerfOverlay.h"
#include <qul/private/graphicsdevice.h>
#include <qul/private/filecache.h>

#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#endif

static const Qul::Private::String qulCurrentFileDir(".", 1);
namespace QtQuickUltralite {
namespace Profiling {
extern Qul::Private::Items::ItemBase *loaderItemAllocator(const Qul::Private::String &uri, const Qul::Private::String &currentFileDir);

} // namespace QtQuickUltralite
} // namespace Profiling
namespace Qul { namespace Private {
Qul::Property<int> &translationIndexProperty_main();
extern uint32_t qul_translation_base_offset_be9aa6e1a7520af9f0e32c1ba4a559169b2db7db();
extern const char *qul_translation_string(int lang, uint32_t base, int entry);
}}

namespace QtQuickUltralite {
namespace Profiling {

namespace {
#if defined(QUL_CC_IAR)
#pragma diag_suppress=Pe177 // declared but never referenced
#elif defined(QUL_CC_GNU)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
static Qul::Property<int> &translationIndexProperty() { return Qul::Private::translationIndexProperty_main(); }
static int translationIndex() { return translationIndexProperty().value(); }
static const char *qul_translation(int entry) {
    const uint32_t base_offset = Qul::Private::qul_translation_base_offset_be9aa6e1a7520af9f0e32c1ba4a559169b2db7db();
    return Qul::Private::qul_translation_string(translationIndex(), base_offset, entry);
}
#if defined(QUL_CC_IAR)
#pragma diag_default=Pe177 // declared but never referenced
#elif defined(QUL_CC_GNU)
#pragma GCC diagnostic pop
#endif
}



void QulPerfOverlay::QulPerfOverlay_72506259_bindingFunctor::operator()(bool visible) const
{
    QUL_DECL_UNUSED Qul::Private::Items::Console * r8 = NULL;
    bool r2 = false;
    int r2__totalFrames = 0;
    QUL_DECL_UNUSED Qul::Private::QulPerf * r2_3 = NULL;
    QUL_DECL_UNUSED Qul::Private::String r2_1;
    QUL_DECL_UNUSED Qul::Private::Items::Console * r2_2 = NULL;
    Qul::qreal r2__averageFps = 0.0;
    int r12__maxHeapUsage = 0;
    QUL_DECL_UNUSED Qul::Private::String r12;
    Qul::qreal r14__averageCpuLoad = 0.0;
    QUL_DECL_UNUSED Qul::Private::String r11;
    int r17 = 0;
    QUL_DECL_UNUSED Qul::Private::String r13;
    Qul::qreal r13__averageFps = 0.0;
    int r16 = 0;
    QUL_UNUSED(visible);
    // if (visible) {
    // line 11  "QulPerfOverlay.qml"
    r2 = visible;
    if (!r2) {
    goto label_0;};
    // console.log("Benchmark Results:");
    // line 12  "QulPerfOverlay.qml"
    r2_2 = Qul::Private::Builtins::GlobalObject::console.value();
    r8 = r2_2;
    r2_1 = Qul::Private::String(Qul::Private::Latin1String("Benchmark Results:", 18));
    r11 = r2_1;
    r8->log(r11);
    // console.log("Total frames:    ", QulPerf.totalFrames);
    // line 13  "QulPerfOverlay.qml"
    r2_2 = Qul::Private::Builtins::GlobalObject::console.value();
    r8 = r2_2;
    r2_1 = Qul::Private::String(Qul::Private::Latin1String("Total frames:    ", 17));
    r11 = r2_1;
    r2_3 = &Qul::Private::QulPerf ::instance();
    r2__totalFrames = r2_3->totalFrames.value();
    r12__maxHeapUsage = r2__totalFrames;
    r8->log(r11, r12__maxHeapUsage);
    // console.log("Average fps:     ", QulPerf.averageFps.toFixed(2));
    // line 14  "QulPerfOverlay.qml"
    r2_2 = Qul::Private::Builtins::GlobalObject::console.value();
    r8 = r2_2;
    r2_1 = Qul::Private::String(Qul::Private::Latin1String("Average fps:     ", 17));
    r11 = r2_1;
    r2_3 = &Qul::Private::QulPerf ::instance();
    r2__averageFps = r2_3->averageFps.value();
    r13__averageFps = r2__averageFps;
    r16 = 2;
    r2_1 = Qul::Private::Builtins::Number(r13__averageFps).toFixed(r16);
    r12 = r2_1;
    r8->log(r11, r12);
    // console.log("Minimum fps:     ", QulPerf.minimumFps.toFixed(1));
    // line 15  "QulPerfOverlay.qml"
    r2_2 = Qul::Private::Builtins::GlobalObject::console.value();
    r8 = r2_2;
    r2_1 = Qul::Private::String(Qul::Private::Latin1String("Minimum fps:     ", 17));
    r11 = r2_1;
    r2_3 = &Qul::Private::QulPerf ::instance();
    r2__averageFps = r2_3->minimumFps.value();
    r13__averageFps = r2__averageFps;
    r16 = 1;
    r2_1 = Qul::Private::Builtins::Number(r13__averageFps).toFixed(r16);
    r12 = r2_1;
    r8->log(r11, r12);
    // console.log("Max heap usage:  ", QulPerf.maxHeapUsage, "Bytes");
    // line 16  "QulPerfOverlay.qml"
    r2_2 = Qul::Private::Builtins::GlobalObject::console.value();
    r8 = r2_2;
    r2_1 = Qul::Private::String(Qul::Private::Latin1String("Max heap usage:  ", 17));
    r11 = r2_1;
    r2_3 = &Qul::Private::QulPerf ::instance();
    r2__totalFrames = r2_3->maxHeapUsage.value();
    r12__maxHeapUsage = r2__totalFrames;
    r2_1 = Qul::Private::String(Qul::Private::Latin1String("Bytes", 5));
    r13 = r2_1;
    r8->log(r11, r12__maxHeapUsage, r13);
    // console.log("Max stack usage: ", QulPerf.maxStackUsage, "Bytes");
    // line 17  "QulPerfOverlay.qml"
    r2_2 = Qul::Private::Builtins::GlobalObject::console.value();
    r8 = r2_2;
    r2_1 = Qul::Private::String(Qul::Private::Latin1String("Max stack usage: ", 17));
    r11 = r2_1;
    r2_3 = &Qul::Private::QulPerf ::instance();
    r2__totalFrames = r2_3->maxStackUsage.value();
    r12__maxHeapUsage = r2__totalFrames;
    r2_1 = Qul::Private::String(Qul::Private::Latin1String("Bytes", 5));
    r13 = r2_1;
    r8->log(r11, r12__maxHeapUsage, r13);
    /*
    console.log("Average CPU load:", QulPerf.averageCpuLoad.toFixed(1), "%");
    }
    */
    // line 18  "QulPerfOverlay.qml"
    r2_2 = Qul::Private::Builtins::GlobalObject::console.value();
    r8 = r2_2;
    r2_1 = Qul::Private::String(Qul::Private::Latin1String("Average CPU load:", 17));
    r11 = r2_1;
    r2_3 = &Qul::Private::QulPerf ::instance();
    r2__averageFps = r2_3->averageCpuLoad.value();
    r14__averageCpuLoad = r2__averageFps;
    r17 = 1;
    r2_1 = Qul::Private::Builtins::Number(r14__averageCpuLoad).toFixed(r17);
    r12 = r2_1;
    r2_1 = Qul::Private::String(Qul::Private::Latin1String("%", 1));
    r13 = r2_1;
    r8->log(r11, r12, r13);
    {
    }
    label_0:;
    // }
    // line 20  "QulPerfOverlay.qml"
    return ;
    
}
Qul::Private::String QulPerfOverlay::QulPerfOverlay_54254267_bindingFunctor::operator()(QulPerfOverlay *self) const
{
    (void) self;
    int r2__totalFrames = 0;
    QUL_DECL_UNUSED Qul::Private::QulPerf * r2_2 = NULL;
    QUL_DECL_UNUSED Qul::Private::String r2;
    QUL_DECL_UNUSED Qul::Private::String r7;
    // text: "Total frames: " + QulPerf.totalFrames
    // line 24  "QulPerfOverlay.qml"
    r2 = Qul::Private::String(Qul::Private::Latin1String("Total frames: ", 14));
    r7 = r2;
    r2_2 = &Qul::Private::QulPerf ::instance();
    r2__totalFrames = r2_2->totalFrames.value();
    r2 = r7 + Qul::Private::Builtins::Number(r2__totalFrames).toString();
    return r2;
    
}
Qul::Private::String QulPerfOverlay::QulPerfOverlay_1085534217_bindingFunctor::operator()(QulPerfOverlay *self) const
{
    (void) self;
    Qul::qreal r8__averageFps = 0.0;
    QUL_DECL_UNUSED Qul::Private::QulPerf * r2_2 = NULL;
    QUL_DECL_UNUSED Qul::Private::String r2;
    Qul::qreal r2__averageFps = 0.0;
    int r11 = 0;
    QUL_DECL_UNUSED Qul::Private::String r7;
    // text: "Average fps: " + QulPerf.averageFps.toFixed(2)
    // line 29  "QulPerfOverlay.qml"
    r2 = Qul::Private::String(Qul::Private::Latin1String("Average fps: ", 13));
    r7 = r2;
    r2_2 = &Qul::Private::QulPerf ::instance();
    r2__averageFps = r2_2->averageFps.value();
    r8__averageFps = r2__averageFps;
    r11 = 2;
    r2 = Qul::Private::Builtins::Number(r8__averageFps).toFixed(r11);
    r2 = r7 + r2;
    return r2;
    
}
Qul::Private::String QulPerfOverlay::QulPerfOverlay_607444706_bindingFunctor::operator()(QulPerfOverlay *self) const
{
    (void) self;
    Qul::qreal r8__minimumFps = 0.0;
    QUL_DECL_UNUSED Qul::Private::QulPerf * r2_2 = NULL;
    QUL_DECL_UNUSED Qul::Private::String r2;
    Qul::qreal r2__minimumFps = 0.0;
    int r11 = 0;
    QUL_DECL_UNUSED Qul::Private::String r7;
    // text: "Minimum fps: " + QulPerf.minimumFps.toFixed(1)
    // line 34  "QulPerfOverlay.qml"
    r2 = Qul::Private::String(Qul::Private::Latin1String("Minimum fps: ", 13));
    r7 = r2;
    r2_2 = &Qul::Private::QulPerf ::instance();
    r2__minimumFps = r2_2->minimumFps.value();
    r8__minimumFps = r2__minimumFps;
    r11 = 1;
    r2 = Qul::Private::Builtins::Number(r8__minimumFps).toFixed(r11);
    r2 = r7 + r2;
    return r2;
    
}
Qul::Private::String QulPerfOverlay::QulPerfOverlay_1552127337_bindingFunctor::operator()(QulPerfOverlay *self) const
{
    (void) self;
    QUL_DECL_UNUSED Qul::Private::String r8;
    int r2__maxHeapUsage = 0;
    QUL_DECL_UNUSED Qul::Private::QulPerf * r2_2 = NULL;
    QUL_DECL_UNUSED Qul::Private::String r2;
    QUL_DECL_UNUSED Qul::Private::String r7;
    // text: "Max heap usage: " + QulPerf.maxHeapUsage + " Bytes"
    // line 39  "QulPerfOverlay.qml"
    r2 = Qul::Private::String(Qul::Private::Latin1String("Max heap usage: ", 16));
    r7 = r2;
    r2_2 = &Qul::Private::QulPerf ::instance();
    r2__maxHeapUsage = r2_2->maxHeapUsage.value();
    r2 = r7 + Qul::Private::Builtins::Number(r2__maxHeapUsage).toString();
    r8 = r2;
    r2 = Qul::Private::String(Qul::Private::Latin1String(" Bytes", 6));
    r2 = r8 + r2;
    return r2;
    
}
Qul::Private::String QulPerfOverlay::QulPerfOverlay_3726604858_bindingFunctor::operator()(QulPerfOverlay *self) const
{
    (void) self;
    QUL_DECL_UNUSED Qul::Private::String r8;
    int r2__maxStackUsage = 0;
    QUL_DECL_UNUSED Qul::Private::QulPerf * r2_2 = NULL;
    QUL_DECL_UNUSED Qul::Private::String r2;
    QUL_DECL_UNUSED Qul::Private::String r7;
    // text: "Max stack usage: " + QulPerf.maxStackUsage + " Bytes"
    // line 44  "QulPerfOverlay.qml"
    r2 = Qul::Private::String(Qul::Private::Latin1String("Max stack usage: ", 17));
    r7 = r2;
    r2_2 = &Qul::Private::QulPerf ::instance();
    r2__maxStackUsage = r2_2->maxStackUsage.value();
    r2 = r7 + Qul::Private::Builtins::Number(r2__maxStackUsage).toString();
    r8 = r2;
    r2 = Qul::Private::String(Qul::Private::Latin1String(" Bytes", 6));
    r2 = r8 + r2;
    return r2;
    
}
Qul::Private::String QulPerfOverlay::QulPerfOverlay_2511342215_bindingFunctor::operator()(QulPerfOverlay *self) const
{
    (void) self;
    QUL_DECL_UNUSED Qul::Private::String r8;
    Qul::qreal r8__averageCpuLoad = 0.0;
    QUL_DECL_UNUSED Qul::Private::QulPerf * r2_2 = NULL;
    QUL_DECL_UNUSED Qul::Private::String r2;
    Qul::qreal r2__averageCpuLoad = 0.0;
    int r11 = 0;
    QUL_DECL_UNUSED Qul::Private::String r7;
    // text: "Average CPU load: " + QulPerf.averageCpuLoad.toFixed(1) + "%"
    // line 49  "QulPerfOverlay.qml"
    r2 = Qul::Private::String(Qul::Private::Latin1String("Average CPU load: ", 18));
    r7 = r2;
    r2_2 = &Qul::Private::QulPerf ::instance();
    r2__averageCpuLoad = r2_2->averageCpuLoad.value();
    r8__averageCpuLoad = r2__averageCpuLoad;
    r11 = 1;
    r2 = Qul::Private::Builtins::Number(r8__averageCpuLoad).toFixed(r11);
    r2 = r7 + r2;
    r8 = r2;
    r2 = Qul::Private::String(Qul::Private::Latin1String("%", 1));
    r2 = r8 + r2;
    return r2;
    
}

QulPerfOverlay::QulPerfOverlay()

    : ExtraStorage_itemExtraProperties_this_instance(this)
    , _onVisibleChanged_binding(QulPerfOverlay_72506259_bindingFunctor(this), &visible)
    , text__text_binding(QulPerfOverlay_54254267_bindingFunctor())
    , text__2_text_binding(QulPerfOverlay_1085534217_bindingFunctor())
    , text__3_text_binding(QulPerfOverlay_607444706_bindingFunctor())
    , text__4_text_binding(QulPerfOverlay_1552127337_bindingFunctor())
    , text__5_text_binding(QulPerfOverlay_3726604858_bindingFunctor())
    , text__6_text_binding(QulPerfOverlay_2511342215_bindingFunctor())
{
#if __cplusplus < 201103L
    // color: "#ffb6c1"
    // line 23  "QulPerfOverlay.qml"
    text_.color.setValue(0xffffb6c1);
    // color: "#ffb6c1"
    // line 28  "QulPerfOverlay.qml"
    text__2.color.setValue(0xffffb6c1);
    // color: "#ffb6c1"
    // line 33  "QulPerfOverlay.qml"
    text__3.color.setValue(0xffffb6c1);
    // color: "#ffb6c1"
    // line 38  "QulPerfOverlay.qml"
    text__4.color.setValue(0xffffb6c1);
    // color: "#ffb6c1"
    // line 43  "QulPerfOverlay.qml"
    text__5.color.setValue(0xffffb6c1);
    // color: "#ffb6c1"
    // line 48  "QulPerfOverlay.qml"
    text__6.color.setValue(0xffffb6c1);
#else
    using OffsetType4423538195039467471 = Qul::Private::Choose<uint16_t, uint32_t, (UINT16_MAX >
        Qul::Private::Max<offsetof(QulPerfOverlay, text_.color) / 4,
        Qul::Private::Max<offsetof(QulPerfOverlay, text__2.color) / 4,
        Qul::Private::Max<offsetof(QulPerfOverlay, text__3.color) / 4,
        Qul::Private::Max<offsetof(QulPerfOverlay, text__4.color) / 4,
        Qul::Private::Max<offsetof(QulPerfOverlay, text__5.color) / 4,
        Qul::Private::Max<offsetof(QulPerfOverlay, text__6.color) / 4,
        0
        >::V>::V>::V>::V>::V>::V
        )>::Type;
    OffsetType4423538195039467471 propertyOffsets4423538195039467471[] = {
        std::is_same<decltype(text_.color), Qul::Property<Qul::PlatformInterface::Rgba32>>::value ? (offsetof(QulPerfOverlay, text_.color) / 4) : std::numeric_limits<OffsetType4423538195039467471>::max(),
        std::is_same<decltype(text__2.color), Qul::Property<Qul::PlatformInterface::Rgba32>>::value ? (offsetof(QulPerfOverlay, text__2.color) / 4) : std::numeric_limits<OffsetType4423538195039467471>::max(),
        std::is_same<decltype(text__3.color), Qul::Property<Qul::PlatformInterface::Rgba32>>::value ? (offsetof(QulPerfOverlay, text__3.color) / 4) : std::numeric_limits<OffsetType4423538195039467471>::max(),
        std::is_same<decltype(text__4.color), Qul::Property<Qul::PlatformInterface::Rgba32>>::value ? (offsetof(QulPerfOverlay, text__4.color) / 4) : std::numeric_limits<OffsetType4423538195039467471>::max(),
        std::is_same<decltype(text__5.color), Qul::Property<Qul::PlatformInterface::Rgba32>>::value ? (offsetof(QulPerfOverlay, text__5.color) / 4) : std::numeric_limits<OffsetType4423538195039467471>::max(),
        std::is_same<decltype(text__6.color), Qul::Property<Qul::PlatformInterface::Rgba32>>::value ? (offsetof(QulPerfOverlay, text__6.color) / 4) : std::numeric_limits<OffsetType4423538195039467471>::max(),
    };
    static constexpr uint32_t propertyValues4423538195039467471[] = {
        // color: "#ffb6c1"
        // line 23  "QulPerfOverlay.qml"
        0xffffb6c1,
        // color: "#ffb6c1"
        // line 28  "QulPerfOverlay.qml"
        0xffffb6c1,
        // color: "#ffb6c1"
        // line 33  "QulPerfOverlay.qml"
        0xffffb6c1,
        // color: "#ffb6c1"
        // line 38  "QulPerfOverlay.qml"
        0xffffb6c1,
        // color: "#ffb6c1"
        // line 43  "QulPerfOverlay.qml"
        0xffffb6c1,
        // color: "#ffb6c1"
        // line 48  "QulPerfOverlay.qml"
        0xffffb6c1,
    };
    Qul::Private::initializeProperties<Qul::PlatformInterface::Rgba32>(this, propertyOffsets4423538195039467471, propertyValues4423538195039467471,
        sizeof(propertyOffsets4423538195039467471) / sizeof(propertyOffsets4423538195039467471[0]));
    // color: "#ffb6c1"
    // line 23  "QulPerfOverlay.qml"
    if (!std::is_same<decltype(text_.color), Qul::Property<Qul::PlatformInterface::Rgba32>>::value)
        text_.color.setValue(0xffffb6c1);
    // color: "#ffb6c1"
    // line 28  "QulPerfOverlay.qml"
    if (!std::is_same<decltype(text__2.color), Qul::Property<Qul::PlatformInterface::Rgba32>>::value)
        text__2.color.setValue(0xffffb6c1);
    // color: "#ffb6c1"
    // line 33  "QulPerfOverlay.qml"
    if (!std::is_same<decltype(text__3.color), Qul::Property<Qul::PlatformInterface::Rgba32>>::value)
        text__3.color.setValue(0xffffb6c1);
    // color: "#ffb6c1"
    // line 38  "QulPerfOverlay.qml"
    if (!std::is_same<decltype(text__4.color), Qul::Property<Qul::PlatformInterface::Rgba32>>::value)
        text__4.color.setValue(0xffffb6c1);
    // color: "#ffb6c1"
    // line 43  "QulPerfOverlay.qml"
    if (!std::is_same<decltype(text__5.color), Qul::Property<Qul::PlatformInterface::Rgba32>>::value)
        text__5.color.setValue(0xffffb6c1);
    // color: "#ffb6c1"
    // line 48  "QulPerfOverlay.qml"
    if (!std::is_same<decltype(text__6.color), Qul::Property<Qul::PlatformInterface::Rgba32>>::value)
        text__6.color.setValue(0xffffb6c1);
#endif
    // Text {
    // line 22  "QulPerfOverlay.qml"
    appendChild(this, &text_);
    text__text_binding.init<QulPerfOverlay, &QulPerfOverlay::text__text_binding>(text_.text);
    // text: "Total frames: " + QulPerf.totalFrames
    // line 24  "QulPerfOverlay.qml"
    text_.text.setBinding (&text__text_binding);
    // Text {
    // line 27  "QulPerfOverlay.qml"
    appendChild(this, &text__2);
    text__2_text_binding.init<QulPerfOverlay, &QulPerfOverlay::text__2_text_binding>(text__2.text);
    // text: "Average fps: " + QulPerf.averageFps.toFixed(2)
    // line 29  "QulPerfOverlay.qml"
    text__2.text.setBinding (&text__2_text_binding);
    // Text {
    // line 32  "QulPerfOverlay.qml"
    appendChild(this, &text__3);
    text__3_text_binding.init<QulPerfOverlay, &QulPerfOverlay::text__3_text_binding>(text__3.text);
    // text: "Minimum fps: " + QulPerf.minimumFps.toFixed(1)
    // line 34  "QulPerfOverlay.qml"
    text__3.text.setBinding (&text__3_text_binding);
    // Text {
    // line 37  "QulPerfOverlay.qml"
    appendChild(this, &text__4);
    text__4_text_binding.init<QulPerfOverlay, &QulPerfOverlay::text__4_text_binding>(text__4.text);
    // text: "Max heap usage: " + QulPerf.maxHeapUsage + " Bytes"
    // line 39  "QulPerfOverlay.qml"
    text__4.text.setBinding (&text__4_text_binding);
    // Text {
    // line 42  "QulPerfOverlay.qml"
    appendChild(this, &text__5);
    text__5_text_binding.init<QulPerfOverlay, &QulPerfOverlay::text__5_text_binding>(text__5.text);
    // text: "Max stack usage: " + QulPerf.maxStackUsage + " Bytes"
    // line 44  "QulPerfOverlay.qml"
    text__5.text.setBinding (&text__5_text_binding);
    // Text {
    // line 47  "QulPerfOverlay.qml"
    appendChild(this, &text__6);
    text__6_text_binding.init<QulPerfOverlay, &QulPerfOverlay::text__6_text_binding>(text__6.text);
    // text: "Average CPU load: " + QulPerf.averageCpuLoad.toFixed(1) + "%"
    // line 49  "QulPerfOverlay.qml"
    text__6.text.setBinding (&text__6_text_binding);
}

} // namespace QtQuickUltralite
} // namespace Profiling
