fixing typos, doxygen, and style from #192

This commit is contained in:
Mathew Sutcliffe
2014-03-28 15:02:47 +00:00
parent c02e2732ff
commit 3ac59f0872
6 changed files with 19 additions and 54 deletions

View File

@@ -3,10 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*!
\file
*/
#include "audiodevice.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include <QtNetwork/QHostInfo>

View File

@@ -3,10 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*!
\file
*/
#include "json.h"
namespace BlackMisc

View File

@@ -18,18 +18,15 @@
#include <QStringList>
#include <utility>
/*!
* \defgroup JSON Streaming operators for JSON
*/
namespace BlackMisc
{
/**
* \defgroup JSON Streaming operators for JSON
* @{
*/
// -> streaming for CValueObject in valueobject.h
//! \name Streaming operators for QJsonValue (to value)
//! \remarks JSONVALUE: QJsonValue / QJsonValueRef
//@{
template<class JSONVALUE> typename
std::enable_if < std::is_same<JSONVALUE, QJsonValue>::value || std::is_same<JSONVALUE, QJsonValueRef>::value, JSONVALUE >::type
const &operator>>(const JSONVALUE &json, int &value)
@@ -93,10 +90,10 @@ namespace BlackMisc
value = QDateTime::fromString(json.toString());
return json;
}
//@}
//! \brief Specialized JSON serialization for enum
//! \remarks needs to be in global namespace
//! \ingroup JSON
template<class ENUM> typename
std::enable_if<std::is_enum<ENUM>::value, QJsonObject>::type
&operator<<(QJsonObject &json, std::pair<QString, ENUM> value)
@@ -106,6 +103,7 @@ namespace BlackMisc
}
//! \brief Specialized JSON deserialization for enum
//! \ingroup JSON
template<class JSONVALUE, class ENUM> typename
std::enable_if < std::is_enum<ENUM>::value &&(std::is_same<JSONVALUE, QJsonValue>::value || std::is_same<JSONVALUE, QJsonValueRef>::value), JSONVALUE >::type
const &operator>>(const JSONVALUE &json, ENUM &value)
@@ -115,7 +113,8 @@ namespace BlackMisc
}
//! \name Streaming operators for QJsonArray (from value)
//@{
//! \ingroup JSON
//! @{
QJsonArray &operator<<(QJsonArray &json, const int value);
QJsonArray &operator<<(QJsonArray &json, const std::pair<QString, qint16> &value);
QJsonArray &operator<<(QJsonArray &json, const qlonglong value);
@@ -125,10 +124,11 @@ namespace BlackMisc
QJsonArray &operator<<(QJsonArray &json, const double value);
QJsonArray &operator<<(QJsonArray &json, const bool value);
QJsonArray &operator<<(QJsonArray &json, const QDateTime &value);
//@}
//! @}
//! \name Streaming operators for QJsonObject (from value)
//@{
//! \ingroup JSON
//! @{
QJsonObject &operator<<(QJsonObject &json, const std::pair<QString, int> &value);
QJsonObject &operator<<(QJsonObject &json, const std::pair<QString, qint16> &value);
QJsonObject &operator<<(QJsonObject &json, const std::pair<QString, qlonglong> &value);
@@ -138,13 +138,12 @@ namespace BlackMisc
QJsonObject &operator<<(QJsonObject &json, const std::pair<QString, double> &value);
QJsonObject &operator<<(QJsonObject &json, const std::pair<QString, bool> &value);
QJsonObject &operator<<(QJsonObject &json, const std::pair<QString, QDateTime> &value);
//@}
//! @}
namespace Json
{
//! \brief Append to first JSON object (concatenate)
//! \ingroup JSON
inline QJsonObject &appendJsonObject(QJsonObject &target, const QJsonObject &toBeAppended)
{
if (toBeAppended.isEmpty()) return target;

View File

@@ -135,13 +135,6 @@ namespace BlackMisc
Q_UNUSED(object);
return std::tuple<>();
}
static const QStringList members()
{
static_assert(std::is_void<T>::value, // always false; is_void<> trick is just to make the condition dependent on the template parameter T
"Missing BLACK_DECLARE_TUPLE_CONVERSION macro for T");
static QStringList members;
return members;
}
static const QStringList jsonMembers()
{
static_assert(std::is_void<T>::value, // always false; is_void<> trick is just to make the condition dependent on the template parameter T
@@ -203,7 +196,7 @@ namespace BlackMisc
/*!
* \brief Convert to a JSON object
* \ingroup Tupels
* \ingroup Tuples
*/
template <class... Ts>
QJsonObject serializeJson(const QStringList &members, std::tuple<const Ts &...> tu)
@@ -215,7 +208,7 @@ namespace BlackMisc
/*!
* Convert from JSON to object
* \ingroup Tupels
* \ingroup Tuples
*/
template <class... Ts>
void deserializeJson(const QJsonObject &json, const QStringList &members, std::tuple<Ts &...> tu)
@@ -485,11 +478,8 @@ namespace BlackMisc
>> std::get<5>(tu) >> std::get<6>(tu) >> std::get<7>(tu) >> std::get<8>(tu) >> std::get<9>(tu);
}
inline void deserializeJson(const QJsonObject &json, const QStringList &members, std::tuple<> tu)
inline void deserializeJson(const QJsonObject &, const QStringList &, std::tuple<>)
{
Q_UNUSED(json);
Q_UNUSED(members);
Q_UNUSED(tu);
}
template <class T0>
@@ -667,9 +657,8 @@ namespace BlackMisc
qHash(std::get<5>(tu)) ^ qHash(std::get<6>(tu)) ^ qHash(std::get<7>(tu)) ^ qHash(std::get<8>(tu)) ^ qHash(std::get<9>(tu));
}
inline QJsonObject serializeJson(const QStringList &members, std::tuple<>)
inline QJsonObject serializeJson(const QStringList &, std::tuple<>)
{
Q_UNUSED(members);
QJsonObject json;
return json;
}

View File

@@ -112,8 +112,7 @@ namespace BlackMisc
template <class Tu>
static void serializeJson(QJsonObject &json, const QStringList &members, const Tu &tu)
{
typedef typename std::decay < typename std::tuple_element < N - 1, Tu >::type >::type TARGET;
json << std::pair<QString, TARGET>(members.at(N - 1), std::get < N - 1 > (tu));
json << std::make_pair(members.at(N - 1), std::get < N - 1 > (tu));
TupleHelper < N - 1 >::serializeJson(json, members, tu);
}
@@ -138,19 +137,9 @@ namespace BlackMisc
template <class Tu>
static uint hash(const Tu &) { return 0; }
template <class Tu>
static void serializeJson(QJsonObject &json, const QStringList &members, const Tu &tu)
{
Q_UNUSED(json);
Q_UNUSED(members);
Q_UNUSED(tu);
}
static void serializeJson(QJsonObject &, const QStringList &, const Tu &) {}
template <class Tu>
static void deserializeJson(const QJsonObject &json, const QStringList &members, Tu &tu)
{
Q_UNUSED(json);
Q_UNUSED(members);
Q_UNUSED(tu);
}
static void deserializeJson(const QJsonObject &, const QStringList &, Tu &) {}
};
#endif // Q_COMPILER_VARIADIC_TEMPLATES

View File

@@ -3,10 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*!
\file
*/
#include "voiceroom.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include <QChar>