diff --git a/src/blackmisc/aviobase.h b/src/blackmisc/aviobase.h index 36f4d335c..fa77b57d3 100644 --- a/src/blackmisc/aviobase.h +++ b/src/blackmisc/aviobase.h @@ -7,7 +7,7 @@ #define BLACKMISC_AVIOBASE_H // QtGlobal is required for asserts -#include "blackmisc/basestreamstringifier.h" +#include "blackmisc/streamable.h" #include "blackmisc/pqconstants.h" #include @@ -19,7 +19,7 @@ namespace Aviation /*! * \brief Base class for avionics */ -class CAvionicsBase : public BlackMisc::CBaseStreamStringifier +class CAvionicsBase : public BlackMisc::CStreamable { protected: QString m_name; //!< name of the unit diff --git a/src/blackmisc/aviomodulator.h b/src/blackmisc/aviomodulator.h index 3d6ca3a5a..ab7485c43 100644 --- a/src/blackmisc/aviomodulator.h +++ b/src/blackmisc/aviomodulator.h @@ -30,8 +30,8 @@ template class CModulator : public CAvionicsBase // If I do not have the method here, DBus metasystem tries to stream against // a container: inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container &list) // Once someone solves this, this methods should go and the - // CBaseStreamStringifier signature should be used - CBaseStreamStringifier &sf = uc; + // CStreamable signature should be used + CStreamable &sf = uc; return argument >> sf; } @@ -43,7 +43,7 @@ template class CModulator : public CAvionicsBase */ friend QDBusArgument &operator<<(QDBusArgument &argument, const AVIO &uc) { - const CBaseStreamStringifier &sf = uc; + const CStreamable &sf = uc; return argument << sf; } diff --git a/src/blackmisc/coordinategeodetic.h b/src/blackmisc/coordinategeodetic.h index 6883db106..3ec776e86 100644 --- a/src/blackmisc/coordinategeodetic.h +++ b/src/blackmisc/coordinategeodetic.h @@ -37,7 +37,7 @@ class ICoordinateGeodetic /*! * \brief Geodetic coordinate */ -class CCoordinateGeodetic : public CBaseStreamStringifier, public ICoordinateGeodetic +class CCoordinateGeodetic : public CStreamable, public ICoordinateGeodetic { private: BlackMisc::Geo::CLatitude m_latitude; //!< Latitude diff --git a/src/blackmisc/geoearthangle.h b/src/blackmisc/geoearthangle.h index ccb707659..4c76aad70 100644 --- a/src/blackmisc/geoearthangle.h +++ b/src/blackmisc/geoearthangle.h @@ -27,8 +27,8 @@ template class CEarthAngle : public BlackMisc::PhysicalQuantiti // If I do not have the method here, DBus metasystem tries to stream against // a container: inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container &list) // Once someone solves this, this methods should go and the - // CBaseStreamStringifier signature should be used - CBaseStreamStringifier &sf = uc; + // CStreamable signature should be used + CStreamable &sf = uc; return argument >> sf; } @@ -40,7 +40,7 @@ template class CEarthAngle : public BlackMisc::PhysicalQuantiti */ friend QDBusArgument &operator<<(QDBusArgument &argument, const LATorLON &uc) { - const CBaseStreamStringifier &sf = uc; + const CStreamable &sf = uc; return argument << sf; } diff --git a/src/blackmisc/mathmatrixbase.h b/src/blackmisc/mathmatrixbase.h index 7b6897f69..ca11bb417 100644 --- a/src/blackmisc/mathmatrixbase.h +++ b/src/blackmisc/mathmatrixbase.h @@ -6,7 +6,7 @@ #ifndef BLACKMISC_MATHMATRIXBASE_H #define BLACKMISC_MATHMATRIXBASE_H -#include "blackmisc/basestreamstringifier.h" +#include "blackmisc/streamable.h" #include "blackmisc/mathvector3dbase.h" #include #include @@ -19,7 +19,7 @@ namespace Math /*! * \brief Base functionality of a matrix */ -template class CMatrixBase : public BlackMisc::CBaseStreamStringifier +template class CMatrixBase : public BlackMisc::CStreamable { private: /*! diff --git a/src/blackmisc/mathvector3dbase.h b/src/blackmisc/mathvector3dbase.h index 7bd0fdc0e..b5c9e1ea8 100644 --- a/src/blackmisc/mathvector3dbase.h +++ b/src/blackmisc/mathvector3dbase.h @@ -6,7 +6,7 @@ #ifndef BLACKMISC_MATHVECTOR3DBASE_H #define BLACKMISC_MATHVECTOR3DBASE_H -#include "blackmisc/basestreamstringifier.h" +#include "blackmisc/streamable.h" #include "blackmisc/mathematics.h" namespace BlackMisc @@ -21,7 +21,7 @@ class CMatrix3x1; // forward declaration /*! * \brief 3D vector base (x, y, z) */ -template class CVector3DBase : public CBaseStreamStringifier +template class CVector3DBase : public CStreamable { /*! * \brief Unmarshalling operator >>, DBus to object @@ -34,8 +34,8 @@ template class CVector3DBase : public CBaseStreamStringifier // If I do not have the method here, DBus metasystem tries to stream against // a container: inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container &list) // Once someone solves this, this methods should go and the - // CBaseStreamStringifier signature should be used - CBaseStreamStringifier &sf = uc; + // CStreamable signature should be used + CStreamable &sf = uc; return argument >> sf; } @@ -47,7 +47,7 @@ template class CVector3DBase : public CBaseStreamStringifier */ friend QDBusArgument &operator<<(QDBusArgument &argument, const ImplVector &uc) { - const CBaseStreamStringifier &sf = uc; + const CStreamable &sf = uc; return argument << sf; } diff --git a/src/blackmisc/pqbase.h b/src/blackmisc/pqbase.h index 4bee55a0a..0576109ad 100644 --- a/src/blackmisc/pqbase.h +++ b/src/blackmisc/pqbase.h @@ -6,7 +6,7 @@ #ifndef BLACKMISC_PQBASE_H #define BLACKMISC_PQBASE_H -#include "blackmisc/basestreamstringifier.h" +#include "blackmisc/streamable.h" #include "blackmisc/debug.h" #include "blackmisc/mathematics.h" #include @@ -27,7 +27,7 @@ namespace PhysicalQuantities * See here for an overview. * Use the static values such as CMeasurementPrefix::k() to specify values. */ -class CMeasurementPrefix : public CBaseStreamStringifier +class CMeasurementPrefix : public CStreamable { private: QString m_name; //!< name, e.g. "kilo" @@ -267,7 +267,7 @@ public: /*! * \brief Base class for all units, such as meter, hertz. */ -class CMeasurementUnit : public CBaseStreamStringifier +class CMeasurementUnit : public CStreamable { protected: /*! diff --git a/src/blackmisc/pqphysicalquantity.h b/src/blackmisc/pqphysicalquantity.h index 20ac9b10f..acdc6794e 100644 --- a/src/blackmisc/pqphysicalquantity.h +++ b/src/blackmisc/pqphysicalquantity.h @@ -24,7 +24,7 @@ namespace PhysicalQuantities /*! * \brief A physical quantity such as "5m", "20s", "1500ft/s" */ -template class CPhysicalQuantity : public BlackMisc::CBaseStreamStringifier +template class CPhysicalQuantity : public BlackMisc::CStreamable { private: double m_value; //!< numeric part diff --git a/src/blackmisc/basestreamstringifier.h b/src/blackmisc/streamable.h similarity index 79% rename from src/blackmisc/basestreamstringifier.h rename to src/blackmisc/streamable.h index ca216096f..8e5394cf7 100644 --- a/src/blackmisc/basestreamstringifier.h +++ b/src/blackmisc/streamable.h @@ -1,5 +1,5 @@ -#ifndef BLACKMISC_BASESTREAMSTRINGIFIER_H -#define BLACKMISC_BASESTREAMSTRINGIFIER_H +#ifndef BLACKMISC_STREAMABLE_H +#define BLACKMISC_STREAMABLE_H #include "blackmisc/debug.h" #include @@ -12,10 +12,11 @@ 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 -class CBaseStreamStringifier +class CStreamable { /*! * \brief Stream << overload to be used in debugging messages @@ -23,7 +24,7 @@ class CBaseStreamStringifier * \param uc * \return */ - friend QDebug operator<<(QDebug debug, const CBaseStreamStringifier &uc) + friend QDebug operator<<(QDebug debug, const CStreamable &uc) { debug << uc.stringForStreaming(); return debug; @@ -35,7 +36,7 @@ class CBaseStreamStringifier * \param uc * \return */ - friend QTextStream &operator<<(QTextStream &textStream, const CBaseStreamStringifier &uc) + friend QTextStream &operator<<(QTextStream &textStream, const CStreamable &uc) { textStream << uc.stringForStreaming(); return textStream; @@ -47,7 +48,7 @@ class CBaseStreamStringifier * \param uc * \return */ - friend QNoDebug operator<<(QNoDebug nodebug, const CBaseStreamStringifier & /* uc */) + friend QNoDebug operator<<(QNoDebug nodebug, const CStreamable & /* uc */) { return nodebug; } @@ -58,7 +59,7 @@ class CBaseStreamStringifier * \param uc * \return */ - friend QDataStream &operator<<(QDataStream &stream, const CBaseStreamStringifier &uc) + friend QDataStream &operator<<(QDataStream &stream, const CStreamable &uc) { stream << uc.stringForStreaming(); return stream; @@ -70,7 +71,7 @@ class CBaseStreamStringifier * \param uc * \return */ - friend CLogMessage operator<<(CLogMessage log, const CBaseStreamStringifier &uc) + friend CLogMessage operator<<(CLogMessage log, const CStreamable &uc) { log << uc.stringForStreaming(); return log; @@ -82,7 +83,7 @@ class CBaseStreamStringifier * \param uc * \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(); return ostr; @@ -94,7 +95,7 @@ class CBaseStreamStringifier * \param uc * \return */ - friend const QDBusArgument &operator>>(const QDBusArgument &argument, CBaseStreamStringifier &uc) + friend const QDBusArgument &operator>>(const QDBusArgument &argument, CStreamable &uc) { argument.beginStructure(); uc.unmarshallFromDbus(argument); @@ -108,7 +109,7 @@ class CBaseStreamStringifier * \param pq * \return */ - friend QDBusArgument &operator<<(QDBusArgument &argument, const CBaseStreamStringifier &uc) + friend QDBusArgument &operator<<(QDBusArgument &argument, const CStreamable &uc) { argument.beginStructure(); uc.marshallToDbus(argument); @@ -120,7 +121,7 @@ public: /*! * \brief Virtual destructor */ - virtual ~CBaseStreamStringifier() {} + virtual ~CStreamable() {} /*! * \brief Cast as QString @@ -135,7 +136,7 @@ protected: /*! * \brief Default constructor */ - CBaseStreamStringifier() {} + CStreamable() {} /*! * \brief String for streaming operators @@ -172,7 +173,7 @@ protected: * class into an instance of a completely unrelated derived class. * \return */ - CBaseStreamStringifier& operator=(const CBaseStreamStringifier&) { return *this; } + CStreamable& operator=(const CStreamable&) { return *this; } }; } // namespace