qskinny/src/common/QskObjectCounter.h

53 lines
1.1 KiB
C
Raw Normal View History

2017-07-21 16:21:34 +00:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#ifndef QSK_OBJECT_COUNTER_H
#define QSK_OBJECT_COUNTER_H
#include "QskGlobal.h"
2021-10-07 11:49:13 +00:00
#include <memory>
2017-07-21 16:21:34 +00:00
class QObject;
class QSK_EXPORT QskObjectCounter
{
2018-08-03 06:15:28 +00:00
public:
2017-07-21 16:21:34 +00:00
enum ObjectType
{
Objects,
Items
};
QskObjectCounter( bool debugAtDestruction = false );
~QskObjectCounter();
void setActive( bool );
bool isActive() const;
void reset();
int created( ObjectType = Objects ) const;
int destroyed( ObjectType = Objects ) const;
int current( ObjectType = Objects ) const;
int maximum( ObjectType = Objects ) const;
void debugStatistics( QDebug, ObjectType = Objects ) const;
void dump() const;
2018-08-03 06:15:28 +00:00
private:
2021-10-07 11:49:13 +00:00
class PrivateData;
std::unique_ptr< PrivateData > m_data;
2017-07-21 16:21:34 +00:00
};
#ifndef QT_NO_DEBUG_STREAM
2021-10-07 11:49:13 +00:00
class QDebug;
2017-07-21 16:21:34 +00:00
QSK_EXPORT QDebug operator<<( QDebug, const QskObjectCounter& );
2021-10-07 11:49:13 +00:00
2017-07-21 16:21:34 +00:00
#endif
#endif