File indexing completed on 2024-04-21 03:56:04
0001 /* 0002 SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net> 0003 SPDX-FileContributor: Stephen Kelly <stephen@kdab.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef MODELDUMPER_H 0009 #define MODELDUMPER_H 0010 0011 #include <QIODevice> 0012 0013 #include "proxymodeltestsuite_export.h" 0014 0015 class QModelIndex; 0016 class QAbstractItemModel; 0017 0018 class PROXYMODELTESTSUITE_EXPORT ModelDumper 0019 { 0020 public: 0021 ModelDumper(); 0022 0023 QString dumpModel(const QAbstractItemModel *const model) const; 0024 QString dumpTree(const QAbstractItemModel *const model, const QModelIndex &index) const; 0025 QString dumpTree(const QAbstractItemModel *const model, const QModelIndex &index, int start, int end) const; 0026 0027 void dumpModel(const QAbstractItemModel *const model, QIODevice *device) const; 0028 void dumpTree(const QAbstractItemModel *const model, QIODevice *device, const QModelIndex &index) const; 0029 void dumpTree(const QAbstractItemModel *const model, QIODevice *device, const QModelIndex &index, int start, int end) const; 0030 0031 private: 0032 QString dumpLevel(const QAbstractItemModel *const model, const QModelIndex &parent, int level) const; 0033 QString dumpLevel(const QAbstractItemModel *const model, const QModelIndex &parent, int level, int start, int end) const; 0034 }; 0035 0036 #endif