mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 20:40:29 +08:00
refs #452, adjusted aircraft/aviation classes
* support for loading from datastore * improved timestamp handling * new color and country classes * new attributes * updates for missing parts in CUser
This commit is contained in:
committed by
Mathew Sutcliffe
parent
c5f7179588
commit
ae24700299
65
src/blackmisc/countrylist.h
Normal file
65
src/blackmisc/countrylist.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 BLACKMISC_COUNTRYLIST_H
|
||||
#define BLACKMISC_COUNTRYLIST_H
|
||||
|
||||
#include "country.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "datastoreobjectlist.h"
|
||||
#include "blackmisc/collection.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include <initializer_list>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
//! Value object encapsulating a list of countries.
|
||||
//! \remark: I do not use CCollection as I want to sort per column
|
||||
class BLACKMISC_EXPORT CCountryList :
|
||||
public CSequence<CCountry>,
|
||||
public BlackMisc::IDatastoreObjectListWithStringKey<CCountry, CCountryList>,
|
||||
public BlackMisc::Mixin::MetaType<CCountryList>
|
||||
{
|
||||
public:
|
||||
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CCountryList)
|
||||
|
||||
//! Default constructor.
|
||||
CCountryList() = default;
|
||||
|
||||
//! Construct from a base class object.
|
||||
CCountryList(const CSequence<CCountry> &other);
|
||||
|
||||
//! Find by ISO code
|
||||
CCountry findByIsoCode(const QString &isoCode) const;
|
||||
|
||||
//! Find "best match" by country
|
||||
CCountry findBestMatchByCountryName(const QString &countryName) const;
|
||||
|
||||
//! ISO/name string list
|
||||
QStringList toIsoNameList() const;
|
||||
|
||||
//! Name/ISO string list
|
||||
QStringList toNameIsoList() const;
|
||||
|
||||
//! Name string list
|
||||
QStringList toNameList() const;
|
||||
|
||||
//! From our database JSON format
|
||||
static CCountryList fromDatabaseJson(const QJsonArray &array);
|
||||
};
|
||||
|
||||
} //namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCountryList)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::CCountry>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::CCountry>)
|
||||
|
||||
#endif //guard
|
||||
Reference in New Issue
Block a user