File indexing completed on 2024-04-28 15:39:55
0001 /* SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org> 0002 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 #ifndef DB_CATEGORYITEMS_H 0006 #define DB_CATEGORYITEMS_H 0007 0008 #include <QExplicitlySharedDataPointer> 0009 #include <QList> 0010 #include <qstring.h> 0011 0012 namespace DB 0013 { 0014 class CategoryItem : public QSharedData 0015 { 0016 public: 0017 explicit CategoryItem(const QString &name, bool isTop = false) 0018 : mp_name(name) 0019 , mp_isTop(isTop) 0020 { 0021 } 0022 ~CategoryItem(); 0023 CategoryItem *clone() const; 0024 bool isDescendentOf(const QString &child, const QString &parent) const; 0025 0026 protected: 0027 bool hasChild(const QString &child) const; 0028 0029 public: 0030 QString mp_name; 0031 QList<CategoryItem *> mp_subcategories; 0032 bool mp_isTop; 0033 }; 0034 0035 typedef QExplicitlySharedDataPointer<CategoryItem> CategoryItemPtr; 0036 } 0037 0038 #endif /* DB_CATEGORYITEMS_H */ 0039 0040 // vi:expandtab:tabstop=4 shiftwidth=4: