Yingdi Yu | 1f82464 | 2016-03-20 17:07:22 -0700 | [diff] [blame^] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2013-2014, Regents of the University of California, |
| 4 | * |
| 5 | * This file is part of NFD Control Center. See AUTHORS.md for complete list of NFD |
| 6 | * authors and contributors. |
| 7 | * |
| 8 | * NFD Control Center is free software: you can redistribute it and/or modify it under the |
| 9 | * terms of the GNU General Public License as published by the Free Software Foundation, |
| 10 | * either version 3 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * NFD Control Center is distributed in the hope that it will be useful, but WITHOUT ANY |
| 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 14 | * PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along with NFD |
| 17 | * Control Center, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #ifndef NDN_NCC_KEY_TREE_MODEL_HPP |
| 21 | #define NDN_NCC_KEY_TREE_MODEL_HPP |
| 22 | |
| 23 | #include <QAbstractItemModel> |
| 24 | #include <QModelIndex> |
| 25 | #include <QVariant> |
| 26 | |
| 27 | namespace ndn { |
| 28 | namespace ncc { |
| 29 | |
| 30 | class KeyTreeItem; |
| 31 | |
| 32 | class KeyTreeModel : public QAbstractItemModel |
| 33 | { |
| 34 | Q_OBJECT |
| 35 | |
| 36 | public: |
| 37 | explicit |
| 38 | KeyTreeModel(QObject* parent = 0); |
| 39 | |
| 40 | ~KeyTreeModel(); |
| 41 | |
| 42 | void |
| 43 | clear(); |
| 44 | |
| 45 | void |
| 46 | addChild(KeyTreeItem* child); |
| 47 | |
| 48 | QVariant |
| 49 | name(const QModelIndex& index, int role) const; |
| 50 | |
| 51 | QVariant |
| 52 | data(const QModelIndex& index, int role) const Q_DECL_OVERRIDE; |
| 53 | |
| 54 | Qt::ItemFlags |
| 55 | flags(const QModelIndex& index) const Q_DECL_OVERRIDE; |
| 56 | |
| 57 | QVariant |
| 58 | headerData(int section, Qt::Orientation orientation, |
| 59 | int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; |
| 60 | |
| 61 | QModelIndex |
| 62 | index(int row, int column, const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; |
| 63 | |
| 64 | QModelIndex |
| 65 | parent(const QModelIndex& index) const Q_DECL_OVERRIDE; |
| 66 | |
| 67 | int |
| 68 | rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; |
| 69 | |
| 70 | int |
| 71 | columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; |
| 72 | |
| 73 | private: |
| 74 | KeyTreeItem* m_rootItem; |
| 75 | }; |
| 76 | |
| 77 | } // namespace ncc |
| 78 | } // namespace ndn |
| 79 | |
| 80 | #endif // NDN_NCC_KEY_TREE_MODEL_HPP |