Skip to main content

The EmojiEntityMapper Class Reference

Singleton helper class to map emoji entities to other formats. More...

Declaration

class EmojiEntityMapper { ... }

Included Headers

#include <src/emoji.h>

Private Constructors Index

EmojiEntityMapper ()

Private Destructor Index

~EmojiEntityMapper ()

Public Member Functions Index

const char *name (int index) const

Access routine to the name of the Emoji entity. More...

const char *unicode (int index) const

Access routine to the unicode sequence for the Emoji entity. More...

voidwriteEmojiFile (TextStream &t)

Writes the list of supported emojis to the given file. More...

intsymbol2index (const std::string &symName) const

Returns a code for the requested Emoji entity name. More...

Private Member Attributes Index

std::map< std::string, int >m_name2symGh

Public Static Functions Index

static EmojiEntityMapper &instance ()

Returns the one and only instance of the Emoji entity mapper. More...

Private Static Attributes Index

static EmojiEntityMapper *s_instance = nullptr

Description

Singleton helper class to map emoji entities to other formats.

Definition at line 26 of file emoji.h.

Private Constructors

EmojiEntityMapper()

EmojiEntityMapper::EmojiEntityMapper ()

Declaration at line 36 of file emoji.h, definition at line 1960 of file emoji.cpp.

1961{
1962 for (size_t i = 0; i < g_numEmojiEntities; i++)
1963 {
1964 m_name2symGh.emplace(g_emojiEntities[i].name, static_cast<int>(i));
1965 }
1966 for (size_t i = 0; i < g_numEmojiCompatibilityEntities; i++)
1967 {
1968 int ii = symbol2index(g_emojiCompatibilityEntities[i].newName);
1969 if (ii != -1) m_name2symGh.emplace(g_emojiCompatibilityEntities[i].oldName, ii);
1970 }
1971}

References g_emojiCompatibilityEntities, g_emojiEntities, g_numEmojiCompatibilityEntities, g_numEmojiEntities, m_name2symGh, name and symbol2index.

Referenced by instance.

Private Destructor

~EmojiEntityMapper()

EmojiEntityMapper::~EmojiEntityMapper ()

Declaration at line 37 of file emoji.h, definition at line 1973 of file emoji.cpp.

Public Member Functions

name()

const char * EmojiEntityMapper::name (int index)

Access routine to the name of the Emoji entity.

Parameters
index

code of the requested Emoji entity returned by symbol2index()

Returns

the name of the Emoji entity in GitHub format (i.e. :smile:)

Declaration at line 30 of file emoji.h, definition at line 2026 of file emoji.cpp.

2026const char *EmojiEntityMapper::name(int index) const
2027{
2028 return index>=0 && static_cast<size_t>(index)<g_numEmojiEntities ? g_emojiEntities[index].name : nullptr;
2029}

References g_emojiEntities, g_numEmojiEntities and name.

Referenced by EmojiEntityMapper, name, LatexDocVisitor::operator(), ManDocVisitor::operator(), PerlModDocVisitor::operator(), PrintDocVisitor::operator() and XmlDocVisitor::operator().

symbol2index()

int EmojiEntityMapper::symbol2index (const std::string & symName)

Returns a code for the requested Emoji entity name.

Parameters
symName

Emoji entity name

Returns

the code for the requested Emoji entity name, in case the requested Emoji item does not exist -1 is returned.

Declaration at line 33 of file emoji.h, definition at line 1990 of file emoji.cpp.

1990int EmojiEntityMapper::symbol2index(const std::string &symName) const
1991{
1992 auto it = m_name2symGh.find(symName);
1993 return it!=m_name2symGh.end() ? it->second : -1;
1994}

Reference m_name2symGh.

Referenced by DocEmoji::DocEmoji and EmojiEntityMapper.

unicode()

const char * EmojiEntityMapper::unicode (int index)

Access routine to the unicode sequence for the Emoji entity.

Parameters
index

code of the requested Emoji entity returned by symbol2index()

Returns

the unicode sequence of the Emoji entity,

Declaration at line 31 of file emoji.h, definition at line 2016 of file emoji.cpp.

2016const char *EmojiEntityMapper::unicode(int index) const
2017{
2018 return index>=0 && static_cast<size_t>(index)<g_numEmojiEntities ? g_emojiEntities[index].unicode : nullptr;
2019}

References g_emojiEntities, g_numEmojiEntities and unicode.

Referenced by DocbookDocVisitor::operator(), HtmlDocVisitor::operator(), RTFDocVisitor::operator(), TextDocVisitor::operator() and unicode.

writeEmojiFile()

void EmojiEntityMapper::writeEmojiFile (TextStream & t)

Writes the list of supported emojis to the given file.

Declaration at line 32 of file emoji.h, definition at line 1999 of file emoji.cpp.

2000{
2001 for (size_t i = 0; i < g_numEmojiEntities; i++)
2002 {
2003 t << g_emojiEntities[i].name << "\n";
2004 }
2005 for (size_t i = 0; i < g_numEmojiCompatibilityEntities; i++)
2006 {
2007 t << g_emojiCompatibilityEntities[i].oldName << "\n";
2008 }
2009}

References g_emojiCompatibilityEntities, g_emojiEntities, g_numEmojiCompatibilityEntities and g_numEmojiEntities.

Referenced by readConfiguration.

Private Member Attributes

m_name2symGh

std::map<std::string,int> EmojiEntityMapper::m_name2symGh

Definition at line 40 of file emoji.h.

40 std::map<std::string,int> m_name2symGh;

Referenced by EmojiEntityMapper and symbol2index.

Public Static Functions

instance()

EmojiEntityMapper & EmojiEntityMapper::instance ()
static

Private Static Attributes

s_instance

EmojiEntityMapper * EmojiEntityMapper::s_instance = nullptr
static

Definition at line 39 of file emoji.h.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.