2
This file is part of the Grantlee template system.
4
Copyright (c) 2010 Michael Jansen <kde@michael-jansen.biz>
5
Copyright (c) 2010 Stephen Kelly <steveire@gmail.com>
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public
9
License as published by the Free Software Foundation; either version
10
2.1 of the Licence, or (at your option) any later version.
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Lesser General Public License for more details.
17
You should have received a copy of the GNU Lesser General Public
18
License along with this library. If not, see <http://www.gnu.org/licenses/>.
24
#include "customtyperegistry_p.h"
26
#include <QtCore/QDebug>
28
using namespace Grantlee;
30
Q_GLOBAL_STATIC(CustomTypeRegistry, customTypes)
33
void Grantlee::MetaType::internalLock()
35
return customTypes()->mutex.lock();
38
void Grantlee::MetaType::internalUnlock()
40
return customTypes()->mutex.unlock();
43
void Grantlee::MetaType::registerLookUpOperator( int id, LookupFunction f )
48
qWarning() << "registerTypeOperators() called with invalid arguments";
51
customTypes()->registerLookupOperator( id, f );
54
void Grantlee::MetaType::registerToVariantListOperator( int id, ToVariantListFunction f )
59
qWarning() << "registerTypeOperators() called with invalid arguments";
62
customTypes()->registerToListOperator( id, f );
65
QVariant Grantlee::MetaType::lookup( const QVariant &object, const QString &property )
68
static const int i = MetaType::initBuiltins();
71
return customTypes()->lookup( object, property );
74
QVariantList Grantlee::MetaType::toVariantList( const QVariant &obj )
77
static const int i = MetaType::initBuiltins();
80
return customTypes()->toVariantList( obj );
83
bool Grantlee::MetaType::lookupAlreadyRegistered( int id )
85
return customTypes()->lookupAlreadyRegistered( id );
88
bool Grantlee::MetaType::toListAlreadyRegistered( int id )
90
return customTypes()->toListAlreadyRegistered( id );