File indexing completed on 2024-06-02 04:50:16
0001 // 0002 // Created by gabridc on 5/6/21. 0003 // 0004 #include "city.h" 0005 0006 City::City(const QString &cityID, const QString &name, const QString &continent, const QString &country, const double &latitude, const double &longitude, QObject *parent) : QObject(parent) 0007 , m_cityID(cityID) 0008 , m_name(name) 0009 , m_continent(continent) 0010 , m_country(country) 0011 , m_latitude(latitude) 0012 , m_longitude(longitude) 0013 0014 { 0015 0016 } 0017 0018 City::City(const City &other, QObject *parent) : QObject(parent) 0019 , m_cityID(other.id()) 0020 , m_name(other.name()) 0021 , m_continent(other.continent()) 0022 , m_country(other.country()) 0023 , m_latitude(other.latitude()) 0024 , m_longitude(other.longitude()) 0025 0026 { 0027 0028 } 0029 0030 0031 City::City(QObject* parent) : QObject(parent) 0032 { 0033 } 0034 0035 double City::latitude() const 0036 { 0037 return m_latitude; 0038 } 0039 0040 double City::longitude() const 0041 { 0042 return m_longitude; 0043 } 0044 0045 QString City::id() const 0046 { 0047 return m_cityID; 0048 } 0049 0050 QString City::name() const 0051 { 0052 return m_name; 0053 } 0054 0055 QString City::continent() const 0056 { 0057 return m_continent; 0058 } 0059 0060 QString City::country() const 0061 { 0062 return m_country; 0063 } 0064 0065 bool City::isValid() const 0066 { 0067 return !m_cityID.isEmpty(); 0068 } 0069 0070 bool City::match(double latitude, double longitude) 0071 { 0072 if(m_latitude == latitude && m_longitude == longitude) 0073 { 0074 return true; 0075 } 0076 0077 return false; 0078 }