00001 /* This file is part of the KDE project 00002 * Copyright (C) 2006 Thomas Zander <zander@kde.org> 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Library General Public 00006 * License as published by the Free Software Foundation; version 2. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Library General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Library General Public License 00014 * along with this library; see the file COPYING.LIB. If not, write to 00015 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 * Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef KOTEXT_STYLES_PRIVATE_H 00020 #define KOTEXT_STYLES_PRIVATE_H 00021 00022 #include <QVariant> 00023 #include <QVector> 00024 00025 struct Property { 00026 Property() {} 00027 Property(int key, const QVariant &value) { 00028 this->key = key; 00029 this->value = value; 00030 } 00031 inline bool operator==(const Property &prop) const { 00032 return prop.key == key && prop.value == value; 00033 } 00034 inline bool operator!=(const Property &prop) const { 00035 return prop.key != key || prop.value != value; 00036 } 00037 00038 int key; 00039 QVariant value; 00040 }; 00041 00042 class StylePrivate { 00043 public: 00044 StylePrivate(); 00045 ~StylePrivate(); 00046 00047 void add(int key, const QVariant &value); 00048 void remove(int key); 00049 const QVariant *get(int key) const; 00050 bool contains(int key) const; 00051 void copyMissing(const StylePrivate *other); 00052 void removeDuplicates(const StylePrivate *other); 00053 void clearAll() { m_properties.clear(); } 00054 00055 private: 00056 QVector<Property> m_properties; 00057 }; 00058 #endif