OpenTREP Logo  0.07.18
C++ Open Travel Request Parsing Library
Loading...
Searching...
No Matches
CityDetails.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4// STL
5#include <cassert>
6// OpenTrep
9
10namespace OPENTREP {
11
12 // //////////////////////////////////////////////////////////////////////
14 const GeonamesID_T& iGeonamesID,
15 const CityUTFName_T& iUtfName,
16 const CityASCIIName_T& iAsciiName,
17 const CountryCode_T& iCountryCode,
18 const StateCode_T& iStateCode) :
19 _iataCode (iIataCode), _geonamesID (iGeonamesID),
20 _utfName (iUtfName), _asciiName (iAsciiName),
21 _countryCode (iCountryCode), _stateCode (iStateCode) {
22 }
23
24 // //////////////////////////////////////////////////////////////////////
26 _iataCode (IATACode_T ("")), _geonamesID (0),
27 _utfName (""), _asciiName (""), _countryCode (""), _stateCode ("") {
28 assert (false);
29 }
30
31 // //////////////////////////////////////////////////////////////////////
32 CityDetails::CityDetails (const CityDetails& iCityDetails) :
33 _iataCode (iCityDetails._iataCode), _geonamesID (iCityDetails._geonamesID),
34 _utfName (iCityDetails._utfName), _asciiName (iCityDetails._asciiName),
35 _countryCode (iCityDetails._countryCode),
36 _stateCode (iCityDetails._stateCode) {
37 }
38
39 // //////////////////////////////////////////////////////////////////////
42
43 // //////////////////////////////////////////////////////////////////////
44 bool CityDetails::operator== (const CityDetails& iCityDetails) const {
45 const bool areEqual = (_iataCode == iCityDetails._iataCode
46 && _geonamesID == iCityDetails._geonamesID
47 && _utfName == iCityDetails._utfName
48 && _asciiName == iCityDetails._asciiName
49 && _countryCode == iCityDetails._countryCode
50 && _stateCode == iCityDetails._stateCode);
51 return areEqual;
52 }
53
54 // //////////////////////////////////////////////////////////////////////
55 std::string CityDetails::describe() const {
56 std::ostringstream oStr;
57 oStr << _iataCode << "|" << _geonamesID
58 << "|" << _utfName << "|" << _asciiName
59 << "|" << _countryCode << "|" << _stateCode;
60
61 return oStr.str();
62 }
63
64 // //////////////////////////////////////////////////////////////////////
65 std::string CityDetails::toString() const {
66 std::ostringstream oStr;
67 oStr << describe();
68 return oStr.str();
69 }
70
71 // //////////////////////////////////////////////////////////////////////
72 void CityDetails::toStream (std::ostream& ioOut) const {
73 ioOut << toString();
74 }
75
76 // //////////////////////////////////////////////////////////////////////
77 void CityDetails::fromStream (std::istream& ioIn) {
78 }
79
80}
unsigned int GeonamesID_T
std::string describe() const
void toStream(std::ostream &) const
std::string toString() const
bool operator==(const CityDetails &) const
CityDetails(const IATACode_T &, const GeonamesID_T &, const CityUTFName_T &, const CityASCIIName_T &, const CountryCode_T &, const StateCode_T &)
void fromStream(std::istream &)