[go: up one dir, main page]

Menu

[r734]: / ctranslit.h  Maximize  Restore  History

Download this file

141 lines (118 with data), 5.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/* Marcion
Copyright (C) 2009-2016 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; either version 2 of the License, or
(at your option) any later version.
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; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
#ifndef CTRANSLIT_H
#define CTRANSLIT_H
//
#include <QString>
#include <QStringList>
#include <QRegExp>
#include <QPair>
#include <QDir>
//
//#define COUNT_WORDTYPE 23
#define COUNT_QUALITY 9
#define CRUM_FIRST 22
#define CRUM_LAST 865
#define CRUM_COUNT 843
class MTextLineItem{
public:
MTextLineItem(QString const & rawdata,bool display);
MTextLineItem(MTextLineItem const & other);
~MTextLineItem(){}
void operator=(MTextLineItem const & other);
QString note(bool tag=false) const,text() const,verse() const,
indexW() const;
bool hasNote() const {return _has_note;}
bool hasIndexW() const {return _has_index_w;}
void setText(QString const & text),setVerse(QString const & verse);
private:
QString pushIndexItem(bool display, QString const & text);
QString const _rawdata;
QString _text,_note,_verse,_index_w;
bool _has_note,_has_index_w;
};
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};
enum SpaceMode {RemoveNone,RemoveAll,Trim,TrimAndKeepOne};
static void init();
static QString humRead(qint64 value);
static QString tr(QString const & str,Tr from_to,bool strip=false,SpaceMode space_mode=RemoveNone);
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 QString normSep(QString const & path);
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 & str,QString const & in_text,QString const & fcolor,QString const & bcolor,bool regexp,bool words);
static QString highlightCopDictWord(QString const & word,QString const & pattern,QString const & fcolor,QString const & bcolor);
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