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());
102 ioPTLocation.put (
"faa_code", iLocation.
getFaaCode());
104 ioPTLocation.put (
"date_from", iLocation.
getDateFrom());
105 ioPTLocation.put (
"date_end", iLocation.
getDateEnd());
107 ioPTLocation.put (
"name_ascii", iLocation.
getAsciiName());
108 ioPTLocation.put (
"state_code", iLocation.
getStateCode());
123 ioPTLocation.put (
"time_zone", iLocation.
getTimeZone());
124 ioPTLocation.put (
"offset_gmt", iLocation.
getGMTOffset());
125 ioPTLocation.put (
"offset_dst", iLocation.
getDSTOffset());
126 ioPTLocation.put (
"offset_raw", iLocation.
getRawOffset());
132 ioPTLocation.put (
"elevation", iLocation.
getElevation());
133 ioPTLocation.put (
"gtopo30", iLocation.
getGTopo30());
134 ioPTLocation.put (
"page_rank", iLocation.
getPageRank());
135 ioPTLocation.put (
"wac", iLocation.
getWAC());
136 ioPTLocation.put (
"wac_name", iLocation.
getWACName());
137 ioPTLocation.put (
"wiki_link", iLocation.
getWikiLink());
141 ioPTLocation.put (
"matching_percentage", iLocation.
getPercentage());
148 bpt::ptree ptUNLOCodeList;
151 for (UNLOCodeList_T::const_iterator itUNLOCode = lUNCodeList.begin();
152 itUNLOCode != lUNCodeList.end(); ++itUNLOCode) {
157 ptUNLOCodeList.put (
"unlocode_code", lUNLOCode);
161 ioPTLocation.add_child (
"unlocode_codes", ptUNLOCodeList);
166 bpt::ptree ptCityList;
169 for (CityDetailsList_T::const_iterator itCity = lCityList.begin();
170 itCity != lCityList.end(); ++itCity) {
173 bpt::ptree ptCityDetails;
174 ptCityDetails.put (
"iata_code", lCityDetails.
getIataCode());
175 ptCityDetails.put (
"geonames_id", lCityDetails.
getGeonamesID());
176 ptCityDetails.put (
"name_utf", lCityDetails.
getUtfName());
177 ptCityDetails.put (
"name_ascii", lCityDetails.
getAsciiName());
180 ptCityList.push_back (std::make_pair (
"city_details", ptCityDetails));
184 ioPTLocation.add_child (
"cities", ptCityList);
189 bpt::ptree ptLocationNameList;
193 for (NameMatrix_T::const_iterator itNameList = lNameMatrix.begin();
194 itNameList != lNameMatrix.end(); ++itNameList) {
197 const Names& lNames = itNameList->second;
202 for (NameList_T::const_iterator itName = lNameList.begin();
203 itName != lNameList.end(); ++itName) {
204 const std::string& lName = *itName;
206 if (lName.empty() ==
false) {
207 bpt::ptree ptLocationName;
208 ptLocationName.put (
"name", lName);
209 ptLocationNameList.push_back (std::make_pair (
"", ptLocationName));
215 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 GeonamesID_T & getGeonamesID() const
const CityUTFName_T & getUtfName() const
const CityASCIIName_T & getAsciiName() const
Structure modelling a (geographical) location.
const Latitude_T & getGeonameLatitude() const
const FeatureCode_T & getFeatureCode() const
const LocationList_T & getExtraLocationList() const
const IATACode_T & getIataCode() const
const Longitude_T & getGeonameLongitude() const
const CurrencyCode_T & getCurrencyCode() const
const TvlPORListString_T & getTvlPORListString() const
const CommonName_T & getCommonName() const
const Longitude_T & getLongitude() const
const RawOffset_T & getRawOffset() const
const std::string & getCorrectedKeywords() const
const ContinentName_T & getContinentName() const
const Date_T & getDateFrom() const
const MatchingPercentage_T & getPercentage() const
const Admin3Code_T & getAdmin3Code() const
const GMTOffset_T & getGMTOffset() const
const NbOfErrors_T & getAllowableEditDistance() const
const Admin2Code_T & getAdmin2Code() const
const Elevation_T & getElevation() const
const NameMatrix & getNameMatrix() const
const WAC_T & getWAC() const
const Admin4Code_T & getAdmin4Code() const
const Latitude_T & getLatitude() const
const FeatureClass_T & getFeatureClass() const
const EnvelopeID_T & getEnvelopeID() const
const WACName_T & getWACName() const
const CountryCode_T & getCountryCode() const
const Admin1Code_T & getAdmin1Code() const
const ASCIIName_T & getAsciiName() const
const CityDetailsList_T & getCityList() const
const Admin1ASCIIName_T & getAdmin1AsciiName() const
const std::string & getOriginalKeywords() const
const AltCountryCode_T & getAltCountryCode() const
const FAACode_T & getFaaCode() const
const ContinentCode_T & getContinentCode() const
const Admin1UTFName_T & getAdmin1UtfName() const
const PageRank_T & getPageRank() const
const LocationList_T & getAlternateLocationList() const
const DSTOffset_T & getDSTOffset() const
const CountryName_T & getCountryName() const
const UNLOCodeList_T & getUNLOCodeList() const
const Date_T & getDateEnd() const
const Admin2UTFName_T & getAdmin2UtfName() const
const TimeZone_T & getTimeZone() const
const GTopo30_T & getGTopo30() const
const NbOfErrors_T & getEditDistance() const
const StateCode_T & getStateCode() const
const Population_T & getPopulation() const
const WikiLink_T & getWikiLink() const
const Date_T & getModificationDate() const
const Admin2ASCIIName_T & getAdmin2AsciiName() const
const ICAOCode_T & getIcaoCode() const
const GeonamesID_T & getGeonamesID() const
const NameMatrix_T & getNameMatrix() const
const NameList_T & getNameList() const