23 bpt::ptree lPTLocationList;
25 for (LocationList_T::const_iterator itLocation = iLocationList.begin();
26 itLocation != iLocationList.end(); ++itLocation) {
27 const Location& lLocation = *itLocation;
29 bpt::ptree lPTLocation;
35 if (lExtraLocationList.empty() ==
false) {
37 bpt::ptree lPTExtraLocationList;
40 for (LocationList_T::const_iterator itLoc = lExtraLocationList.begin();
41 itLoc != lExtraLocationList.end(); ++itLoc, ++idxExtra) {
42 const Location& lExtraLocation = *itLoc;
44 bpt::ptree lPTExtraLocation;
48 lPTExtraLocationList.push_back (std::make_pair(
"", lPTExtraLocation));
53 lPTLocation.add_child (
"extras", lPTExtraLocationList);
60 if (lAltLocationList.empty() ==
false) {
62 bpt::ptree lPTAltLocationList;
65 for (LocationList_T::const_iterator itLoc = lAltLocationList.begin();
66 itLoc != lAltLocationList.end(); ++itLoc, ++idxAlter) {
67 const Location& lAltLocation = *itLoc;
69 bpt::ptree lPTAltLocation;
73 lPTAltLocationList.push_back (std::make_pair (
"", lPTAltLocation));
78 lPTLocation.add_child (
"alternates", lPTAltLocationList);
82 lPTLocationList.push_back (std::make_pair (
"", lPTLocation));
86 lPT.add_child (
"locations", lPTLocationList);
89 write_json (oStream, lPT);
96 ioPTLocation.put (
"iata_code", iLocation.
getIataCode());
97 ioPTLocation.put (
"icao_code", iLocation.
getIcaoCode());
99 ioPTLocation.put (
"faa_code", iLocation.
getFaaCode());
100 ioPTLocation.put (
"state_code", iLocation.
getStateCode());
114 ioPTLocation.put (
"time_zone", iLocation.
getTimeZone());
117 ioPTLocation.put (
"page_rank", iLocation.
getPageRank());
118 ioPTLocation.put (
"wac", iLocation.
getWAC());
119 ioPTLocation.put (
"wac_name", iLocation.
getWACName());
120 ioPTLocation.put (
"wiki_link", iLocation.
getWikiLink());
124 ioPTLocation.put (
"matching_percentage", iLocation.
getPercentage());
131 bpt::ptree ptUNLOCodeList;
134 for (UNLOCodeList_T::const_iterator itUNLOCode = lUNCodeList.begin();
135 itUNLOCode != lUNCodeList.end(); ++itUNLOCode) {
140 ptUNLOCodeList.put (
"unlocode_code", lUNLOCode);
144 ioPTLocation.add_child (
"unlocode_codes", ptUNLOCodeList);
149 bpt::ptree ptCityList;
152 for (CityDetailsList_T::const_iterator itCity = lCityList.begin();
153 itCity != lCityList.end(); ++itCity) {
156 bpt::ptree ptCityDetails;
157 ptCityDetails.put (
"iata_code", lCityDetails.
getIataCode());
158 ptCityDetails.put (
"geonames_id", lCityDetails.
getGeonamesID());
159 ptCityDetails.put (
"name_utf", lCityDetails.
getUtfName());
160 ptCityDetails.put (
"name_ascii", lCityDetails.
getAsciiName());
163 ptCityList.push_back (std::make_pair (
"city_details", ptCityDetails));
167 ioPTLocation.add_child (
"cities", ptCityList);
172 bpt::ptree ptLocationNameList;
176 for (NameMatrix_T::const_iterator itNameList = lNameMatrix.begin();
177 itNameList != lNameMatrix.end(); ++itNameList) {
180 const Names& lNames = itNameList->second;
185 for (NameList_T::const_iterator itName = lNameList.begin();
186 itName != lNameList.end(); ++itName) {
187 const std::string& lName = *itName;
189 if (lName.empty() ==
false) {
190 bpt::ptree ptLocationName;
191 ptLocationName.put (
"name", lName);
192 ptLocationNameList.push_back (std::make_pair (
"", ptLocationName));
198 ioPTLocation.add_child (
"names", ptLocationNameList);
static void jsonExportLocationList(std::ostream &, const LocationList_T &)
static void jsonExportLocation(bpt::ptree &, const Location &)
std::map< LanguageCode_T, Names > NameMatrix_T
std::list< std::string > NameList_T
std::list< CityDetails > CityDetailsList_T
A list of cities, for instance the list of cities served by a travel-/transport-related POR (point of...
std::list< Location > LocationList_T
std::list< UNLOCode_T > UNLOCodeList_T
unsigned short NbOfMatches_T
Class modelling the elementary details of a city.
const IATACode_T & getIataCode() const
const CityASCIIName_T & getAsciiName() const
const CityUTFName_T & getUtfName() const
const GeonamesID_T & getGeonamesID() const
Structure modelling a (geographical) location.
const WikiLink_T & getWikiLink() const
const ICAOCode_T & getIcaoCode() const
const Admin1UTFName_T & getAdmin1UtfName() const
const LocationList_T & getExtraLocationList() const
const AltCountryCode_T & getAltCountryCode() const
const std::string & getOriginalKeywords() const
const IATACode_T & getIataCode() const
const Admin2Code_T & getAdmin2Code() const
const NameMatrix & getNameMatrix() const
const ContinentName_T & getContinentName() const
const Admin2UTFName_T & getAdmin2UtfName() const
const TimeZone_T & getTimeZone() const
const MatchingPercentage_T & getPercentage() const
const Admin3Code_T & getAdmin3Code() const
const WAC_T & getWAC() const
const Longitude_T & getLongitude() const
const GeonamesID_T & getGeonamesID() const
const std::string & getCorrectedKeywords() const
const NbOfErrors_T & getEditDistance() const
const UNLOCodeList_T & getUNLOCodeList() const
const CityDetailsList_T & getCityList() const
const Admin2ASCIIName_T & getAdmin2AsciiName() const
const CurrencyCode_T & getCurrencyCode() const
const WACName_T & getWACName() const
const CountryName_T & getCountryName() const
const LocationList_T & getAlternateLocationList() const
const NbOfErrors_T & getAllowableEditDistance() const
const Admin1Code_T & getAdmin1Code() const
const FAACode_T & getFaaCode() const
const CountryCode_T & getCountryCode() const
const StateCode_T & getStateCode() const
const PageRank_T & getPageRank() const
const Admin4Code_T & getAdmin4Code() const
const TvlPORListString_T & getTvlPORListString() const
const Admin1ASCIIName_T & getAdmin1AsciiName() const
const Latitude_T & getLatitude() const
const NameMatrix_T & getNameMatrix() const
const NameList_T & getNameList() const