libtld 2.0.14
A library to determine the Top-Level Domain name of any Internet URI.
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
tld_definition Class Reference
Collaboration diagram for tld_definition:
Collaboration graph
[legend]

Public Types

typedef std::map< std::string, pointer_t > map_t
 
typedef std::shared_ptr< tld_definitionpointer_t
 
typedef std::vector< string_id_t > segments_t
 

Public Member Functions

 tld_definition (tld_definition const &)=default
 
 tld_definition (tld_string_manager &strings)
 
bool add_segment (std::string const &segment, std::string &errmsg)
 
void add_tag (std::string const &tag_name, std::string const &value, std::string &errmsg)
 
std::string get_apply_to () const
 
uint16_t get_end_offset () const
 
int get_index () const
 
std::string get_inverted_name () const
 Get the full TLD as a reversed domain name.
 
std::string get_name () const
 The domain name with periods separating each segment.
 
std::string get_parent_inverted_name () const
 
std::string get_parent_name () const
 
segments_t const & get_segments () const
 
uint16_t get_start_offset () const
 
tld_status get_status () const
 
tags_t const & get_tags () const
 
tld_definitionoperator= (tld_definition const &)
 
void reset_set_flags ()
 
bool set_apply_to (std::string const &apply_to)
 
void set_end_offset (uint16_t end)
 
void set_index (int idx)
 
void set_named_parameter (std::string const &name, std::string const &value, std::string &errmsg)
 
void set_start_offset (uint16_t start)
 
bool set_status (tld_status status)
 

Static Public Attributes

static constexpr std::uint32_t SET_APPLY_TO = 0x0080
 
static constexpr std::uint32_t SET_STATUS = 0x0002
 
static constexpr std::uint32_t SET_TLD = 0x0001
 

Private Attributes

std::string f_apply_to = std::string()
 
uint16_t f_end_offset = USHRT_MAX
 
int f_index = 0
 
int f_set = 0
 
uint16_t f_start_offset = USHRT_MAX
 
tld_status f_status = TLD_STATUS_VALID
 
tld_string_managerf_strings
 
tags_t f_tags = tags_t()
 
segments_t f_tld = segments_t()
 

Detailed Description

Definition at line 147 of file tld_compiler.h.

Member Typedef Documentation

◆ map_t

typedef std::map<std::string, pointer_t> tld_definition::map_t

Definition at line 152 of file tld_compiler.h.

◆ pointer_t

typedef std::shared_ptr<tld_definition> tld_definition::pointer_t

Definition at line 150 of file tld_compiler.h.

◆ segments_t

typedef std::vector<string_id_t> tld_definition::segments_t

Definition at line 151 of file tld_compiler.h.

Constructor & Destructor Documentation

◆ tld_definition()

tld_definition::tld_definition ( tld_string_manager strings)

Definition at line 742 of file tld_compiler.cpp.

Member Function Documentation

◆ add_segment()

bool tld_definition::add_segment ( std::string const &  segment,
std::string &  errmsg 
)

Definition at line 748 of file tld_compiler.cpp.

◆ add_tag()

void tld_definition::add_tag ( std::string const &  tag_name,
std::string const &  value,
std::string &  errmsg 
)

Definition at line 1042 of file tld_compiler.cpp.

◆ get_apply_to()

std::string tld_definition::get_apply_to ( ) const

Definition at line 1036 of file tld_compiler.cpp.

◆ get_end_offset()

uint16_t tld_definition::get_end_offset ( ) const

Definition at line 1193 of file tld_compiler.cpp.

◆ get_index()

int tld_definition::get_index ( ) const

Definition at line 986 of file tld_compiler.cpp.

◆ get_inverted_name()

std::string tld_definition::get_inverted_name ( ) const

This function re-assembles the domain segments in a full name in reverse order. This is used to properly sort sub-domain names (still part of the TLD) by their parent domain name.

We use '!' as the separate instead of the '.' because some domain names have a dash in their as the order still needs to be correct and '.' > '-' when we need the opposite, but '!' < '-'.

Returns
The concatenated domain name in reverse order with '!' as separators.

Definition at line 915 of file tld_compiler.cpp.

◆ get_name()

std::string tld_definition::get_name ( ) const

This function rebuilds the full domain name. The idea is to have a way to write error messages about various errors including the domain name.

Returns
The name of the domain with each segment separated by periods.

Definition at line 884 of file tld_compiler.cpp.

◆ get_parent_inverted_name()

std::string tld_definition::get_parent_inverted_name ( ) const

Definition at line 961 of file tld_compiler.cpp.

◆ get_parent_name()

std::string tld_definition::get_parent_name ( ) const

Definition at line 934 of file tld_compiler.cpp.

◆ get_segments()

tld_definition::segments_t const & tld_definition::get_segments ( ) const

Definition at line 871 of file tld_compiler.cpp.

◆ get_start_offset()

uint16_t tld_definition::get_start_offset ( ) const

Definition at line 1187 of file tld_compiler.cpp.

◆ get_status()

tld_status tld_definition::get_status ( ) const

Definition at line 1006 of file tld_compiler.cpp.

◆ get_tags()

tags_t const & tld_definition::get_tags ( ) const

Definition at line 1057 of file tld_compiler.cpp.

◆ reset_set_flags()

void tld_definition::reset_set_flags ( )

Definition at line 1063 of file tld_compiler.cpp.

◆ set_apply_to()

bool tld_definition::set_apply_to ( std::string const &  apply_to)

Definition at line 1012 of file tld_compiler.cpp.

◆ set_end_offset()

void tld_definition::set_end_offset ( uint16_t  end)

Definition at line 1181 of file tld_compiler.cpp.

◆ set_index()

void tld_definition::set_index ( int  idx)

Definition at line 980 of file tld_compiler.cpp.

◆ set_named_parameter()

void tld_definition::set_named_parameter ( std::string const &  name,
std::string const &  value,
std::string &  errmsg 
)

Definition at line 1069 of file tld_compiler.cpp.

◆ set_start_offset()

void tld_definition::set_start_offset ( uint16_t  start)

Definition at line 1172 of file tld_compiler.cpp.

◆ set_status()

bool tld_definition::set_status ( tld_status  status)

Definition at line 992 of file tld_compiler.cpp.

Member Data Documentation

◆ f_apply_to

std::string tld_definition::f_apply_to = std::string()
private

Definition at line 203 of file tld_compiler.h.

◆ f_end_offset

uint16_t tld_definition::f_end_offset = USHRT_MAX
private

Definition at line 208 of file tld_compiler.h.

◆ f_index

int tld_definition::f_index = 0
private

Definition at line 201 of file tld_compiler.h.

◆ f_set

int tld_definition::f_set = 0
private

Definition at line 199 of file tld_compiler.h.

◆ f_start_offset

uint16_t tld_definition::f_start_offset = USHRT_MAX
private

Definition at line 207 of file tld_compiler.h.

◆ f_status

tld_status tld_definition::f_status = TLD_STATUS_VALID
private

Definition at line 202 of file tld_compiler.h.

◆ f_strings

tld_string_manager& tld_definition::f_strings
private

Definition at line 197 of file tld_compiler.h.

◆ f_tags

tags_t tld_definition::f_tags = tags_t()
private

Definition at line 205 of file tld_compiler.h.

◆ f_tld

segments_t tld_definition::f_tld = segments_t()
private

Definition at line 200 of file tld_compiler.h.

◆ SET_APPLY_TO

constexpr std::uint32_t tld_definition::SET_APPLY_TO = 0x0080
staticconstexpr

Definition at line 156 of file tld_compiler.h.

◆ SET_STATUS

constexpr std::uint32_t tld_definition::SET_STATUS = 0x0002
staticconstexpr

Definition at line 155 of file tld_compiler.h.

◆ SET_TLD

constexpr std::uint32_t tld_definition::SET_TLD = 0x0001
staticconstexpr

Definition at line 154 of file tld_compiler.h.


The documentation for this class was generated from the following files:

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.