Refactoring: Place m_variables inside Collections

This commit is contained in:
Felipe Zimmerle
2015-10-29 12:39:09 -03:00
parent 787be98122
commit b6ae0585cd
13 changed files with 253 additions and 261 deletions

View File

@@ -44,42 +44,42 @@ bool GeoLookup::evaluate(Assay *assay, const std::string &exp) {
}
if (ret && gir) {
if (gir->country_code) {
assay->m_variables.store("GEO:COUNTRY_CODE", gir->country_code);
assay->m_collections.store("GEO:COUNTRY_CODE", gir->country_code);
}
if (gir->country_code3) {
assay->m_variables.store("GEO:COUNTRY_CODE3", gir->country_code3);
assay->m_collections.store("GEO:COUNTRY_CODE3", gir->country_code3);
}
if (gir->country_name) {
assay->m_variables.store("GEO:COUNTRY_NAME", gir->country_name);
assay->m_collections.store("GEO:COUNTRY_NAME", gir->country_name);
}
if (gir->continent_code) {
assay->m_variables.store("GEO:COUNTRY_CONTINENT",
assay->m_collections.store("GEO:COUNTRY_CONTINENT",
gir->continent_code);
}
if (gir->country_code && gir->region) {
assay->m_variables.store("GEO:REGION",
assay->m_collections.store("GEO:REGION",
GeoIP_region_name_by_code(gir->country_code, gir->region));
}
if (gir->city) {
assay->m_variables.store("GEO:CITY", gir->city);
assay->m_collections.store("GEO:CITY", gir->city);
}
if (gir->postal_code) {
assay->m_variables.store("GEO:POSTAL_CODE", gir->postal_code);
assay->m_collections.store("GEO:POSTAL_CODE", gir->postal_code);
}
if (gir->latitude) {
assay->m_variables.store("GEO:LATITUDE",
assay->m_collections.store("GEO:LATITUDE",
std::to_string(gir->latitude));
}
if (gir->longitude) {
assay->m_variables.store("GEO:LONGITUDE",
assay->m_collections.store("GEO:LONGITUDE",
std::to_string(gir->longitude));
}
if (gir->metro_code) {
assay->m_variables.store("GEO:DMA_CODE",
assay->m_collections.store("GEO:DMA_CODE",
std::to_string(gir->metro_code));
}
if (gir->area_code) {
assay->m_variables.store("GEO:AREA_CODE",
assay->m_collections.store("GEO:AREA_CODE",
std::to_string(gir->area_code));
}