Release 2.3.3
[amule.git] / src / IP2Country.h
blob48220d6bb3b9483140df747808b0dff8c41b7845
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2004-2011 Marcelo Roberto Jimenez ( phoenix@amule.org )
5 // Copyright (c) 2006-2011 aMule Team ( admin@amule.org / http://www.amule.org )
6 //
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
9 // respective authors.
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 // Country flags are from FAMFAMFAM (http://www.famfamfam.com)
30 // Flag icons - http://www.famfamfam.com
32 // These icons are public domain, and as such are free for any use (attribution appreciated but not required).
34 // Note that these flags are named using the ISO3166-1 alpha-2 country codes where appropriate.
35 // A list of codes can be found at http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
37 // If you find these icons useful, please donate via paypal to mjames@gmail.com
38 // (or click the donate button available at http://www.famfamfam.com/lab/icons/silk)
40 // Contact: mjames@gmail.com
43 #ifndef IP2COUNTRY_H
44 #define IP2COUNTRY_H
46 #include "Types.h" // Needed for uint8, uint16 and uint32
48 #include <map>
50 #include <wx/image.h>
51 #include <wx/string.h>
54 typedef struct {
55 wxString Name;
56 wxImage Flag;
57 } CountryData;
60 typedef std::map<wxString, CountryData> CountryDataMap;
63 class CIP2Country {
64 public:
65 CIP2Country(const wxString& configDir);
66 ~CIP2Country();
67 const CountryData& GetCountryData(const wxString& ip);
68 void Enable();
69 void Disable();
70 void Update();
71 bool IsEnabled() { return m_geoip != NULL; }
72 void DownloadFinished(uint32 result);
74 private:
75 struct GeoIPTag *m_geoip;
76 CountryDataMap m_CountryDataMap;
77 wxString m_DataBaseName;
78 wxString m_DataBasePath;
80 void LoadFlags();
83 #endif // IP2COUNTRY_H