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

Implementation of some functions converting numbers to strings. More...

#include "libtld/tld.h"
#include <string.h>
Include dependency graph for tld_strings.c:

Go to the source code of this file.

Functions

const char * tld_status_to_string (enum tld_status status)
 Transform the status to a string.
 
enum tld_category tld_word_to_category (const char *word, int n)
 This is for backward compatibility.
 

Detailed Description

This file includes functions converting numbers to strings.

Definition in file tld_strings.c.

Function Documentation

◆ tld_status_to_string()

const char * tld_status_to_string ( enum tld_status  status)

The status returned in a tld_info can be converted to a string using this function. This is useful to print out an error message.

Parameters
[in]statusThe status to convert to a string.
Returns
A string representing the input tld_status.

Definition at line 49 of file tld_strings.c.

References TLD_STATUS_DEPRECATED, TLD_STATUS_EXCEPTION, TLD_STATUS_INFRASTRUCTURE, TLD_STATUS_PROPOSED, TLD_STATUS_RESERVED, TLD_STATUS_UNDEFINED, TLD_STATUS_UNUSED, and TLD_STATUS_VALID.

Referenced by tld_file_to_json().

◆ tld_word_to_category()

enum tld_category tld_word_to_category ( const char *  word,
int  n 
)

Many times, a simple category is not useful because one TLD may actually be part of multiple groups (i.e. a groups, a country, a language, an entrepreneurial TLD can very well exist!)

The idea is to be backward compatible for anyone who was using the old category value. This function will convert the specified word in a category. The word is expected to be a non null terminated string, hence the parameter n to specify its length.

Parameters
[in]wordThe word to convert.
[in]nThe exact number of characters (bytes) in the word.
Returns
The corresponding TLD_CATEGORY_... or TLD_CATEGORY_UNDEFINED if the word could not be converted.

Definition at line 103 of file tld_strings.c.

References TLD_CATEGORY_BRAND, TLD_CATEGORY_CONTACT, TLD_CATEGORY_COUNTRY, TLD_CATEGORY_ENTREPRENEURIAL, TLD_CATEGORY_GROUP, TLD_CATEGORY_INTERNATIONAL, TLD_CATEGORY_LANGUAGE, TLD_CATEGORY_LOCATION, TLD_CATEGORY_PROFESSIONALS, TLD_CATEGORY_REGION, TLD_CATEGORY_TECHNICAL, and TLD_CATEGORY_UNDEFINED.

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.