Renaming, header, Doxygen, formatting (during refs #314)

This commit is contained in:
Klaus Basan
2014-08-23 23:25:42 +02:00
parent f311582c28
commit 3fb5087ea8
295 changed files with 2736 additions and 3031 deletions

View File

@@ -1,7 +1,11 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* Copyright (C) 2013
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "aircraftcfgentries.h"
#include "blackmisc/blackmiscfreefunctions.h"
@@ -61,22 +65,16 @@ namespace BlackSim
{
case IndexFilePath:
return this->m_filePath;
break;
case IndexTitle:
return this->m_title;
break;
case IndexAtcType:
return this->m_atcType;
break;
case IndexAtcModel:
return this->m_atcModel;
break;
case IndexParkingCode:
return this->m_atcParkingCode;
break;
case IndexEntryIndex:
return this->m_index;
break;
default:
break;
}

View File

@@ -1,12 +1,19 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* Copyright (C) 2013
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKSIM_FSCOMMON_AIRCRAFTCFGENTRY_H
#define BLACKSIM_FSCOMMON_AIRCRAFTCFGENTRY_H
#include "blackmisc/valueobject.h"
#include "blackmisc/propertyindex.h"
#include <QVariant>
namespace BlackSim
@@ -15,20 +22,104 @@ namespace BlackSim
{
/*!
* \brief Set of aircraft.cfg entries representing an aircraft (FSX)
* Set of aircraft.cfg entries representing an aircraft (FSX)
* \remarks an entry in the aircraft.cfg is title, atc type, ... This class already bundles
* relevant entries, hence the class is named Entries (plural)
*/
class CAircraftCfgEntries: public BlackMisc::CValueObject
{
private:
BLACK_ENABLE_TUPLE_CONVERSION(CAircraftCfgEntries)
qint32 m_index; //!< current index in given config
QString m_filePath; //!< file path of aircraft.cfg
QString m_title; //!< Title in aircraft.cfg
QString m_atcType; //!< ATC type
QString m_atcModel; //!< ATC model
QString m_atcParkingCode; //!< ATC parking code
public:
//! Properties by index
enum ColumnIndex
{
IndexEntryIndex = BlackMisc::CPropertyIndex::GlobalIndexCAircraftModel,
IndexFilePath,
IndexTitle,
IndexAtcType,
IndexAtcModel,
IndexParkingCode
};
//! Default constructor
CAircraftCfgEntries() {}
/*!
* Entries representing an aircraft
* \param filePath
* \param index
* \param title
* \param atcType
* \param atcModel
* \param atcParkingCode
*/
CAircraftCfgEntries(const QString &filePath, qint32 index, const QString &title, const QString &atcType, const QString &atcModel, const QString &atcParkingCode);
//! Virtual destructor
virtual ~CAircraftCfgEntries() {}
//! operator ==
bool operator ==(const CAircraftCfgEntries &other) const;
//! operator !=
bool operator !=(const CAircraftCfgEntries &other) const;
//! \copydoc CValueObject::propertyByIndex
QVariant propertyByIndex(int index) const;
//! Filepath
QString getFilePath() const { return this->m_filePath; }
//! Title
QString getTitle() const { return this->m_title; }
//! Index
qint32 getIndex() const { return this->m_index; }
//! ATC model
QString getAtcModel() const { return this->m_atcModel; }
//! ATC type
QString getAtcType() const { return this->m_atcType; }
//! ATC parking code
QString getAtcParkingCode() const { return this->m_atcParkingCode; }
//! Filepath
void setFilePath(const QString &filePath) { this->m_filePath = filePath; }
//! Title
void setTitle(const QString &title) { this->m_title = title; }
//! Index
void setIndex(const qint32 index) { this->m_index = index; }
//! ATC model
void setAtcModel(const QString &atcModel) { this->m_atcModel = atcModel; }
//! ATC type
void setAtcType(const QString &atcType) { this->m_atcType = atcType; }
//! Parking code
void setAtcParkingCode(const QString &parkingCode) { this->m_atcParkingCode = parkingCode; }
//! \copydoc CValueObject::getValueHash()
virtual uint getValueHash() const override;
//! \copydoc CValueObject::toQVariant()
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
//! \copydoc CValueObject::toJson
virtual QJsonObject toJson() const override;
//! \copydoc CValueObject::fromJson
virtual void fromJson(const QJsonObject &json) override;
//! Register the metatypes
static void registerMetadata();
//! Members
static const QStringList &jsonMembers();
protected:
//! \copydoc CValueObject::convertToQString
@@ -46,101 +137,15 @@ namespace BlackSim
//! \copydoc CValueObject::getMetaTypeId()
int getMetaTypeId() const override;
public:
private:
BLACK_ENABLE_TUPLE_CONVERSION(CAircraftCfgEntries)
qint32 m_index; //!< current index in given config
QString m_filePath; //!< file path of aircraft.cfg
QString m_title; //!< Title in aircraft.cfg
QString m_atcType; //!< ATC type
QString m_atcModel; //!< ATC model
QString m_atcParkingCode; //!< ATC parking code
//! \brief Properties by index
enum ColumnIndex
{
IndexEntryIndex = 0,
IndexFilePath,
IndexTitle,
IndexAtcType,
IndexAtcModel,
IndexParkingCode
};
//! \brief Default constructor
CAircraftCfgEntries() {}
/*!
* \brief Entries representing an aircraft
* \param filePath
* \param index
* \param title
* \param atcType
* \param atcModel
* \param atcParkingCode
*/
CAircraftCfgEntries(const QString &filePath, qint32 index, const QString &title, const QString &atcType, const QString &atcModel, const QString &atcParkingCode);
//! \brief Virtual destructor
virtual ~CAircraftCfgEntries() {}
//! \brief operator ==
bool operator ==(const CAircraftCfgEntries &other) const;
//! \brief operator !=
bool operator !=(const CAircraftCfgEntries &other) const;
//! \copydoc CValueObject::propertyByIndex
QVariant propertyByIndex(int index) const;
//! \brief Filepath
QString getFilePath() const { return this->m_filePath; }
//! \brief Title
QString getTitle() const { return this->m_title; }
//! \brief Index
qint32 getIndex() const { return this->m_index; }
//! \brief ATC model
QString getAtcModel() const { return this->m_atcModel; }
//! \brief ATC type
QString getAtcType() const { return this->m_atcType; }
//! \brief ATC parking code
QString getAtcParkingCode() const { return this->m_atcParkingCode; }
//! \brief Filepath
void setFilePath(const QString &filePath) { this->m_filePath = filePath; }
//! \brief Title
void setTitle(const QString &title) { this->m_title = title; }
//! \brief Index
void setIndex(const qint32 index) { this->m_index = index; }
//! \brief ATC model
void setAtcModel(const QString &atcModel) { this->m_atcModel = atcModel; }
//! \brief ATC type
void setAtcType(const QString &atcType) { this->m_atcType = atcType; }
//! \brief Parking code
void setAtcParkingCode(const QString &parkingCode) { this->m_atcParkingCode = parkingCode; }
//! \copydoc CValueObject::getValueHash()
virtual uint getValueHash() const override;
//! \copydoc CValueObject::toQVariant()
virtual QVariant toQVariant() const override
{
return QVariant::fromValue(*this);
}
//! \brief Register the metatypes
static void registerMetadata();
//! \copydoc CValueObject::toJson
virtual QJsonObject toJson() const override;
//! \copydoc CValueObject::fromJson
virtual void fromJson(const QJsonObject &json) override;
//! \brief Members
static const QStringList &jsonMembers();
};
}
} // namespace

View File

@@ -1,7 +1,11 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* Copyright (C) 2013
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "aircraftcfgentrieslist.h"

View File

@@ -1,7 +1,13 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* Copyright (C) 2013
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKSIM_FSCOMMON_AIRCRAFTCFG_H
#define BLACKSIM_FSCOMMON_AIRCRAFTCFG_H
@@ -19,22 +25,22 @@ namespace BlackSim
namespace FsCommon
{
//! \brief Utility, providing FSX aircraft.cfg entries
//! Utility, providing FSX aircraft.cfg entries
class CAircraftCfgEntriesList : public BlackMisc::CSequence<CAircraftCfgEntries>
{
private:
QString m_rootDirectory; //!< root directory reading aircraft.cfg files
bool m_readForDirectory; //!< valid read for given directory
//! \brief Read all entries in one directory
//! Read all entries in one directory
qint32 read(const QString &directory);
public:
//! \brief Constructor
//! Constructor
CAircraftCfgEntriesList(const QString &rootDirectory = "") : m_rootDirectory(rootDirectory), m_readForDirectory(false) {}
//! \brief Read all aircraft.cfg files starting from root directory
//! Read all aircraft.cfg files starting from root directory
qint32 read()
{
if (this->m_readForDirectory) return this->size();
@@ -45,7 +51,7 @@ namespace BlackSim
return this->read(this->m_rootDirectory);
}
//! \brief Change the directory
//! Change the directory
bool changeDirectory(const QString &directory)
{
if (this->m_rootDirectory != directory)
@@ -56,29 +62,30 @@ namespace BlackSim
return !directory.isEmpty() && this->existsDir(directory);
}
//! \brief Virtual destructor
//! Virtual destructor
virtual ~CAircraftCfgEntriesList() {}
//! \brief Does the directory exist?
//! Does the directory exist?
bool existsDir(const QString &directory = "") const;
//! \brief Has current directory been read?
//! Has current directory been read?
bool hasReadDirectory() const { return this->m_readForDirectory; }
//! \brief Current root directory
//! Current root directory
QString getRootDirectory() const { return this->m_rootDirectory; }
//! Contains model with title?
bool containsModeWithTitle(const QString &title, Qt::CaseSensitivity caseSensitivity = Qt::CaseInsensitive);
//! \brief Unknown entries
//! Unknown entries
static const CAircraftCfgEntries &UnknownCfgEntries()
{
static CAircraftCfgEntries entries;
return entries;
}
//! \brief Register metadata
//! Register metadata
static void registerMetadata();
};
}

View File

@@ -1,7 +1,11 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* Copyright (C) 2013
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "aircraftmapping.h"
#include "blackmisc/blackmiscfreefunctions.h"

View File

@@ -1,7 +1,13 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* Copyright (C) 2013
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKSIM_FSCOMMON_AIRCRAFTMAPPING_H
#define BLACKSIM_FSCOMMON_AIRCRAFTMAPPING_H
@@ -17,7 +23,7 @@ namespace BlackSim
namespace FsCommon
{
//! \brief Aircraft mapping class, represents one particular mapping
//! Aircraft mapping class, represents one particular mapping
class CAircraftMapping : public BlackMisc::CValueObject
{
@@ -42,20 +48,20 @@ namespace BlackSim
private:
BLACK_ENABLE_TUPLE_CONVERSION(CAircraftMapping)
qint32 m_mappingId; //!< Kind of primary key for this particular mapping
qint32 m_mappingId; //!< Kind of primary key for this particular mapping
qint32 m_proposalId; //!< If proposal id of the proposal
QString m_fsAircraftKey; //!< Id by which the simulator can create the aircraft
QString m_aircraftDesignator; //!< Aircraft designator such as B737
QString m_airlineDesignator; //!< Airline designator such as DLH
QString m_aircraftCombinedType; //!< Engine, type, number of engines L2J, L1P
QString m_fsAircraftKey; //!< Id by which the simulator can create the aircraft
QString m_aircraftDesignator; //!< Aircraft designator such as B737
QString m_airlineDesignator; //!< Airline designator such as DLH
QString m_aircraftCombinedType; //!< Engine, type, number of engines L2J, L1P
QString m_wakeTurbulenceCategory; //!< Wake turbulence category H, L, M
QString m_aircraftColor; //!< Aircrafts painting designator, could be same as airline or specific
QString m_lastChanged; //!< Simple timestamp as YYYYMMDDhhmmss
QString m_lastChanged; //!< Simple timestamp as YYYYMMDDhhmmss
BlackSim::CSimulatorInfo m_simulatorInfo; //!< Mapping is for simulator
bool m_changed; //! Changed flag
public:
//! \brief Columns
//! Columns
enum ColumnIndex
{
IndexMappingId = 0,
@@ -70,11 +76,11 @@ namespace BlackSim
IndexSimulatorInfo
};
//! \brief Default mapping
//! Default mapping
CAircraftMapping();
/*!
* \brief Complete constructor
* Complete constructor
* \param mappingId
* \param proposalId
* \param fsAircraftKey
@@ -88,117 +94,108 @@ namespace BlackSim
*/
CAircraftMapping(qint32 mappingId, qint32 proposalId, const QString &fsAircraftKey, const QString &icaoAircraftDesignator, const QString &icaoAirline, const QString &icaoAircraftType, const QString &icaoWakeTurbulenceCategory, const QString &painting, const QString &lastChanged, CSimulatorInfo simulator);
//! \brief Virtual destructor
//! Virtual destructor
virtual ~CAircraftMapping()
{}
//! \brief operator ==
//! operator ==
bool operator ==(const CAircraftMapping &otherMapping) const;
//! \brief operator !=
//! operator !=
bool operator !=(const CAircraftMapping &otherMapping) const;
//! \brief Mapping id
//! Mapping id
qint32 getMappingId() const { return this->m_mappingId; }
//! \brief Proposal id (if proposal, otherwise <0)
//! Proposal id (if proposal, otherwise <0)
qint32 getProposalId() const { return this->m_proposalId; }
//! \brief Aircraft key
//! Aircraft key
QString getFsAircraftKey() const { return this->m_fsAircraftKey; }
//! \brief ICAO designator (B737)
//! ICAO designator (B737)
QString getAircraftDesignator() const { return this->m_aircraftDesignator; }
//! \brief ICAO airline (DLH)
//! ICAO airline (DLH)
QString getAirlineDesignator() const { return this->m_airlineDesignator; }
//! \brief ICAO aircraft type (L2J)
//! ICAO aircraft type (L2J)
QString getAircraftCombinedType() const { return this->m_aircraftCombinedType; }
//! \brief ICAO wake turbulence category (L,M,H)
//! ICAO wake turbulence category (L,M,H)
QString getWakeTurbulenceCategory() const { return this->m_wakeTurbulenceCategory; }
//! \brief Painting, basically the airline code for GA planes
//! Painting, basically the airline code for GA planes
QString getAircraftColor() const { return this->m_aircraftColor; }
//! \brief Last changed timestamp YYYYMMDDhhmmss
//! Last changed timestamp YYYYMMDDhhmmss
QString getLastChanged() const { return this->m_lastChanged; }
//! \brief Last changed timestamp YYYYMMDDhhmmss
//! Last changed timestamp YYYYMMDDhhmmss
QString getLastChangedFormatted() const;
//! \brief Simulator
//! Simulator
BlackSim::CSimulatorInfo getSimulatorInfo() const { return this->m_simulatorInfo; }
//! \brief Simulator
//! Simulator
QString getSimulatorText() const;
//! \brief Get changed flag
bool isChanged() const { return this->m_changed; }
//! \brief Valid data?
//! Valid data?
bool isValid() const
{
QString v = this->validate();
return v.isEmpty();
}
//! \brief Validate and return error messages, empty string means all OK.
//! Validate and return error messages, empty string means all OK.
QString validate() const;
//! \brief Set mapping id
//! Set mapping id
void setMappingId(qint32 mappingId) { this->m_mappingId = mappingId; }
//! \brief Proposal id
//! Proposal id
void setProposalId(qint32 proposalId) { this->m_proposalId = proposalId; }
//! \brief Aircraft key
//! Aircraft key
void setFsAircraftKey(const QString &aircraftKey) { this->m_fsAircraftKey = aircraftKey; }
//! \brief ICAO designator (B737)
//! ICAO designator (B737)
void setAircraftDesignator(const QString &icaoDesignator) { this->m_aircraftDesignator = icaoDesignator.toUpper(); }
//! \brief ICAO airline (DLH)
//! ICAO airline (DLH)
void setAirlineDesignator(const QString &airline) { this->m_airlineDesignator = airline.toUpper(); }
//! \brief ICAO aircraft type (L2J)
//! ICAO aircraft type (L2J)
void setAircraftCombinedType(const QString &aircraftType) { this->m_aircraftCombinedType = aircraftType.toUpper(); }
//! \brief ICAO wake turbulence category
//! ICAO wake turbulence category
void setWakeTurbulenceCategory(const QString &wtc) { this->m_wakeTurbulenceCategory = wtc.toUpper(); }
//! \brief Painting, basically the airline code for GA planes
//! Painting, basically the airline code for GA planes
void setAircraftColor(const QString &painting) { this->m_aircraftColor = painting; }
//! \brief Last changed timestamp YYYYMMDDhhmmss
//! Last changed timestamp YYYYMMDDhhmmss
void setLastChanged(qint32 lastChanged) { this->m_lastChanged = lastChanged; }
//! \brief Simulator
//! Simulator
void setSimulator(BlackSim::CSimulatorInfo simulator) { this->m_simulatorInfo = simulator; }
//! \brief Set simulator text
//! Set simulator text
void setSimulatorText(const QString &simulator);
//! \brief Set changed flag
void setChanged(bool changed) { this->m_changed = changed; }
//! \copydoc CValueObject::propertyByIndex
QVariant propertyByIndex(int index) const override;
//! \copydoc CValueObject::setPropertyByIndex()
void setPropertyByIndex(const QVariant &value, int index) override;
void setPropertyByIndex(const QVariant &value, const BlackMisc::CPropertyIndex &index) override;
//! \copydoc CValueObject::toQVariant()
virtual QVariant toQVariant() const override
{
return QVariant::fromValue(*this);
}
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
//! \copydoc CValueObject::getValueHash()
virtual uint getValueHash() const override;
//! \brief Current UTC timestamp
//! Current UTC timestamp
static QString currentUtcTimestamp()
{
QDateTime dateTime = QDateTime::currentDateTimeUtc();
@@ -212,10 +209,10 @@ namespace BlackSim
//! \copydoc CValueObject::fromJson
virtual void fromJson(const QJsonObject &json) override;
//! \brief Register metadata
//! Register metadata
static void registerMetadata();
//! \brief Members
//! Members
static const QStringList &jsonMembers();
};
} // namespace

View File

@@ -1,7 +1,13 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* Copyright (C) 2013
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKSIM_FSCOMMON_AIRCRAFTMAPPINGS_H
#define BLACKSIM_FSCOMMON_AIRCRAFTMAPPINGS_H
@@ -18,25 +24,26 @@ namespace BlackSim
{
namespace FsCommon
{
//! \brief Aircraft mappings
//! Aircraft mappings
class CAircraftMappingList : public BlackMisc::CSequence<CAircraftMapping>
{
public:
//! \brief Default constructor
//! Default constructor
CAircraftMappingList() {}
//! \brief Virtual destructor
//! Virtual destructor
virtual ~CAircraftMappingList() {}
//! \brief Unknown mapping
//! Unknown mapping
static const CAircraftMapping &UnknownMapping()
{
static CAircraftMapping mapping;
return mapping;
}
//! \brief Register metadata
//! Register metadata
static void registerMetadata();
};
}

View File

@@ -1,7 +1,13 @@
/* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* Copyright (C) 2013
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKSIM_FSCOMMON_VPILOTMODELMAPPINGS_H
#define BLACKSIM_FSCOMMON_VPILOTMODELMAPPINGS_H