libtld: /home/snapwebsites/snapcpp/contrib/libtld/src/tld_parser.cpp File Reference

libtld  1.5.13
A library to determine the Top-Level Domain name of any URL.
tld_parser.cpp File Reference

Parser of the tld_data.xml file. More...

#include "libtld/tld.h"
#include <QtCore/QMap>
#include <QtCore/QFile>
#include <QtCore/QTextStream>
#include <QtCore/QStringList>
#include <QtXml/QDomDocument>
#include <iostream>
#include <cstdlib>
Include dependency graph for tld_parser.cpp:

Go to the source code of this file.


class  snap::tld_info
 [internal] Class used to transform the XML data to TLD info structures. More...


 [internal] Namespace used by the TLD parser.


typedef QMap< QString, int > snap::country_map_t
 Type used to hold the list of all the countries.
typedef QMap< ushort, int > snap::tld_info_letters_t
 Type used to hold all the TLDs by letters. We're actually not using that at this point.
typedef QMap< QString, tld_infosnap::tld_info_map_t
 Type used to hold the list of all the info structures.


int main (int argc, char *argv[])
 Console tool to generate the tld_data.c file.
void snap::output_countries (const country_map_t &countries)
 Output the list of countries, each country has its own variable.
void snap::output_footer ()
 Output the tld_data.c footer.
void snap::output_header ()
 At this point we're not using this table. More...
void snap::output_tlds (tld_info_map_t &map, const country_map_t &countries)
 Prints out all the TLDs in our tld_data.c file for very fast access.
void snap::output_utf8 (QString const &str)
 Output UTF-8 strings using \xXX syntax so it works in any C compiler.
void snap::read_tlds (const QString &path, tld_info_map_t &map, country_map_t &countries)
 Read data from the tld_data.xml file.
void snap::save_offset (tld_info_map_t &map, const QString &tld, int offset)
 Save an offset in the info table.
void snap::setup_output (const QString &path)
 Setup the output file and stream for easy write of the output.
QString snap::tld_encode (const QString &tld, int &level)
 Encode a TLD so it gets sorted as expected.
void snap::verify_data (tld_info_map_t &map)
 Verify the data we read from the tld_data.xml.


QTextStream snap::out
 The output text stream that writes inside the output file.
QFile snap::out_file
 The output file.

Detailed Description

This file defines the parser of the XML data used to generate the tld_data.c file.

Definition in file tld_parser.cpp.

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly