Electroneum
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Language::Base Class Reference

A base language class which all languages have to inherit from for Polymorphism. More...

#include <language_base.h>

Inheritance diagram for Language::Base:
Inheritance graph
[legend]
Collaboration diagram for Language::Base:
Collaboration graph
[legend]

Public Member Functions

 Base (const char *language_name, const char *english_language_name, const std::vector< std::string > &words, uint32_t prefix_length)
 
virtual ~Base ()
 
void set_words (const char *const words[])
 
const std::vector< std::string > & get_word_list () const
 Returns a pointer to the word list. More...
 
const std::unordered_map< epee::wipeable_string, uint32_t, WordHash, WordEqual > & get_word_map () const
 Returns a pointer to the word map. More...
 
const std::unordered_map< epee::wipeable_string, uint32_t, WordHash, WordEqual > & get_trimmed_word_map () const
 Returns a pointer to the trimmed word map. More...
 
const std::string & get_language_name () const
 Returns the name of the language. More...
 
const std::string & get_english_language_name () const
 Returns the name of the language in English. More...
 
uint32_t get_unique_prefix_length () const
 Returns the number of unique starting characters to be used for matching. More...
 

Protected Types

enum  { ALLOW_SHORT_WORDS = 1<<0 , ALLOW_DUPLICATE_PREFIXES = 1<<1 }
 
enum  { NWORDS = 1626 }
 

Protected Member Functions

void populate_maps (uint32_t flags=0)
 Populates the word maps after the list is ready. More...
 

Protected Attributes

std::vector< std::string > word_list
 
std::unordered_map< epee::wipeable_string, uint32_t, WordHash, WordEqualword_map
 
std::unordered_map< epee::wipeable_string, uint32_t, WordHash, WordEqualtrimmed_word_map
 
std::string language_name
 
std::string english_language_name
 
uint32_t unique_prefix_length
 

Detailed Description

A base language class which all languages have to inherit from for Polymorphism.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
ALLOW_SHORT_WORDS 
ALLOW_DUPLICATE_PREFIXES 

◆ anonymous enum

anonymous enum
protected
Enumerator
NWORDS 

Constructor & Destructor Documentation

◆ Base()

Language::Base::Base ( const char *  language_name,
const char *  english_language_name,
const std::vector< std::string > &  words,
uint32_t  prefix_length 
)
inline

◆ ~Base()

virtual Language::Base::~Base ( )
inlinevirtual

Member Function Documentation

◆ get_english_language_name()

const std::string& Language::Base::get_english_language_name ( ) const
inline

Returns the name of the language in English.

Returns
Name of the language.

◆ get_language_name()

const std::string& Language::Base::get_language_name ( ) const
inline

Returns the name of the language.

Returns
Name of the language.

◆ get_trimmed_word_map()

const std::unordered_map<epee::wipeable_string, uint32_t, WordHash, WordEqual>& Language::Base::get_trimmed_word_map ( ) const
inline

Returns a pointer to the trimmed word map.

Returns
A pointer to the trimmed word map.

◆ get_unique_prefix_length()

uint32_t Language::Base::get_unique_prefix_length ( ) const
inline

Returns the number of unique starting characters to be used for matching.

Returns
Number of unique starting characters.

◆ get_word_list()

const std::vector<std::string>& Language::Base::get_word_list ( ) const
inline

Returns a pointer to the word list.

Returns
A pointer to the word list.

◆ get_word_map()

const std::unordered_map<epee::wipeable_string, uint32_t, WordHash, WordEqual>& Language::Base::get_word_map ( ) const
inline

Returns a pointer to the word map.

Returns
A pointer to the word map.

◆ populate_maps()

void Language::Base::populate_maps ( uint32_t  flags = 0)
inlineprotected

Populates the word maps after the list is ready.

◆ set_words()

void Language::Base::set_words ( const char *const  words[])
inline

Member Data Documentation

◆ english_language_name

std::string Language::Base::english_language_name
protected

Name of language

◆ language_name

std::string Language::Base::language_name
protected

Name of language

◆ trimmed_word_map

std::unordered_map<epee::wipeable_string, uint32_t, WordHash, WordEqual> Language::Base::trimmed_word_map
protected

hash table to find word's trimmed index

◆ unique_prefix_length

uint32_t Language::Base::unique_prefix_length
protected

Number of unique starting characters to trim the wordlist to when matching

◆ word_list

std::vector<std::string> Language::Base::word_list
protected

A pointer to the array of words

◆ word_map

std::unordered_map<epee::wipeable_string, uint32_t, WordHash, WordEqual> Language::Base::word_map
protected

hash table to find word's index


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