libtld 2.0.14
A library to determine the Top-Level Domain name of any Internet URI.
Functions
tld_file.cpp File Reference

Implementation of the TLD file data handling. More...

#include "libtld/tld_file.h"
#include "libtld/tld.h"
#include "libtld/tld_data.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <limits.h>
#include <string.h>
Include dependency graph for tld_file.cpp:

Go to the source code of this file.

Functions

tld_description const * tld_file_description (tld_file const *file, uint32_t id)
 
const char * tld_file_errstr (tld_file_error err)
 
void tld_file_free (tld_file **file)
 
enum tld_file_error tld_file_load (char const *filename, tld_file **file)
 
tld_file_error tld_file_load_stream (tld_file **file, std::istream &in)
 
char const * tld_file_string (tld_file const *file, uint32_t id, uint32_t *length)
 
tld_tag const * tld_file_tag (tld_file const *file, uint32_t id)
 
char * tld_file_to_json (tld_file const *file)
 Transform a tld_file to a JSON string.
 

Detailed Description

This file handles the loading of the TLDs from an RIFF file.

Definition in file tld_file.cpp.

Function Documentation

◆ tld_file_description()

tld_description const * tld_file_description ( tld_file const *  file,
uint32_t  id 
)

Definition at line 352 of file tld_file.cpp.

◆ tld_file_errstr()

const char * tld_file_errstr ( tld_file_error  err)

Definition at line 298 of file tld_file.cpp.

◆ tld_file_free()

void tld_file_free ( tld_file **  file)

Definition at line 490 of file tld_file.cpp.

◆ tld_file_load()

enum tld_file_error tld_file_load ( char const *  filename,
tld_file **  file 
)

Definition at line 275 of file tld_file.cpp.

◆ tld_file_load_stream()

tld_file_error tld_file_load_stream ( tld_file **  file,
std::istream &  in 
)

Definition at line 51 of file tld_file.cpp.

◆ tld_file_string()

char const * tld_file_string ( tld_file const *  file,
uint32_t  id,
uint32_t *  length 
)

Definition at line 372 of file tld_file.cpp.

◆ tld_file_tag()

tld_tag const * tld_file_tag ( tld_file const *  file,
uint32_t  id 
)

Definition at line 362 of file tld_file.cpp.

◆ tld_file_to_json()

char * tld_file_to_json ( tld_file const *  file)

This function transforms a tld_file in a JSON string which gets returned. If something goes wrong, then the function may return a nullptr instead.

The returned strings must be freed by you with the free() function.

Parameters
[in]fileThe tld_file to transform to a JSON.
Returns
A string with the tld_file JSON or nullptr on error.

Definition at line 414 of file tld_file.cpp.

References tld_description::f_end_offset, tld_description::f_exception_apply_to, tld_description::f_start_offset, tld_description::f_status, tld_description::f_tags, tld_description::f_tags_count, tld_description::f_tld, tld(), and tld_status_to_string().

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.