0.08.01
C++ Open Travel Request Parsing Library
Toggle main menu visibility
Loading...
Searching...
No Matches
LocationKey.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
// OpenTrep
7
#include <
opentrep/LocationKey.hpp
>
8
#include <
opentrep/service/Logger.hpp
>
9
10
namespace
OPENTREP
{
11
12
// //////////////////////////////////////////////////////////////////////
13
LocationKey::LocationKey
(
const
IATACode_T
& iIataCode,
14
const
IATAType
& iIataType,
15
const
GeonamesID_T
& iGeonamesID) :
16
_iataCode (iIataCode), _iataType (iIataType), _geonamesID (iGeonamesID) {
17
if
(_geonamesID == 0) {
18
_isGeonames =
false
;
19
}
else
{
20
_isGeonames =
true
;
21
}
22
}
23
24
// //////////////////////////////////////////////////////////////////////
25
LocationKey::LocationKey
() :
26
_iataCode (
IATACode_T
(
""
)), _iataType (
IATAType
::LAST_VALUE),
27
_geonamesID (0), _isGeonames (false) {
28
assert (
false
);
29
}
30
31
// //////////////////////////////////////////////////////////////////////
32
LocationKey::LocationKey
(
const
LocationKey
& iLocationKey) :
33
_iataCode (iLocationKey._iataCode), _iataType (iLocationKey._iataType),
34
_geonamesID (iLocationKey._geonamesID),
35
_isGeonames (iLocationKey._isGeonames) {
36
}
37
38
// //////////////////////////////////////////////////////////////////////
39
LocationKey::~LocationKey
() {
40
}
41
42
// //////////////////////////////////////////////////////////////////////
43
bool
LocationKey::operator==
(
const
LocationKey
& iLocationKey)
const
{
44
const
bool
areEqual = (_iataCode == iLocationKey._iataCode
45
&& _iataType == iLocationKey._iataType
46
&& _geonamesID == iLocationKey._geonamesID);
47
return
areEqual;
48
}
49
50
// //////////////////////////////////////////////////////////////////////
51
std::string
LocationKey::describe
()
const
{
52
std::ostringstream oStr;
53
oStr << _iataCode <<
"-"
<< _iataType.getTypeAsString()
54
<<
"-"
<< _geonamesID;
55
56
return
oStr.str();
57
}
58
59
// //////////////////////////////////////////////////////////////////////
60
std::string
LocationKey::toString
()
const
{
61
std::ostringstream oStr;
62
oStr <<
describe
();
63
return
oStr.str();
64
}
65
66
// //////////////////////////////////////////////////////////////////////
67
void
LocationKey::toStream
(std::ostream& ioOut)
const
{
68
ioOut <<
toString
();
69
}
70
71
// //////////////////////////////////////////////////////////////////////
72
void
LocationKey::fromStream
(std::istream& ioIn) {
73
}
74
75
}
LocationKey.hpp
Logger.hpp
OPENTREP
Definition
BasChronometer.cpp:10
OPENTREP::GeonamesID_T
unsigned int GeonamesID_T
Definition
OPENTREP_Types.hpp:182
OPENTREP::IATACode_T
Definition
OPENTREP_Types.hpp:154
OPENTREP::IATAType
Enumeration of place/location types with respect to their use for transportation purposes.
Definition
IATAType.hpp:42
OPENTREP::LocationKey::~LocationKey
~LocationKey()
Definition
LocationKey.cpp:39
OPENTREP::LocationKey::toStream
void toStream(std::ostream &) const
Definition
LocationKey.cpp:67
OPENTREP::LocationKey::describe
std::string describe() const
Definition
LocationKey.cpp:51
OPENTREP::LocationKey::LocationKey
LocationKey(const IATACode_T &, const IATAType &, const GeonamesID_T &)
Definition
LocationKey.cpp:13
OPENTREP::LocationKey::toString
std::string toString() const
Definition
LocationKey.cpp:60
OPENTREP::LocationKey::operator==
bool operator==(const LocationKey &) const
Definition
LocationKey.cpp:43
OPENTREP::LocationKey::fromStream
void fromStream(std::istream &)
Definition
LocationKey.cpp:72
Generated on
for OpenTREP by
1.17.0