renamed CBaseStreamStringifier to CStreamable

This commit is contained in:
Mathew Sutcliffe
2013-08-18 23:47:29 +01:00
parent da8ba9aac3
commit a6f89ce9ea
9 changed files with 36 additions and 35 deletions

View File

@@ -7,7 +7,7 @@
#define BLACKMISC_AVIOBASE_H #define BLACKMISC_AVIOBASE_H
// QtGlobal is required for asserts // QtGlobal is required for asserts
#include "blackmisc/basestreamstringifier.h" #include "blackmisc/streamable.h"
#include "blackmisc/pqconstants.h" #include "blackmisc/pqconstants.h"
#include <QtGlobal> #include <QtGlobal>
@@ -19,7 +19,7 @@ namespace Aviation
/*! /*!
* \brief Base class for avionics * \brief Base class for avionics
*/ */
class CAvionicsBase : public BlackMisc::CBaseStreamStringifier class CAvionicsBase : public BlackMisc::CStreamable
{ {
protected: protected:
QString m_name; //!< name of the unit QString m_name; //!< name of the unit

View File

@@ -30,8 +30,8 @@ template <class AVIO> class CModulator : public CAvionicsBase
// If I do not have the method here, DBus metasystem tries to stream against // If I do not have the method here, DBus metasystem tries to stream against
// a container: inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &list) // a container: inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &list)
// Once someone solves this, this methods should go and the // Once someone solves this, this methods should go and the
// CBaseStreamStringifier signature should be used // CStreamable signature should be used
CBaseStreamStringifier &sf = uc; CStreamable &sf = uc;
return argument >> sf; return argument >> sf;
} }
@@ -43,7 +43,7 @@ template <class AVIO> class CModulator : public CAvionicsBase
*/ */
friend QDBusArgument &operator<<(QDBusArgument &argument, const AVIO &uc) friend QDBusArgument &operator<<(QDBusArgument &argument, const AVIO &uc)
{ {
const CBaseStreamStringifier &sf = uc; const CStreamable &sf = uc;
return argument << sf; return argument << sf;
} }

View File

@@ -37,7 +37,7 @@ class ICoordinateGeodetic
/*! /*!
* \brief Geodetic coordinate * \brief Geodetic coordinate
*/ */
class CCoordinateGeodetic : public CBaseStreamStringifier, public ICoordinateGeodetic class CCoordinateGeodetic : public CStreamable, public ICoordinateGeodetic
{ {
private: private:
BlackMisc::Geo::CLatitude m_latitude; //!< Latitude BlackMisc::Geo::CLatitude m_latitude; //!< Latitude

View File

@@ -27,8 +27,8 @@ template <class LATorLON> class CEarthAngle : public BlackMisc::PhysicalQuantiti
// If I do not have the method here, DBus metasystem tries to stream against // If I do not have the method here, DBus metasystem tries to stream against
// a container: inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &list) // a container: inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &list)
// Once someone solves this, this methods should go and the // Once someone solves this, this methods should go and the
// CBaseStreamStringifier signature should be used // CStreamable signature should be used
CBaseStreamStringifier &sf = uc; CStreamable &sf = uc;
return argument >> sf; return argument >> sf;
} }
@@ -40,7 +40,7 @@ template <class LATorLON> class CEarthAngle : public BlackMisc::PhysicalQuantiti
*/ */
friend QDBusArgument &operator<<(QDBusArgument &argument, const LATorLON &uc) friend QDBusArgument &operator<<(QDBusArgument &argument, const LATorLON &uc)
{ {
const CBaseStreamStringifier &sf = uc; const CStreamable &sf = uc;
return argument << sf; return argument << sf;
} }

View File

@@ -6,7 +6,7 @@
#ifndef BLACKMISC_MATHMATRIXBASE_H #ifndef BLACKMISC_MATHMATRIXBASE_H
#define BLACKMISC_MATHMATRIXBASE_H #define BLACKMISC_MATHMATRIXBASE_H
#include "blackmisc/basestreamstringifier.h" #include "blackmisc/streamable.h"
#include "blackmisc/mathvector3dbase.h" #include "blackmisc/mathvector3dbase.h"
#include <QGenericMatrix> #include <QGenericMatrix>
#include <QDBusMetaType> #include <QDBusMetaType>
@@ -19,7 +19,7 @@ namespace Math
/*! /*!
* \brief Base functionality of a matrix * \brief Base functionality of a matrix
*/ */
template<class ImplMatrix, int Rows, int Columns> class CMatrixBase : public BlackMisc::CBaseStreamStringifier template<class ImplMatrix, int Rows, int Columns> class CMatrixBase : public BlackMisc::CStreamable
{ {
private: private:
/*! /*!

View File

@@ -6,7 +6,7 @@
#ifndef BLACKMISC_MATHVECTOR3DBASE_H #ifndef BLACKMISC_MATHVECTOR3DBASE_H
#define BLACKMISC_MATHVECTOR3DBASE_H #define BLACKMISC_MATHVECTOR3DBASE_H
#include "blackmisc/basestreamstringifier.h" #include "blackmisc/streamable.h"
#include "blackmisc/mathematics.h" #include "blackmisc/mathematics.h"
namespace BlackMisc namespace BlackMisc
@@ -21,7 +21,7 @@ class CMatrix3x1; // forward declaration
/*! /*!
* \brief 3D vector base (x, y, z) * \brief 3D vector base (x, y, z)
*/ */
template <class ImplVector> class CVector3DBase : public CBaseStreamStringifier template <class ImplVector> class CVector3DBase : public CStreamable
{ {
/*! /*!
* \brief Unmarshalling operator >>, DBus to object * \brief Unmarshalling operator >>, DBus to object
@@ -34,8 +34,8 @@ template <class ImplVector> class CVector3DBase : public CBaseStreamStringifier
// If I do not have the method here, DBus metasystem tries to stream against // If I do not have the method here, DBus metasystem tries to stream against
// a container: inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &list) // a container: inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &list)
// Once someone solves this, this methods should go and the // Once someone solves this, this methods should go and the
// CBaseStreamStringifier signature should be used // CStreamable signature should be used
CBaseStreamStringifier &sf = uc; CStreamable &sf = uc;
return argument >> sf; return argument >> sf;
} }
@@ -47,7 +47,7 @@ template <class ImplVector> class CVector3DBase : public CBaseStreamStringifier
*/ */
friend QDBusArgument &operator<<(QDBusArgument &argument, const ImplVector &uc) friend QDBusArgument &operator<<(QDBusArgument &argument, const ImplVector &uc)
{ {
const CBaseStreamStringifier &sf = uc; const CStreamable &sf = uc;
return argument << sf; return argument << sf;
} }

View File

@@ -6,7 +6,7 @@
#ifndef BLACKMISC_PQBASE_H #ifndef BLACKMISC_PQBASE_H
#define BLACKMISC_PQBASE_H #define BLACKMISC_PQBASE_H
#include "blackmisc/basestreamstringifier.h" #include "blackmisc/streamable.h"
#include "blackmisc/debug.h" #include "blackmisc/debug.h"
#include "blackmisc/mathematics.h" #include "blackmisc/mathematics.h"
#include <QCoreApplication> #include <QCoreApplication>
@@ -27,7 +27,7 @@ namespace PhysicalQuantities
* See <a href="http://www.poynton.com/notes/units/index.html">here</a> for an overview. * See <a href="http://www.poynton.com/notes/units/index.html">here</a> for an overview.
* Use the static values such as CMeasurementPrefix::k() to specify values. * Use the static values such as CMeasurementPrefix::k() to specify values.
*/ */
class CMeasurementPrefix : public CBaseStreamStringifier class CMeasurementPrefix : public CStreamable
{ {
private: private:
QString m_name; //!< name, e.g. "kilo" QString m_name; //!< name, e.g. "kilo"
@@ -267,7 +267,7 @@ public:
/*! /*!
* \brief Base class for all units, such as meter, hertz. * \brief Base class for all units, such as meter, hertz.
*/ */
class CMeasurementUnit : public CBaseStreamStringifier class CMeasurementUnit : public CStreamable
{ {
protected: protected:
/*! /*!

View File

@@ -24,7 +24,7 @@ namespace PhysicalQuantities
/*! /*!
* \brief A physical quantity such as "5m", "20s", "1500ft/s" * \brief A physical quantity such as "5m", "20s", "1500ft/s"
*/ */
template <class MU, class PQ> class CPhysicalQuantity : public BlackMisc::CBaseStreamStringifier template <class MU, class PQ> class CPhysicalQuantity : public BlackMisc::CStreamable
{ {
private: private:
double m_value; //!< numeric part double m_value; //!< numeric part

View File

@@ -1,5 +1,5 @@
#ifndef BLACKMISC_BASESTREAMSTRINGIFIER_H #ifndef BLACKMISC_STREAMABLE_H
#define BLACKMISC_BASESTREAMSTRINGIFIER_H #define BLACKMISC_STREAMABLE_H
#include "blackmisc/debug.h" #include "blackmisc/debug.h"
#include <QDBusMetaType> #include <QDBusMetaType>
@@ -12,10 +12,11 @@
namespace BlackMisc { namespace BlackMisc {
/*! /*!
* \brief Provides "to QString" and stream operators * \brief Base class for streamable value objects.
* Public non-virtual interface with protected virtual implementation.
*/ */
// Virtual operators: http://stackoverflow.com/a/4571634/356726 // Virtual operators: http://stackoverflow.com/a/4571634/356726
class CBaseStreamStringifier class CStreamable
{ {
/*! /*!
* \brief Stream << overload to be used in debugging messages * \brief Stream << overload to be used in debugging messages
@@ -23,7 +24,7 @@ class CBaseStreamStringifier
* \param uc * \param uc
* \return * \return
*/ */
friend QDebug operator<<(QDebug debug, const CBaseStreamStringifier &uc) friend QDebug operator<<(QDebug debug, const CStreamable &uc)
{ {
debug << uc.stringForStreaming(); debug << uc.stringForStreaming();
return debug; return debug;
@@ -35,7 +36,7 @@ class CBaseStreamStringifier
* \param uc * \param uc
* \return * \return
*/ */
friend QTextStream &operator<<(QTextStream &textStream, const CBaseStreamStringifier &uc) friend QTextStream &operator<<(QTextStream &textStream, const CStreamable &uc)
{ {
textStream << uc.stringForStreaming(); textStream << uc.stringForStreaming();
return textStream; return textStream;
@@ -47,7 +48,7 @@ class CBaseStreamStringifier
* \param uc * \param uc
* \return * \return
*/ */
friend QNoDebug operator<<(QNoDebug nodebug, const CBaseStreamStringifier & /* uc */) friend QNoDebug operator<<(QNoDebug nodebug, const CStreamable & /* uc */)
{ {
return nodebug; return nodebug;
} }
@@ -58,7 +59,7 @@ class CBaseStreamStringifier
* \param uc * \param uc
* \return * \return
*/ */
friend QDataStream &operator<<(QDataStream &stream, const CBaseStreamStringifier &uc) friend QDataStream &operator<<(QDataStream &stream, const CStreamable &uc)
{ {
stream << uc.stringForStreaming(); stream << uc.stringForStreaming();
return stream; return stream;
@@ -70,7 +71,7 @@ class CBaseStreamStringifier
* \param uc * \param uc
* \return * \return
*/ */
friend CLogMessage operator<<(CLogMessage log, const CBaseStreamStringifier &uc) friend CLogMessage operator<<(CLogMessage log, const CStreamable &uc)
{ {
log << uc.stringForStreaming(); log << uc.stringForStreaming();
return log; return log;
@@ -82,7 +83,7 @@ class CBaseStreamStringifier
* \param uc * \param uc
* \return * \return
*/ */
friend std::ostream &operator<<(std::ostream &ostr, const CBaseStreamStringifier &uc) friend std::ostream &operator<<(std::ostream &ostr, const CStreamable &uc)
{ {
ostr << uc.stringForStreaming().toStdString(); ostr << uc.stringForStreaming().toStdString();
return ostr; return ostr;
@@ -94,7 +95,7 @@ class CBaseStreamStringifier
* \param uc * \param uc
* \return * \return
*/ */
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CBaseStreamStringifier &uc) friend const QDBusArgument &operator>>(const QDBusArgument &argument, CStreamable &uc)
{ {
argument.beginStructure(); argument.beginStructure();
uc.unmarshallFromDbus(argument); uc.unmarshallFromDbus(argument);
@@ -108,7 +109,7 @@ class CBaseStreamStringifier
* \param pq * \param pq
* \return * \return
*/ */
friend QDBusArgument &operator<<(QDBusArgument &argument, const CBaseStreamStringifier &uc) friend QDBusArgument &operator<<(QDBusArgument &argument, const CStreamable &uc)
{ {
argument.beginStructure(); argument.beginStructure();
uc.marshallToDbus(argument); uc.marshallToDbus(argument);
@@ -120,7 +121,7 @@ public:
/*! /*!
* \brief Virtual destructor * \brief Virtual destructor
*/ */
virtual ~CBaseStreamStringifier() {} virtual ~CStreamable() {}
/*! /*!
* \brief Cast as QString * \brief Cast as QString
@@ -135,7 +136,7 @@ protected:
/*! /*!
* \brief Default constructor * \brief Default constructor
*/ */
CBaseStreamStringifier() {} CStreamable() {}
/*! /*!
* \brief String for streaming operators * \brief String for streaming operators
@@ -172,7 +173,7 @@ protected:
* class into an instance of a completely unrelated derived class. * class into an instance of a completely unrelated derived class.
* \return * \return
*/ */
CBaseStreamStringifier& operator=(const CBaseStreamStringifier&) { return *this; } CStreamable& operator=(const CStreamable&) { return *this; }
}; };
} // namespace } // namespace