#pragma once
#include <QString>
#include <QVariant>

namespace Xybrid::Util {
    template<typename Num> inline QString numAndName(Num num, const std::string& name) {
        if (name.empty()) return QString::number(num);
        return QString("%1 (\"%2\")").arg(num).arg(QString::fromStdString(name));
    }

    inline QString hex(int num, int fw = 2) {
        return QString("%1").arg(num, fw, 16, QChar('0')).toUpper();
    }

    template <typename T>
    inline QString enumName(T t) { return QVariant::fromValue(t).toString(); }
}
