Dillo v3.1.1-119-g140d9ebd
Loading...
Searching...
No Matches
dw::Hyphenator Class Reference

#include <hyphenator.hh>

Public Member Functions

 Hyphenator (const char *patFile, const char *excFile, int pack=256)
 
 ~Hyphenator ()
 
int * hyphenateWord (core::Platform *platform, const char *word, int *numBreaks)
 Given a word, returns a list of the possible hyphenation points.
 
void saveTrie (FILE *fp)
 
- Public Member Functions inherited from lout::object::Object
virtual ~Object ()
 The destructor is defined as virtual (but not abstract), so that destruction of Object's works properly.
 
virtual bool equals (Object *other)
 Returns, whether two objects are equal.
 
virtual int hashValue ()
 Return a hash value for the object.
 
virtual Objectclone ()
 Return an exact copy of the object.
 
virtual void intoStringBuffer (misc::StringBuffer *sb)
 Store a textual representation of the object in a misc::StringBuffer.
 
const char * toString ()
 Use object::Object::intoStringBuffer to return a textual representation of the object.
 
virtual size_t sizeOf ()
 Return the number of bytes, this object totally uses.
 

Static Public Member Functions

static HyphenatorgetHyphenator (const char *language)
 
static bool isHyphenationCandidate (const char *word)
 Simple test to avoid much costs.
 

Private Member Functions

void insertPattern (TrieBuilder *trieBuilder, char *s)
 
void insertException (char *s)
 
void hyphenateSingleWord (core::Platform *platform, char *wordLc, int offset, lout::misc::SimpleVector< int > *breakPos)
 Hyphenate a single word, which only consists of lowercase characters.
 
bool isCharPartOfActualWord (char *s)
 Test whether the character on which "s" points (UTF-8) is an actual part of the word.
 

Private Attributes

Trietrie
 
lout::container::typed::HashTable< lout::object::ConstString, lout::container::typed::Vector< lout::object::Integer > > * exceptions
 

Static Private Attributes

static lout::container::typed::HashTable< lout::object::String, Hyphenator > * hyphenators
 

Detailed Description

Definition at line 86 of file hyphenator.hh.

Constructor & Destructor Documentation

◆ Hyphenator()

dw::Hyphenator::Hyphenator ( const char *  patFile,
const char *  excFile,
int  pack = 256 
)

◆ ~Hyphenator()

dw::Hyphenator::~Hyphenator ( )

Definition at line 110 of file hyphenator.cc.

References exceptions, and trie.

Member Function Documentation

◆ getHyphenator()

Hyphenator * dw::Hyphenator::getHyphenator ( const char *  language)
static

Definition at line 116 of file hyphenator.cc.

References hyphenators.

Referenced by dw::Textblock::hyphenateWord().

◆ hyphenateSingleWord()

◆ hyphenateWord()

int * dw::Hyphenator::hyphenateWord ( core::Platform platform,
const char *  word,
int *  numBreaks 
)

◆ insertException()

void dw::Hyphenator::insertException ( char *  s)
private

◆ insertPattern()

void dw::Hyphenator::insertPattern ( TrieBuilder trieBuilder,
char *  s 
)
private

◆ isCharPartOfActualWord()

bool dw::Hyphenator::isCharPartOfActualWord ( char *  s)
private

Test whether the character on which "s" points (UTF-8) is an actual part of the word.

Other characters at the beginning and end are ignored.

TODO Currently only suitable for English and German. TODO Only lowercase. (Uppercase not needed.)

Definition at line 226 of file hyphenator.cc.

References lout::unicode::decodeUtf8(), and lout::unicode::isAlpha().

Referenced by hyphenateWord().

◆ isHyphenationCandidate()

bool dw::Hyphenator::isHyphenationCandidate ( const char *  word)
static

Simple test to avoid much costs.

Passing it does not mean that the word can be hyphenated.

Definition at line 212 of file hyphenator.cc.

Referenced by hyphenateWord(), and dw::Textblock::isHyphenationCandidate().

◆ saveTrie()

void dw::Hyphenator::saveTrie ( FILE *  fp)
inline

Definition at line 110 of file hyphenator.hh.

References dw::Trie::save(), and trie.

Referenced by main().

Member Data Documentation

◆ exceptions

◆ hyphenators

HashTable< String, Hyphenator > * dw::Hyphenator::hyphenators
staticprivate
Initial value:
=
new HashTable <String, Hyphenator> (true, true)

Definition at line 89 of file hyphenator.hh.

Referenced by getHyphenator().

◆ trie

Trie* dw::Hyphenator::trie
private

Definition at line 90 of file hyphenator.hh.

Referenced by hyphenateSingleWord(), hyphenateWord(), Hyphenator(), saveTrie(), and ~Hyphenator().


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