22 bpt::ptree lPTLocationList;
24 for (LocationList_T::const_iterator itLocation = iLocationList.begin();
25 itLocation != iLocationList.end(); ++itLocation) {
26 const Location& lLocation = *itLocation;
28 bpt::ptree lPTLocation;
34 if (lExtraLocationList.empty() ==
false) {
36 bpt::ptree lPTExtraLocationList;
39 for (LocationList_T::const_iterator itLoc = lExtraLocationList.begin();
40 itLoc != lExtraLocationList.end(); ++itLoc, ++idxExtra) {
41 const Location& lExtraLocation = *itLoc;
43 bpt::ptree lPTExtraLocation;
47 lPTExtraLocationList.push_back (std::make_pair(
"", lPTExtraLocation));
52 lPTLocation.add_child (
"extras", lPTExtraLocationList);
59 if (lAltLocationList.empty() ==
false) {
61 bpt::ptree lPTAltLocationList;
64 for (LocationList_T::const_iterator itLoc = lAltLocationList.begin();
65 itLoc != lAltLocationList.end(); ++itLoc, ++idxAlter) {
66 const Location& lAltLocation = *itLoc;
68 bpt::ptree lPTAltLocation;
72 lPTAltLocationList.push_back (std::make_pair (
"", lPTAltLocation));
77 lPTLocation.add_child (
"alternates", lPTAltLocationList);
81 lPTLocationList.push_back (std::make_pair (
"", lPTLocation));
85 lPT.add_child (
"locations", lPTLocationList);
88 write_json (oStream, lPT);
95 ioPTLocation.put (
"iata_code", iLocation.
getIataCode());
96 ioPTLocation.put (
"icao_code", iLocation.
getIcaoCode());
98 ioPTLocation.put (
"faa_code", iLocation.
getFaaCode());
99 ioPTLocation.put (
"city_code", iLocation.
getCityCode());
102 ioPTLocation.put (
"state_code", iLocation.
getStateCode());
115 ioPTLocation.put (
"time_zone", iLocation.
getTimeZone());
118 ioPTLocation.put (
"page_rank", iLocation.
getPageRank());
119 ioPTLocation.put (
"wiki_link", iLocation.
getWikiLink());
122 ioPTLocation.put (
"matching_percentage", iLocation.
getPercentage());
126 bpt::ptree ptLocationNameList;
130 for (NameMatrix_T::const_iterator itNameList = lNameMatrix.begin();
131 itNameList != lNameMatrix.end(); ++itNameList) {
134 const Names& lNames = itNameList->second;
139 for (NameList_T::const_iterator itName = lNameList.begin();
140 itName != lNameList.end(); ++itName) {
141 const std::string& lName = *itName;
143 if (lName.empty() ==
false) {
144 bpt::ptree ptLocationName;
145 ptLocationName.put (
"name", lName);
146 ptLocationNameList.push_back (std::make_pair (
"", ptLocationName));
152 ioPTLocation.add_child (
"names", ptLocationNameList);
const Admin3Code_T & getAdmin3Code() const
const Admin1Code_T & getAdmin1Code() const
const CountryCode_T & getCountryCode() const
const Latitude_T & getLatitude() const
unsigned short NbOfMatches_T
Structure modelling a (geographical) location.
const Admin1ASCIIName_T & getAdmin1AsciiName() const
const CityASCIIName_T & getCityAsciiName() const
const FAACode_T & getFaaCode() const
const NbOfErrors_T & getAllowableEditDistance() const
const ContinentName_T & getContinentName() const
const NameMatrix_T & getNameMatrix() const
const Admin1UTFName_T & getAdmin1UtfName() const
const LocationList_T & getAlternateLocationList() const
std::list< std::string > NameList_T
const std::string & getCorrectedKeywords() const
const TvlPORListString_T & getTvlPORListString() const
const NameMatrix & getNameMatrix() const
const Admin2UTFName_T & getAdmin2UtfName() const
const PageRank_T & getPageRank() const
const GeonamesID_T & getGeonamesID() const
const ICAOCode_T & getIcaoCode() const
const MatchingPercentage_T & getPercentage() const
const NbOfErrors_T & getEditDistance() const
const CityUTFName_T & getCityUtfName() const
std::list< Location > LocationList_T
const IATACode_T & getIataCode() const
const Admin2Code_T & getAdmin2Code() const
const NameList_T & getNameList() const
const LocationList_T & getExtraLocationList() const
const Admin2ASCIIName_T & getAdmin2AsciiName() const
const CityCode_T & getCityCode() const
const std::string & getOriginalKeywords() const
std::map< LanguageCode_T, Names > NameMatrix_T
const Admin4Code_T & getAdmin4Code() const
const StateCode_T & getStateCode() const
static void jsonExportLocation(bpt::ptree &, const Location &)
const CountryName_T & getCountryName() const
const WikiLink_T & getWikiLink() const
static void jsonExportLocationList(std::ostream &, const LocationList_T &)
const TimeZone_T & getTimeZone() const
const Longitude_T & getLongitude() const