KIO
predicateproperties.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 00003 Copyright (c) 2007 Jos van den Oever <jos@vandenoever.info> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License (LGPL) as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include "predicateproperties.h" 00022 00023 #include <QtCore/QStringList> 00024 00025 using namespace std; 00026 00027 class PredicateProperties::Private : public QSharedData { 00028 public: 00029 static const QString nullString; 00030 static const QStringList nullStringList; 00031 #ifndef KDE_NO_DEPRECATED 00032 static const PredicateProperties nullPP; 00033 #endif 00034 PredicateProperties parent; 00035 QString key; 00036 QString name; 00037 QVariant::Type type; 00038 uint attributes; 00039 }; 00040 const QString PredicateProperties::Private::nullString; 00041 const QStringList PredicateProperties::Private::nullStringList; 00042 #ifndef KDE_NO_DEPRECATED 00043 const PredicateProperties PredicateProperties::Private::nullPP; 00044 #endif 00045 00046 #ifndef KDE_NO_DEPRECATED 00047 PredicateProperties::PredicateProperties(const QString& predicate) { 00048 if (!predicate.isEmpty()) { 00049 d = new Private(); 00050 d->key = predicate; 00051 } 00052 } 00053 #endif 00054 PredicateProperties::PredicateProperties(const PredicateProperties& pp) 00055 : d(pp.d) { 00056 } 00057 PredicateProperties::~PredicateProperties() { 00058 } 00059 const PredicateProperties& 00060 PredicateProperties::operator=(const PredicateProperties& pp) { 00061 d = pp.d; 00062 return pp; 00063 } 00064 const QString& 00065 PredicateProperties::name() const { 00066 if ( d == 0) return Private::nullString; 00067 return ( d->name.isEmpty()) ? d->key : d->name; 00068 } 00069 00070 const QStringList& 00071 PredicateProperties::suggestedValues() const { 00072 return Private::nullStringList; 00073 } 00074 00075 uint 00076 PredicateProperties::minCardinality() const { 00077 return 0; 00078 } 00079 00080 uint 00081 PredicateProperties::maxCardinality() const { 00082 return 0; 00083 } 00084 00085 uint 00086 PredicateProperties::attributes() const { 00087 return ( d) ? d->attributes :0; 00088 } 00089 QVariant::Type 00090 PredicateProperties::type() const { 00091 return ( d) ? d->type :QVariant::Invalid; 00092 } 00093 QValidator* 00094 PredicateProperties::createValidator() const { 00095 return 0; 00096 } 00097 const PredicateProperties& 00098 PredicateProperties::parent() const { 00099 #ifndef KDE_NO_DEPRECATED 00100 return ( d) ? d->parent :Private::nullPP; 00101 #else 00102 return d->parent; 00103 #endif 00104 } 00105 bool 00106 PredicateProperties::isValid() const { 00107 return d; 00108 }
KDE 4.6 API Reference