2000-07-04 20:32:37 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
2002-03-21 17:27:08 +00:00
|
|
|
* ======================================================
|
|
|
|
*
|
2000-07-04 20:32:37 +00:00
|
|
|
* LyX, The Document Processor
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2000-07-04 20:32:37 +00:00
|
|
|
* Copyright 1995 Matthias Ettrich
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 1995-2001 The LyX Team.
|
2000-07-04 20:32:37 +00:00
|
|
|
*
|
|
|
|
* ====================================================== */
|
|
|
|
|
|
|
|
#ifndef ENCODING_H
|
|
|
|
#define ENCODING_H
|
|
|
|
|
|
|
|
#include "LString.h"
|
|
|
|
#include "lyxrc.h"
|
|
|
|
|
2003-07-26 23:04:39 +00:00
|
|
|
#include <map>
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-07-04 20:32:37 +00:00
|
|
|
typedef unsigned short int Uchar;
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-07-04 20:32:37 +00:00
|
|
|
class Encoding {
|
|
|
|
public:
|
2000-10-10 12:36:36 +00:00
|
|
|
///
|
|
|
|
Encoding() {}
|
|
|
|
///
|
|
|
|
Encoding(string const & n, string const & l, Uchar const * e)
|
|
|
|
: Name_(n), LatexName_(l) {
|
|
|
|
for (int i = 0; i < 256; ++i)
|
|
|
|
encoding_table[i] = e[i];
|
|
|
|
}
|
|
|
|
///
|
|
|
|
string const & Name() const {
|
|
|
|
return Name_;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
string const & LatexName() const {
|
|
|
|
return LatexName_;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
Uchar ucs(unsigned char c) const {
|
|
|
|
return encoding_table[c];
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
string Name_;
|
|
|
|
///
|
|
|
|
string LatexName_;
|
|
|
|
///
|
|
|
|
Uchar encoding_table[256];
|
|
|
|
};
|
|
|
|
|
|
|
|
extern Encoding symbol_encoding;
|
|
|
|
|
|
|
|
class Encodings {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
typedef std::map<string, Encoding> EncodingList;
|
|
|
|
///
|
|
|
|
Encodings();
|
|
|
|
///
|
|
|
|
void read(string const & filename);
|
|
|
|
///
|
|
|
|
Encoding const * getEncoding(string const & encoding) const;
|
|
|
|
///
|
|
|
|
Encoding const * symbol_encoding() {
|
|
|
|
return &symbol_encoding_;
|
|
|
|
}
|
|
|
|
|
2000-07-04 20:32:37 +00:00
|
|
|
///
|
|
|
|
enum Letter_Form {
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-07-04 20:32:37 +00:00
|
|
|
FORM_ISOLATED,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-07-04 20:32:37 +00:00
|
|
|
FORM_FINAL,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-07-04 20:32:37 +00:00
|
|
|
FORM_INITIAL,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-07-04 20:32:37 +00:00
|
|
|
FORM_MEDIAL
|
|
|
|
};
|
|
|
|
///
|
|
|
|
static
|
|
|
|
bool IsComposeChar_hebrew(unsigned char c);
|
|
|
|
///
|
|
|
|
static
|
|
|
|
bool IsComposeChar_arabic(unsigned char c);
|
|
|
|
///
|
|
|
|
static
|
2002-11-25 21:29:21 +00:00
|
|
|
bool is_arabic_special(unsigned char c);
|
|
|
|
///
|
|
|
|
static
|
2000-07-04 20:32:37 +00:00
|
|
|
bool is_arabic(unsigned char c);
|
|
|
|
///
|
|
|
|
static
|
|
|
|
unsigned char TransformChar(unsigned char c, Letter_Form form);
|
2000-10-10 12:36:36 +00:00
|
|
|
|
2000-07-04 20:32:37 +00:00
|
|
|
private:
|
|
|
|
///
|
2000-10-10 12:36:36 +00:00
|
|
|
EncodingList encodinglist;
|
2000-07-04 20:32:37 +00:00
|
|
|
///
|
2000-10-10 12:36:36 +00:00
|
|
|
Encoding symbol_encoding_;
|
2000-07-04 20:32:37 +00:00
|
|
|
};
|
|
|
|
|
2000-10-10 12:36:36 +00:00
|
|
|
extern Encodings encodings;
|
2000-07-04 20:32:37 +00:00
|
|
|
|
|
|
|
#endif
|