24 #ifndef GAMMARAY_VARIANTHANDLER_H
25 #define GAMMARAY_VARIANTHANDLER_H
27 #include "gammaray_core_export.h"
34 namespace VariantHandler
37 template <
typename RetT>
struct Converter
39 virtual RetT operator() (
const QVariant &v) = 0;
42 template <
typename RetT,
typename InputT,
typename FuncT>
struct ConverterImpl
43 :
public Converter<RetT>
45 explicit inline ConverterImpl(FuncT converter) : f(converter)
50 inline RetT operator() (
const QVariant &v)
52 return f(v.value<InputT>());
65 GAMMARAY_CORE_EXPORT QString
displayString(
const QVariant &value);
82 GAMMARAY_CORE_EXPORT QVariant
decoration(
const QVariant &value);
94 template <
typename T,
typename FuncT>
97 Converter<QString> *converter =
new ConverterImpl<QString, T, FuncT>(f);
101 typedef QString(*GenericStringConverter)(
const QVariant &value,
bool *ok);
115 #endif // GAMMARAY_VARIANTHANDLER_H