lib Library API Documentation

KoHyphenator Class Reference

The KoHyphenator class provides an interface to the libhnj hyphenation library. More...

#include <kohyphen.h>

List of all members.

Public Member Functions

bool checkHyphenPos (const QString &str, int pos, const QString &lang) const
char * hyphens (const QString &str, const QString &lang) const
QString hyphenate (const QString &str, const QString &lang) const

Static Public Member Functions

KoHyphenatorself ()


Detailed Description

The KoHyphenator class provides an interface to the libhnj hyphenation library.

Author:
Alexander Dymo (cloudtemple@mksat.net)

Lukas Tinkl (lukas.tinkl@suse.cz)

The KoHyphenator class provides an interface to the libhnj hyphenation library.

Libhnj library was written for TeX and adopted to use with OpenOffice. This library tries to adopt it for KDE.

It handles the hyphenation dictionary loading for the specified language. QString -> char* conversion is done by using of settings in dicts.xml file in datadir/koffice/hyphdicts (dictionaries are also located there).

The hyphenate() functions returns QString containing hyphenation chars (0xad) or char* in format of hnj_hyphen_hyphenate() function from libhnj library.

Definition at line 56 of file kohyphen.h.


Member Function Documentation

KoHyphenator * KoHyphenator::self  )  [static]
 

Returns the single KoHyphenator instance (singleton pattern) Beware that this might throw an exception in case of an installation problem! Catch KoHyphenatorExceptions!

Definition at line 41 of file kohyphen.cpp.

bool KoHyphenator::checkHyphenPos const QString str,
int  pos,
const QString lang
const
 

Checks if the letter in position pos is placed before the hyphen.

Can be used to check if the line break at given position should be forced and automatic hyphen added.

Definition at line 153 of file kohyphen.cpp.

References checkHyphenPos(), and hyphens().

Referenced by checkHyphenPos().

char * KoHyphenator::hyphens const QString str,
const QString lang
const
 

Returns the pointer to the string in hnj_hyphen_hyphenate() format (that is hyphenation function from underlying libhnj library).

The string is array of integer numbers. Each odd number marks that hyphen can be added after the character in the position of that number. The returned string must be deleted with "delete[] x;"

For example, for the string "example" the returning value is "01224400".

Parameters:
str String to be hyphenated.
lang Language for the hyphenation dictionary to be loaded. Language: two chars containing the ISO 639-1 code (for example "en", "uk", etc.) (could be lang_COUNTRY as well).

Definition at line 98 of file kohyphen.cpp.

References hyphens().

Referenced by checkHyphenPos(), and hyphens().

QString KoHyphenator::hyphenate const QString str,
const QString lang
const
 

Hyphenates the string str and returns the string with hyphenation marks in it.

Parameters:
str String to be hyphenated.
lang Language for the hyphenation dictionary to be loaded. Language: two chars containing the ISO 639-1 code (for example "en", "uk", etc.) (could be lang_COUNTRY as well).

Definition at line 118 of file kohyphen.cpp.

References hyphenate().

Referenced by hyphenate().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 06:54:22 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003