You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.3 KiB
C

/**
*
* @file FITKVarientParams.h
* @brief QVarient
* @author libaojun (libaojunqd@Foxmail.com)
* @date 2024-04-10
*
*/
#ifndef __FITKVARIENTPARAMS__H__
#define __FITKVARIENTPARAMS__H__
#include "FITKCoreAPI.h"
#include <QHash>
#include <QString>
#include <QVariant>
namespace Core
{
/**
* @brief
* @author libaojun (libaojunqd@Foxmail.com)
* @date 2024-04-10
*/
class FITKCoreAPI FITKVarientParams
{
public:
/**
* @brief Construct a new FITKRunTimeSetting object
* @author libaojun (libaojunqd@Foxmail.com)
* @date 2024-04-10
*/
explicit FITKVarientParams() = default;
/**
* @brief Destroy the FITKRunTimeSetting object
* @author libaojun (libaojunqd@Foxmail.com)
* @date 2024-04-10
*/
virtual ~FITKVarientParams() = default;
/**
* @brief
* @param[i] k
* @param[i] v
* @author libaojun (libaojunqd@Foxmail.com)
* @date 2024-04-10
*/
void setValue(const QString& k, const QVariant v);
/**
* @brief
* @param[i] k
* @return QVariant
* @author libaojun (libaojunqd@Foxmail.com)
* @date 2024-04-10
*/
QVariant getValue(const QString& k) const;
template <typename T>
/**
* @brief
* @param[i] k
* @return T
* @author libaojun (libaojunqd@Foxmail.com)
* @date 2024-04-10
*/
T getValueT(const QString& k) const
{
QVariant v = this->getValue(k);
return v.value<T>();
}
/**
* @brief
* @param[i] k
* @author libaojun (libaojunqd@Foxmail.com)
* @date 2024-04-18
*/
void removeVarient(const QString & k);
private:
/**
* @brief
* @author libaojun (libaojunqd@Foxmail.com)
* @date 2024-04-10
*/
QHash<QString, QVariant> _settings;
};
}
#endif