Go to the documentation of this file.
11#ifndef KTEXTTEMPLATE_METATYPE_H
12#define KTEXTTEMPLATE_METATYPE_H
14#include "ktexttemplate_export.h"
39class KTEXTTEMPLATE_EXPORT MetaType
50 static void registerLookUpOperator(
int id, LookupFunction f);
55 static void internalLock();
60 static void internalUnlock();
70 static bool lookupAlreadyRegistered(
int id);
83template<
typename RealType,
typename HandleAs>
87 typedef typename KTextTemplate::TypeAccessor<RealType> Accessor;
88 return Accessor::lookUp(
object.value<RealType>(), property);
92template<
typename RealType,
typename HandleAs>
93struct LookupTrait<RealType &, HandleAs &> {
96 typedef typename KTextTemplate::TypeAccessor<HandleAs &> Accessor;
97 return Accessor::lookUp(
object.value<HandleAs>(), property);
101template<
typename RealType,
typename HandleAs>
102static int doRegister(
int id)
104 if (MetaType::lookupAlreadyRegistered(
id))
109 MetaType::registerLookUpOperator(
id,
reinterpret_cast<MetaType::LookupFunction
>(lf));
117template<
typename RealType,
typename HandleAs>
118struct InternalRegisterType {
121 const int id = qMetaTypeId<RealType>();
122 return doRegister<RealType &, HandleAs &>(
id);
126template<
typename RealType,
typename HandleAs>
127struct InternalRegisterType<RealType *, HandleAs *> {
130 const int id = qMetaTypeId<RealType *>();
131 return doRegister<RealType *, HandleAs *>(
id);
172template<
typename RealType,
typename HandleAs>
175 MetaType::internalLock();
177 const int id = InternalRegisterType<RealType, HandleAs>::doReg();
179 MetaType::internalUnlock();
191template<
typename Type>
205#define KTEXTTEMPLATE_BEGIN_LOOKUP(Type) \
206 namespace KTextTemplate \
209 inline QVariant TypeAccessor<Type &>::lookUp(const Type &object, const QString &property) \
216#define KTEXTTEMPLATE_BEGIN_LOOKUP_PTR(Type) \
217 namespace KTextTemplate \
220 inline QVariant TypeAccessor<Type *>::lookUp(const Type *const object, const QString &property) \
227#define KTEXTTEMPLATE_END_LOOKUP \
The KTextTemplate namespace holds all public KTextTemplate API.
int registerMetaType()
Registers the type RealType with the metatype system.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:17 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.