00001 /* 00002 * Copyright (C) 2008 Nokia Corporation. 00003 * 00004 * Contact: Marius Vollmer <marius.vollmer@nokia.com> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * version 2.1 as published by the Free Software Foundation. 00009 * 00010 * This library is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00018 * 02110-1301 USA 00019 * 00020 */ 00021 00022 #ifndef CONTEXTTYPEINFO_H 00023 #define CONTEXTTYPEINFO_H 00024 00025 #include <QVariant> 00026 #include <QStringList> 00027 #include <QObject> 00028 #include "assoctree.h" 00029 00030 class ContextTypeInfo : public AssocTree 00031 { 00032 public: 00033 ContextTypeInfo(const AssocTree &tree); 00034 ContextTypeInfo(const QVariant &tree); 00035 ContextTypeInfo(); 00036 00037 ContextTypeInfo ensureNewTypes(); 00038 bool typeCheck(const QVariant &value) const; 00039 00040 bool hasBase(QString wanted, int depth = 10) const; 00041 ContextTypeInfo getBase(QString wanted, int depth = 10) const; 00042 QVariantList parameters() const; 00043 QVariant parameterValue(QString p) const; 00044 AssocTree parameterNode(QString p) const; 00045 00046 AssocTree definition() const; 00047 QString parameterDoc(QString p) const; 00048 QString doc() const; 00049 ContextTypeInfo base() const; 00050 }; 00051 00052 class ContextStringEnumInfo : public ContextTypeInfo 00053 { 00054 public: 00055 ContextStringEnumInfo(const ContextTypeInfo &info); 00056 00057 QStringList choices() const; 00058 QString choiceDoc(const QString &choice) const; 00059 }; 00060 00061 class ContextListInfo : public ContextTypeInfo 00062 { 00063 public: 00064 ContextListInfo(const ContextTypeInfo &info); 00065 00066 ContextTypeInfo type(); 00067 }; 00068 00069 #endif