/* Marcion
Copyright (C) 2009 - 2011 Milan Konvicka
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program */
#ifndef CTRANSLIT_H
#define CTRANSLIT_H
//
#include <QString>
#include <QStringList>
#include <QRegExp>
#include <QPair>
//
//#define COUNT_WORDTYPE 23
#define COUNT_QUALITY 9
#define CRUM_FIRST 22
#define CRUM_LAST 865
#define CRUM_COUNT 843
typedef QPair<QString,int> QCWordClassItem;
typedef QList<QCWordClassItem> QCWordClass;
struct beta
{
char beta[4];
int utf;
};
struct cmbstruct{
QString t;
char n;
};
QString get_quality(int n);
cmbstruct & get_quality_item(int n);
class CTranslit
{
public:
enum Script{
Latin=1,Greek=2,Copt=3,Hebrew=4
};
enum Tr{GreekNToGreekTr,
GreekTrToGreekN,
GreekNToGreekTr_num,
GreekTrToGreekN_num,
GreekTrToGreekNcs,
CopticNToCopticTr,
CopticTrToCopticN,
CopticNToCopticTr_num,
CopticTrToCopticN_num,
HebrewNToHebrewTr,
HebrewTrToHebrewN,
HebrewNToHebrewTr_num,
HebrewTrToHebrewN_num,
LatinNToLatinTr,
LatinTrToLatinN,
CopticNToGreekTr,
CopticNToGreekN,
CopticDictC,
CopticDictGr};
static void init();
static QString tr(QString const & str,Tr from_to,bool strip=false,bool rm_spaces=false);
static QString to(QString latin,Script scr,
bool ancient_only=false);
static QString NAtoLatin(QString const &);
static QString NAtoLatin2(QString const &,bool);
static QString betaToUtfSimple(QString const & string,
Script script);
static QString betaToUtf(QString const & string,
Script script);
static QString betaToLatStripped(QString const & string,Script lang);
static QString greekToLatinExt(QString const & str);
static QString latinToGreekExt(QString const & str);
static QString latinToCopticExt(QString const & str);
static QString latinToXExt(QString const & str,Script script);
static QString perseusToUtf8(QString const & latin);
//static QString copticForLsj(QString const & coptic);
static QString escaped(QString const & string);
static bool isCoptic(QString const & str);
static bool isGreek(QString const & str);
static bool isHebrew(QString const & str);
static CTranslit::Script identify(QString const &);
static QString getWordType(int n);
//static bool isTag(QString const &,int);
//static QString highlightHtmlText(QString const &,QString const &,QString const &,QString const &,bool,bool);
static QCWordClass CWClass;
private:
static QString const lat,lat_heb,hebr,copt,copt2,gr,beta_wp_coptic,beta_wp_greek,lat_wp,lat_wpg,copt_wp;
static QString const tr_clc,tr_llc,tr_clc_n,tr_llc_n,tr_ccl,tr_lcl,tr_ccl_n,tr_lcl_n,tr_glg,tr_glg_n,tr_ggl,tr_lgl,tr_ggl_n,tr_lgl_n,tr_llg,tr_llg_n,tr_hlh,tr_hlh_n,tr_hhl,tr_hhl_n,tr_llh,tr_llh_n,tr_lhl,tr_lhl_n,tr_lLl,tr_llL,tr_LLl,tr_LlL,tr_ccg,tr_gcg,tr_gcl,tr_glg_cs,tr_llg_cs;
};
struct beta * beta_p(CTranslit::Script script,beta ** beta_ns);
#endif