23 #include "ip2cparser_v2.h"
25 #include "ip2c/ip2cparser.h"
26 #include "ip2c/ip2crange.h"
28 #include "datastreamoperatorwrapper.h"
32 bool IP2CParserV2::parse(
IP2CParser &
self, QIODevice &dataBase)
36 self.url_ =
"https://doomseeker.drdteam.org/ip2c/IpToCountry_v2.dat.php";
37 self.licences_[
""] =
"Please see the linked webpage for the licensing details of IP2C.\n" +
self.url_;
39 QDataStream dstream(&dataBase);
40 dstream.setByteOrder(QDataStream::LittleEndian);
43 return readSectionIpv4(
self, stream);
51 QMap<unsigned, IP2CRange> hashTable;
62 baseEntry.country = countryCode;
66 quint32 numOfIpBlocks = stream.readQUInt32();
68 for (quint32 x = 0; x < numOfIpBlocks; ++x)
73 entry.ipStart = stream.readQUInt32();
76 entry.ipEnd = stream.readQUInt32();
78 hashTable[entry.ipStart] = entry;
82 self.ranges_ = hashTable.values();