mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 18:25:37 +08:00
@@ -99,19 +99,35 @@ namespace BlackMisc
|
||||
public Mixin::Icon<CCollection<T>>
|
||||
{
|
||||
public:
|
||||
//! @{
|
||||
//! STL compatibility
|
||||
typedef T key_type;
|
||||
|
||||
//! STL compatibility
|
||||
typedef T value_type;
|
||||
|
||||
//! STL compatibility
|
||||
typedef T &reference;
|
||||
|
||||
//! STL compatibility
|
||||
typedef const T &const_reference;
|
||||
|
||||
//! STL compatibility
|
||||
typedef T *pointer;
|
||||
|
||||
//! STL compatibility
|
||||
typedef const T *const_pointer;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename QOrderedSet<T>::const_iterator const_iterator;
|
||||
|
||||
//! STL compatibility
|
||||
typedef const_iterator iterator; // can't modify elements in-place
|
||||
|
||||
//! STL compatibility
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
//! STL compatibility
|
||||
typedef int size_type;
|
||||
//! @}
|
||||
|
||||
//! Default constructor.
|
||||
CCollection() {}
|
||||
|
||||
@@ -98,17 +98,26 @@ namespace BlackMisc
|
||||
//! The implementation container
|
||||
using impl_type = Impl<Key, Value>;
|
||||
|
||||
//! @{
|
||||
//! STL compatibility
|
||||
typedef Key key_type;
|
||||
|
||||
//! STL compatibility
|
||||
typedef Value value_type;
|
||||
|
||||
//! STL compatibility
|
||||
typedef Value &reference;
|
||||
|
||||
//! STL compatibility
|
||||
typedef const Value &const_reference;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename Impl<Key, Value>::size_type size_type;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename Impl<Key, Value>::iterator iterator;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename Impl<Key, Value>::const_iterator const_iterator;
|
||||
//! @}
|
||||
|
||||
//! Return a copy containing only those elements for which the dictionary keys return true for a given predicate.
|
||||
template <class Predicate>
|
||||
@@ -304,25 +313,29 @@ namespace BlackMisc
|
||||
//! Returns const iterator at the end of the dictionary
|
||||
const_iterator cend() const { return m_impl.cend(); }
|
||||
|
||||
//! @{
|
||||
//! Returns const iterator for iterating over keys
|
||||
auto keyBegin() const { return m_impl.keyBegin(); }
|
||||
auto keyEnd() const { return m_impl.keyEnd(); }
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! Returns const iterator for iterating over keys
|
||||
auto keyEnd() const { return m_impl.keyEnd(); }
|
||||
|
||||
//! Returns iterator for iterating over keys and values together
|
||||
auto keyValueBegin() { return m_impl.keyValueBegin(); }
|
||||
auto keyValueEnd() { return m_impl.keyValueEnd(); }
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! Returns iterator for iterating over keys and values together
|
||||
auto keyValueEnd() { return m_impl.keyValueEnd(); }
|
||||
|
||||
//! Returns const iterator for iterating over keys and values together
|
||||
auto keyValueBegin() const { return m_impl.keyValueBegin(); }
|
||||
|
||||
//! Returns const iterator for iterating over keys and values together
|
||||
auto constKeyValueBegin() const { return m_impl.constKeyValueBegin(); }
|
||||
|
||||
//! Returns const iterator for iterating over keys and values together
|
||||
auto keyValueEnd() const { return m_impl.keyValueEnd(); }
|
||||
|
||||
//! Returns const iterator for iterating over keys and values together
|
||||
auto constKeyValueEnd() const { return m_impl.constKeyValueEnd(); }
|
||||
//! @}
|
||||
|
||||
//! Removes all items from the dictionary
|
||||
void clear() { m_impl.clear(); }
|
||||
|
||||
@@ -36,9 +36,9 @@ class QStringList;
|
||||
* \defgroup JSON Streaming operators for JSON
|
||||
*/
|
||||
|
||||
//! \ingroup JSON
|
||||
//! @{
|
||||
//! Streaming operators for QJsonValue (to value)
|
||||
//! \ingroup JSON
|
||||
BLACKMISC_EXPORT const QJsonValue &operator >>(const QJsonValue &json, int &value);
|
||||
BLACKMISC_EXPORT const QJsonValue &operator >>(const QJsonValue &json, qlonglong &value);
|
||||
BLACKMISC_EXPORT const QJsonValue &operator >>(const QJsonValue &json, qulonglong &value);
|
||||
|
||||
@@ -93,11 +93,11 @@
|
||||
)
|
||||
// *INDENT-ON*
|
||||
|
||||
//! @{
|
||||
//! std::string qHash
|
||||
inline uint qHash(const std::string &key, uint seed) { return qHash(QString::fromStdString(key), seed); }
|
||||
|
||||
//! std::string qHash
|
||||
inline uint qHash(const std::string &key) { return qHash(QString::fromStdString(key)); }
|
||||
//! @}
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
@@ -158,17 +158,17 @@ namespace BlackMisc::PhysicalQuantities
|
||||
//! Set value in current unit
|
||||
void setCurrentUnitValue(double value);
|
||||
|
||||
//! @{
|
||||
//! As integer value
|
||||
int valueInteger(MU unit) const;
|
||||
QString valueIntegerAsString(MU unit) const { return QString::number(this->valueInteger(unit)); }
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! As integer value
|
||||
QString valueIntegerAsString(MU unit) const { return QString::number(this->valueInteger(unit)); }
|
||||
|
||||
//! As integer value in current unit
|
||||
int valueInteger() const;
|
||||
|
||||
//! As integer value in current unit
|
||||
QString valueIntegerAsString() const { return QString::number(this->valueInteger()); }
|
||||
//! @}
|
||||
|
||||
//! Is value an integer
|
||||
bool isInteger() const;
|
||||
|
||||
@@ -85,21 +85,41 @@ namespace BlackMisc
|
||||
public Mixin::Icon<CSequence<T>>
|
||||
{
|
||||
public:
|
||||
//! @{
|
||||
//! STL compatibility
|
||||
typedef T key_type;
|
||||
|
||||
//! STL compatilibty
|
||||
typedef T value_type;
|
||||
|
||||
//! STL compatibility
|
||||
typedef T &reference;
|
||||
|
||||
//! STL compatibility
|
||||
typedef const T &const_reference;
|
||||
|
||||
//! STL compatibility
|
||||
typedef T *pointer;
|
||||
|
||||
//! STL compatibility
|
||||
typedef const T *const_pointer;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename QVector<T>::const_iterator const_iterator;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename QVector<T>::iterator iterator;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename QVector<T>::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
//! STL compatibility
|
||||
typedef typename QVector<T>::reverse_iterator reverse_iterator;
|
||||
|
||||
//! STL compatibility
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
//! STL compatibility
|
||||
typedef int size_type;
|
||||
//! @}
|
||||
|
||||
//! Default constructor.
|
||||
CSequence() = default;
|
||||
@@ -107,11 +127,11 @@ namespace BlackMisc
|
||||
//! Initializer list constructor.
|
||||
CSequence(std::initializer_list<T> il) : m_impl(il) {}
|
||||
|
||||
//! @{
|
||||
//! By QVector of type T.
|
||||
CSequence(const QVector<T> &vector) : m_impl(vector) {}
|
||||
|
||||
//! By QVector of type T.
|
||||
CSequence(QVector<T> &&vector) : m_impl(std::move(vector)) {}
|
||||
//! @}
|
||||
|
||||
//! By QList of type T.
|
||||
CSequence(const QList<T> &list) : m_impl(list.toVector()) {}
|
||||
@@ -135,11 +155,11 @@ namespace BlackMisc
|
||||
//! Destructor.
|
||||
~CSequence() = default;
|
||||
|
||||
//! @{
|
||||
//! Copy of internal vector.
|
||||
QVector<T> toVector() const & { return m_impl; }
|
||||
|
||||
//! Copy of internal vector.
|
||||
QVector<T> toVector() && { return std::move(m_impl); }
|
||||
//! @}
|
||||
|
||||
//! Returns iterator at the beginning of the sequence.
|
||||
iterator begin() { return m_impl.begin(); }
|
||||
|
||||
@@ -41,11 +41,23 @@ namespace BlackMisc
|
||||
public slots:
|
||||
//! \name Interface implementations
|
||||
//! @{
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::postEvent
|
||||
virtual void postEvent(const QString &channel, const BlackMisc::CVariant ¶m) override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::setSubscription
|
||||
virtual void setSubscription(const QString &channel, const BlackMisc::CVariantList &filters) override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::requestPeerSubscriptions
|
||||
virtual void requestPeerSubscriptions() override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::submitRequest
|
||||
virtual void submitRequest(const QString &channel, const BlackMisc::CVariant ¶m, quint32 token) override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::advertise
|
||||
virtual void advertise(const QString &channel) override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::withdraw
|
||||
virtual void withdraw(const QString &channel) override;
|
||||
//! @}
|
||||
|
||||
|
||||
@@ -34,12 +34,26 @@ namespace BlackMisc
|
||||
public slots:
|
||||
//! \name Interface implementations
|
||||
//! @{
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::postEvent
|
||||
virtual void postEvent(const QString &channel, const BlackMisc::CVariant ¶m) override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::setSubscription
|
||||
virtual void setSubscription(const QString &channel, const BlackMisc::CVariantList &filters) override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::requestPeerSubscriptions
|
||||
virtual void requestPeerSubscriptions() override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::submitRequest
|
||||
virtual void submitRequest(const QString &channel, const BlackMisc::CVariant ¶m, quint32 token) override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::reply
|
||||
virtual void reply(const BlackMisc::CVariant ¶m, quint32 token) override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::advertise
|
||||
virtual void advertise(const QString &channel) override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IDuplex::withdraw
|
||||
virtual void withdraw(const QString &channel) override;
|
||||
//! @}
|
||||
|
||||
|
||||
@@ -51,7 +51,11 @@ namespace BlackMisc
|
||||
public slots:
|
||||
//! \name Interface implementations
|
||||
//! @{
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IHub::openDuplex
|
||||
virtual bool openDuplex(const BlackMisc::CIdentifier &client) override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IHub::closeDuplex
|
||||
virtual void closeDuplex(const BlackMisc::CIdentifier &client) override;
|
||||
//! @}
|
||||
|
||||
|
||||
@@ -44,7 +44,11 @@ namespace BlackMisc
|
||||
public slots:
|
||||
//! \name Interface implementations
|
||||
//! @{
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IHub::openDuplex
|
||||
virtual bool openDuplex(const BlackMisc::CIdentifier &client) override;
|
||||
|
||||
//! \copydoc BlackMisc::SharedState::DBus::IHub::closeDuplex
|
||||
virtual void closeDuplex(const BlackMisc::CIdentifier &client) override;
|
||||
//! @}
|
||||
|
||||
|
||||
@@ -393,14 +393,32 @@ namespace BlackMisc::Simulation::Data
|
||||
public:
|
||||
//! \name Interface implementations
|
||||
//! @{
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::Data::IMultiSimulatorModelCaches::getCachedModels
|
||||
virtual CAircraftModelList getCachedModels(const CSimulatorInfo &simulator) const override { return instanceCaches().getCachedModels(simulator); }
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::Data::IMultiSimulatorModelCaches::setCachedModels
|
||||
virtual CStatusMessage setCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator) override { return instanceCaches().setCachedModels(models, simulator); }
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::Data::IMultiSimulatorModelCaches::getCacheTimestamp
|
||||
virtual QDateTime getCacheTimestamp(const CSimulatorInfo &simulator) const override { return instanceCaches().getCacheTimestamp(simulator); }
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::Data::IMultiSimulatorModelCaches::setCacheTimestamp
|
||||
virtual CStatusMessage setCacheTimestamp(const QDateTime &ts, const CSimulatorInfo &simulator) override { return instanceCaches().setCacheTimestamp(ts, simulator); }
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::Data::IMultiSimulatorModelCaches::synchronizeCache
|
||||
virtual void synchronizeCache(const CSimulatorInfo &simulator) override { return instanceCaches().synchronizeCache(simulator); }
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::Data::IMultiSimulatorModelCaches::admitCache
|
||||
virtual void admitCache(const CSimulatorInfo &simulator) override { return instanceCaches().admitCache(simulator); }
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::Data::IMultiSimulatorModelCaches::getFilename
|
||||
virtual QString getFilename(const CSimulatorInfo &simulator) const override { return instanceCaches().getFilename(simulator); }
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::Data::IMultiSimulatorModelCaches::isSaved
|
||||
virtual bool isSaved(const CSimulatorInfo &simulator) const override { return instanceCaches().isSaved(simulator); }
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::Data::IMultiSimulatorModelCaches::getDescription
|
||||
virtual QString getDescription() const override { return instanceCaches().getDescription(); }
|
||||
//! @}
|
||||
|
||||
|
||||
@@ -42,8 +42,20 @@ namespace BlackMisc::Simulation
|
||||
//! Zero initialized position array
|
||||
static const PosArray &zeroPosArray();
|
||||
|
||||
//! @{
|
||||
//! 3 coordinates for spline interpolation
|
||||
std::array<double, 3> x, y, z, a, gnd, t, dx, dy, dz, da, dgnd;
|
||||
std::array<double, 3> x;
|
||||
std::array<double, 3> y;
|
||||
std::array<double, 3> z;
|
||||
std::array<double, 3> a;
|
||||
std::array<double, 3> gnd;
|
||||
std::array<double, 3> t;
|
||||
std::array<double, 3> dx;
|
||||
std::array<double, 3> dy;
|
||||
std::array<double, 3> dz;
|
||||
std::array<double, 3> da;
|
||||
std::array<double, 3> dgnd;
|
||||
//! @}
|
||||
|
||||
//! Array size
|
||||
int size() const { return static_cast<int>(x.size()); }
|
||||
|
||||
@@ -152,71 +152,71 @@ namespace BlackMisc
|
||||
//! Construct a message with some specific categories.
|
||||
CMessageBase(const CLogCategoryList &categories, const CLogCategoryList &extra) : CMessageBase(categories) { this->addIfNotExisting(extra); }
|
||||
|
||||
//! @{
|
||||
//! Set the severity and format string.
|
||||
template <size_t N>
|
||||
Derived &log(StatusSeverity s, const char16_t (&m)[N]) { m_message = m; m_severity = s; return derived(); }
|
||||
|
||||
//! Set the severity and format string.
|
||||
Derived &log(StatusSeverity s, const QString &m) { m_message = m; m_severity = s; return derived(); }
|
||||
//! @}
|
||||
|
||||
//! Set the severity to debug.
|
||||
Derived &debug() { return log(SeverityDebug, QString()); }
|
||||
|
||||
//! @{
|
||||
//! Set the severity to debug, providing a format string.
|
||||
template <size_t N>
|
||||
Derived &debug(const char16_t (&format)[N]) { return log(SeverityDebug, format); }
|
||||
Derived &debug(const QString &format) { return log(SeverityDebug, format); }
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! Set the severity to debug, providing a format string.
|
||||
Derived &debug(const QString &format) { return log(SeverityDebug, format); }
|
||||
|
||||
//! Set the severity to info, providing a format string.
|
||||
template <size_t N>
|
||||
Derived &info(const char16_t (&format)[N]) { return log(SeverityInfo, format); }
|
||||
Derived &info(const QString &format) { return log(SeverityInfo, format); }
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! Set the severity to info, providing a format string.
|
||||
Derived &info(const QString &format) { return log(SeverityInfo, format); }
|
||||
|
||||
//! Set the severity to warning, providing a format string.
|
||||
template <size_t N>
|
||||
Derived &warning(const char16_t (&format)[N]) { return log(SeverityWarning, format); }
|
||||
Derived &warning(const QString &format) { return log(SeverityWarning, format); }
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! Set the severity to warning, providing a format string.
|
||||
Derived &warning(const QString &format) { return log(SeverityWarning, format); }
|
||||
|
||||
//! Set the severity to error, providing a format string.
|
||||
template <size_t N>
|
||||
Derived &error(const char16_t (&format)[N]) { return log(SeverityError, format); }
|
||||
Derived &error(const QString &format) { return log(SeverityError, format); }
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! Set the severity to error, providing a format string.
|
||||
Derived &error(const QString &format) { return log(SeverityError, format); }
|
||||
|
||||
//! Set the severity to s, providing a format string, and adding the validation category.
|
||||
template <size_t N>
|
||||
Derived &validation(StatusSeverity s, const char16_t (&format)[N]) { setValidation(); return log(s, format); }
|
||||
Derived &validation(StatusSeverity s, const QString &format) { setValidation(); return log(s, format); }
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! Set the severity to s, providing a format string, and adding the validation category.
|
||||
Derived &validation(StatusSeverity s, const QString &format) { setValidation(); return log(s, format); }
|
||||
|
||||
//! Set the severity to info, providing a format string, and adding the validation category.
|
||||
template <size_t N>
|
||||
Derived &validationInfo(const char16_t (&format)[N]) { setValidation(); return log(SeverityInfo, format); }
|
||||
Derived &validationInfo(const QString &format) { setValidation(); return log(SeverityInfo, format); }
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! Set the severity to info, providing a format string, and adding the validation category.
|
||||
Derived &validationInfo(const QString &format) { setValidation(); return log(SeverityInfo, format); }
|
||||
|
||||
//! Set the severity to warning, providing a format string, and adding the validation category.
|
||||
template <size_t N>
|
||||
Derived &validationWarning(const char16_t (&format)[N]) { setValidation(); return log(SeverityWarning, format); }
|
||||
Derived &validationWarning(const QString &format) { setValidation(); return log(SeverityWarning, format); }
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! Set the severity to warning, providing a format string, and adding the validation category.
|
||||
Derived &validationWarning(const QString &format) { setValidation(); return log(SeverityWarning, format); }
|
||||
|
||||
//! Set the severity to error, providing a format string, and adding the validation category.
|
||||
template <size_t N>
|
||||
Derived &validationError(const char16_t (&format)[N]) { setValidation(); return log(SeverityError, format); }
|
||||
|
||||
//! Set the severity to error, providing a format string, and adding the validation category.
|
||||
Derived &validationError(const QString &format) { setValidation(); return log(SeverityError, format); }
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! Deleted methods to avoid accidental implicit conversion from Latin-1 or UTF-8 string literals.
|
||||
@@ -231,16 +231,19 @@ namespace BlackMisc
|
||||
Derived &validationError(const char *) = delete;
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! Streaming operators.
|
||||
//! \details If the format string is empty, the message will consist of all streamed values separated by spaces.
|
||||
//! Otherwise, the streamed values will replace the place markers %1, %2, %3... in the format string.
|
||||
//! \see QString::arg
|
||||
template <class T, std::enable_if_t<TParameter<std::decay_t<T>>::passBy == ParameterPassBy::Value, int> = 0>
|
||||
Derived &operator <<(T v) { return arg(TString<T>::toQString(v)); }
|
||||
|
||||
//! Streaming operators.
|
||||
//! \details If the format string is empty, the message will consist of all streamed values separated by spaces.
|
||||
//! Otherwise, the streamed values will replace the place markers %1, %2, %3... in the format string.
|
||||
//! \see QString::arg
|
||||
template <class T, std::enable_if_t<TParameter<std::decay_t<T>>::passBy == ParameterPassBy::ConstRef, int> = 0>
|
||||
Derived &operator <<(const T &v) { return arg(TString<T>::toQString(v)); }
|
||||
//! @}
|
||||
|
||||
//! Message empty
|
||||
bool isEmpty() const { return this->m_message.isEmpty() && this->m_args.isEmpty(); }
|
||||
@@ -275,15 +278,20 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
protected:
|
||||
//! @{
|
||||
//! \private
|
||||
//! Private
|
||||
CStrongStringView m_message;
|
||||
|
||||
//! Private
|
||||
QStringList m_args;
|
||||
|
||||
//! Private
|
||||
CLogCategoryList m_categories = CLogCategoryList { CLogCategories::uncategorized() };
|
||||
|
||||
//! Private
|
||||
StatusSeverity m_severity = SeverityDebug;
|
||||
|
||||
//! Private
|
||||
QString message() const { return Private::arg(m_message.view(), m_args); }
|
||||
//! @}
|
||||
};
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user