Files
privacore-open-source-searc…/CountryCode.h

37 lines
846 B
C
Raw Normal View History

2016-03-08 22:14:30 +01:00
#ifndef GB_COUNTRYCODE_H
#define GB_COUNTRYCODE_H
2013-08-02 13:12:24 -07:00
#include "HashTableT.h"
#include "types.h"
// . used by Events.cpp to keep things small
// . get a single byte country id from a 2 character country code
uint8_t getCountryId ( char *cc ) ;
// map a country id to the two letter country abbr
const char *getCountryCode ( uint16_t crid );
2013-08-02 13:12:24 -07:00
uint8_t guessCountryTLD(const char *url);
2013-08-02 13:12:24 -07:00
class CountryCode {
public:
CountryCode();
~CountryCode();
void init(void);
const char *getAbbr(int index);
const char *getName(int index);
int getIndexOfAbbr(const char *abbr);
bool loadHashTable(void);
void reset();
2016-03-05 10:52:34 +01:00
uint64_t getLanguagesWritten(int index);
2013-08-02 13:12:24 -07:00
private:
bool m_init;
2014-11-10 14:45:11 -08:00
HashTableT<uint16_t, int>m_abbrToIndex;
HashTableT<uint16_t, const char *>m_abbrToName;
2013-08-02 13:12:24 -07:00
};
extern CountryCode g_countryCode;
2016-03-08 22:14:30 +01:00
#endif // GB_COUNTRYCODE_H