QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskObjectCounter.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_OBJECT_COUNTER_H
7#define QSK_OBJECT_COUNTER_H
8
9#include "QskGlobal.h"
10#include <memory>
11
12class QObject;
13
14class QSK_EXPORT QskObjectCounter
15{
16 public:
17 enum ObjectType
18 {
19 Objects,
20 Items
21 };
22
23 QskObjectCounter( bool debugAtDestruction = false );
25
26 void setActive( bool );
27 bool isActive() const;
28
29 void reset();
30
31 int created( ObjectType = Objects ) const;
32 int destroyed( ObjectType = Objects ) const;
33 int current( ObjectType = Objects ) const;
34 int maximum( ObjectType = Objects ) const;
35
36 void debugStatistics( QDebug, ObjectType = Objects ) const;
37 void dump() const;
38
39 private:
40 Q_DISABLE_COPY( QskObjectCounter )
41
42 class PrivateData;
43 std::unique_ptr< PrivateData > m_data;
44};
45
46#ifndef QT_NO_DEBUG_STREAM
47
48class QDebug;
49QSK_EXPORT QDebug operator<<( QDebug, const QskObjectCounter& );
50
51#endif
52
53#endif