5 #ifndef TRUNK_GEONAMES_GEOREADER_V2_GEOREADER_H_
6 #define TRUNK_GEONAMES_GEOREADER_V2_GEOREADER_H_
8 #include <gtest/gtest.h>
11 #include <unordered_map>
19 #include "./Location.h"
20 #include "./Country.h"
28 void setStandardParameters();
31 void printError(
const string& errorMessage);
33 bool parseCommandlineArguments(
int argc,
char** argv);
36 void readCountryFile();
37 FRIEND_TEST(GeoReaderTest, readCountryFile);
38 void readAdmin1File();
39 FRIEND_TEST(GeoReaderTest, readAdmin1File);
40 void readAdmin2File();
41 FRIEND_TEST(GeoReaderTest, readAdmin2File);
44 void readAllCountries();
45 FRIEND_TEST(GeoReaderTest, readAllCountries);
49 void markReservedNames();
50 FRIEND_TEST(GeoReaderTest, markReservedNames);
52 void generateSuffixes();
53 FRIEND_TEST(GeoReaderTest, generateSuffixes);
56 void generateIsA(
const std::string& filename);
57 void generateLocatedIn(
const std::string& filename);
58 void generateHasPopulation(
const std::string& filename);
59 void generateHasLongitude(
const std::string& filename);
60 void generateHasLatitude(
const std::string& filename);
61 void generateHasCapital(
const std::string& filename);
64 string getAllCountriesFileName()
const {
return _allCountriesFileName; }
65 string getNoLocationFileName()
const {
return _noLocationFileName; }
66 string getCountryInfoFileName()
const {
return _countryInfoFileName; }
67 string getAdmin1FileName()
const {
return _admin1FileName; }
68 string getAdmin2FileName()
const {
return _admin2FileName; }
69 string getOutputDir()
const {
return _outputDir; }
73 std::unordered_map<string, int> _countryLookup;
75 std::unordered_map<string, int> _admin1Lookup;
77 std::unordered_map<string, int> _admin2Lookup;
80 std::unordered_map<int, Country> _countries;
82 std::unordered_map<int, Location> _admin1s;
83 std::unordered_map<int, Location> _admin2s;
84 std::unordered_map<int, Location> _cities;
87 std::vector<Location*> _capitals;
91 std::unordered_map<string, bool> _blackList;
93 void addToFile(
const string& fileName,
const std::ostringstream& text)
const;
96 void suffixGenerator(std::vector<Location*> duplicates);
99 const string sufString(
const Location* ptr,
const FeatureType f)
const;
100 const string sufString(
const Location* ptr,
const FeatureType f,
103 const bool isBListed(
const string& s)
const;
104 std::string _generateLatitude(
Location* loc);
105 std::string _generateLongitude(
Location* loc);
106 std::string _generatePopulation(
Location* loc);
107 std::string _generatePopulation(
Country* loc);
109 string _allCountriesFileName =
"";
110 string _noLocationFileName =
"";
111 string _countryInfoFileName =
"";
112 string _admin1FileName =
"";
113 string _admin2FileName =
"";
114 string _outputDir =
"./";
115 std::vector<std::string> _locationClasses;
116 int _populationLimit = 999;
119 #endif // TRUNK_GEONAMES_GEOREADER_V2_GEOREADER_H_