Removed template from basestreamstringifier as discussed in https://dev.vatsim-germany.org/boards/15/topics/497?r=503

This commit is contained in:
Klaus Basan
2013-05-10 22:56:36 +02:00
parent 7b3174fd96
commit abfd72552b
8 changed files with 31 additions and 16 deletions

View File

@@ -25,7 +25,7 @@ QString CAltitude::stringForConverter() const
/*
* Assigment
*/
CAltitude& CAltitude::operator =(const CAltitude &otherAltitude)
CAltitude &CAltitude::operator =(const CAltitude &otherAltitude)
{
// Check for self-assignment!
if (this == &otherAltitude) return *this;

View File

@@ -19,7 +19,7 @@ namespace Aviation
/*!
* \brief Base class for avionics
*/
class CAvionicsBase : public CBaseStreamStringifier<CAvionicsBase>
class CAvionicsBase : public CBaseStreamStringifier
{
private:

View File

@@ -12,7 +12,7 @@ namespace BlackMisc
/*!
* \brief Provides "to QString" and stream operators
*/
template <class UsingClass> class CBaseStreamStringifier
class CBaseStreamStringifier
{
/*!
* \brief Stream << overload to be used in debugging messages
@@ -20,13 +20,13 @@ template <class UsingClass> class CBaseStreamStringifier
* \param uc
* \return
*/
friend QDebug operator<<(QDebug debug, const UsingClass &uc)
friend QDebug operator<<(QDebug debug, const CBaseStreamStringifier &uc)
{
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
debug << sf.stringForStreaming();
return debug;
}
// msvc2010: friend QDebug &operator<<(QDebug &debug, const UsingClass &uc)
// msvc2010: friend QDebug &operator<<(QDebug &debug, const CBaseStreamStringifier &uc)
// MinGW: No reference
/*!
@@ -35,7 +35,7 @@ template <class UsingClass> class CBaseStreamStringifier
* \param uc
* \return
*/
friend QTextStream &operator<<(QTextStream &textStream, const UsingClass &uc)
friend QTextStream &operator<<(QTextStream &textStream, const CBaseStreamStringifier &uc)
{
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
textStream << sf.stringForStreaming();
@@ -48,7 +48,7 @@ template <class UsingClass> class CBaseStreamStringifier
* \param uc
* \return
*/
friend QNoDebug operator<<(QNoDebug nodebug, const UsingClass &uc)
friend QNoDebug operator<<(QNoDebug nodebug, const CBaseStreamStringifier & /* uc */)
{
return nodebug;
}
@@ -59,7 +59,7 @@ template <class UsingClass> class CBaseStreamStringifier
* \param uc
* \return
*/
friend QDataStream &operator<<(QDataStream &stream, const UsingClass &uc)
friend QDataStream &operator<<(QDataStream &stream, const CBaseStreamStringifier &uc)
{
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
stream << sf.stringForStreaming();
@@ -72,7 +72,7 @@ template <class UsingClass> class CBaseStreamStringifier
* \param uc
* \return
*/
friend CLogMessage operator<<(CLogMessage log, const UsingClass &uc)
friend CLogMessage operator<<(CLogMessage log, const CBaseStreamStringifier &uc)
{
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
log << sf.stringForStreaming();
@@ -85,7 +85,7 @@ template <class UsingClass> class CBaseStreamStringifier
* \param uc
* \return
*/
friend std::ostream &operator<<(std::ostream &ostr, const UsingClass &uc)
friend std::ostream &operator<<(std::ostream &ostr, const CBaseStreamStringifier &uc)
{
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
ostr << sf.stringForStreaming().toStdString();

View File

@@ -37,7 +37,7 @@ class ICoordinateGeodetic
* \brief Geodetic coordinate
*/
class CCoordinateGeodetic :
public CBaseStreamStringifier<CCoordinateGeodetic>,
public CBaseStreamStringifier,
public ICoordinateGeodetic
{

View File

@@ -18,7 +18,7 @@ namespace Math
/*!
* \brief Base functionality of a matrix
*/
template<class ImplMatrix, int Rows, int Columns> class CMatrixBase : public BlackMisc::CBaseStreamStringifier<ImplMatrix>
template<class ImplMatrix, int Rows, int Columns> class CMatrixBase : public BlackMisc::CBaseStreamStringifier
{
private:
/*!

View File

@@ -21,7 +21,7 @@ class CMatrix3x1; // forward declaration
/*!
* \brief 3D vector base (x, y, z)
*/
template <class ImplVector> class CVector3DBase : public CBaseStreamStringifier<ImplVector>
template <class ImplVector> class CVector3DBase : public CBaseStreamStringifier
{
private:

View File

@@ -23,7 +23,7 @@ namespace PhysicalQuantities
* Use the static values such CMeasurementMultiplier::k() as to specify values.
* \author KWB
*/
class CMeasurementPrefix : public CBaseStreamStringifier<CMeasurementPrefix>
class CMeasurementPrefix : public CBaseStreamStringifier
{
private:
QString m_name; //!< name, e.g. "kilo"
@@ -130,6 +130,14 @@ public:
return this->m_prefix;
}
/*!
* \brief Operator as double
*/
operator double() const
{
return this->m_factor;
}
// --- static units, always use these for initialization
// --- Remark: Static initialization in C++ is random, this is why no static members
// --- are used
@@ -143,6 +151,7 @@ public:
static CMeasurementPrefix none("", "", 0.0);
return none;
}
/*!
* \brief Unit "One"
* \return
@@ -152,6 +161,7 @@ public:
static CMeasurementPrefix one("one", "", 1.0);
return one;
}
/*!
* \brief Unit "mega"
* \return
@@ -161,6 +171,7 @@ public:
static CMeasurementPrefix mega("mega", "M", 1E6);
return mega;
}
/*!
* \brief Unit "kilo"
* \return
@@ -170,6 +181,7 @@ public:
static CMeasurementPrefix kilo("kilo", "k", 1000.0);
return kilo;
}
/*!
* \brief Unit "giga"
* \return
@@ -179,6 +191,7 @@ public:
static CMeasurementPrefix giga("giga", "G", 1E9);
return giga;
}
/*!
* \brief Unit "hecto"
* \return
@@ -188,6 +201,7 @@ public:
static CMeasurementPrefix hecto("hecto", "h", 100.0);
return hecto;
}
/*!
* \brief Unit "centi"
* \return
@@ -197,6 +211,7 @@ public:
static CMeasurementPrefix centi("centi", "c", 0.01);
return centi;
}
/*!
* \brief Unit "milli"
* \return
@@ -216,7 +231,7 @@ public:
/*!
* \brief Base class for all units, such as meter, hertz.
*/
class CMeasurementUnit: public CBaseStreamStringifier<CMeasurementUnit>
class CMeasurementUnit: public CBaseStreamStringifier
{
protected:
/*!

View File

@@ -21,7 +21,7 @@ namespace PhysicalQuantities
/*!
* \brief A physical quantity such as "5m", "20s", "1500ft/s"
*/
template <class MU, class PQ> class CPhysicalQuantity : public BlackMisc::CBaseStreamStringifier<PQ>
template <class MU, class PQ> class CPhysicalQuantity : public BlackMisc::CBaseStreamStringifier
{
private:
double m_unitValueD; //!< value backed by double