// Header .h
#include <QMetaType>
#include <QMap>
#include <QString>
#include <QVariant>
class CClassColorMap
{
public:
CClassColorMap();
CClassColorMap( const CClassColorMap & rhs );
virtual ~CClassColorMap();
};
Q_DECLARE_METATYPE( CClassColorMap );
// Implementation .cpp
#include "ClassColorMap.h"
#include <QDataStream>
static CClassColorMap sClassColors;
static bool sbRegistered = false;
CClassColorMap::CClassColorMap(void)
{
if ( !sbRegistered )
{
qRegisterMetaTypeStreamOperators< CClassColorMap >( "CClassColorMap" );
sbRegistered = true;
}
}
CClassColorMap::CClassColorMap( const CClassColorMap & rhs )
{
if ( !sbRegistered )
{
qRegisterMetaTypeStreamOperators< CClassColorMap >( "CClassColorMap" );
sbRegistered = true;
}
*this = rhs;
}
CClassColorMap::~CClassColorMap(void)
{
}
{
return operator<<
( stream,
(const QMap<
QString,
QVariant >
&) classColors
);
}
{
}
// Header .h
#include <QMetaType>
#include <QMap>
#include <QString>
#include <QVariant>
class QDataStream;
class CClassColorMap
: public QMap< QString, QVariant >
{
public:
CClassColorMap();
CClassColorMap( const CClassColorMap & rhs );
virtual ~CClassColorMap();
};
Q_DECLARE_METATYPE( CClassColorMap );
QDataStream & operator<<( QDataStream & stream, const CClassColorMap & classColors );
QDataStream & operator>>( QDataStream & stream, CClassColorMap & classColors );
// Implementation .cpp
#include "ClassColorMap.h"
#include <QDataStream>
static CClassColorMap sClassColors;
static bool sbRegistered = false;
CClassColorMap::CClassColorMap(void)
: QMap< QString, QVariant >()
{
if ( !sbRegistered )
{
qRegisterMetaTypeStreamOperators< CClassColorMap >( "CClassColorMap" );
sbRegistered = true;
}
}
CClassColorMap::CClassColorMap( const CClassColorMap & rhs )
: QMap< QString, QVariant >()
{
if ( !sbRegistered )
{
qRegisterMetaTypeStreamOperators< CClassColorMap >( "CClassColorMap" );
sbRegistered = true;
}
*this = rhs;
}
CClassColorMap::~CClassColorMap(void)
{
}
QDataStream & operator<<( QDataStream & stream, const CClassColorMap & classColors )
{
return operator<<( stream, (const QMap< QString, QVariant > &) classColors );
}
QDataStream & operator>>( QDataStream & stream, CClassColorMap & classColors )
{
return operator>>( stream, (QMap< QString, QVariant > &) classColors );
}
To copy to clipboard, switch view to plain text mode
Bookmarks