2000-07-04 20:32:37 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
* Copyright 1995-2000 The LyX Team.
|
|
|
|
*
|
|
|
|
* ====================================================== */
|
|
|
|
|
|
|
|
#ifndef ENCODING_H
|
|
|
|
#define ENCODING_H
|
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2000-07-04 20:32:37 +00:00
|
|
|
#include "LString.h"
|
|
|
|
#include "lyxrc.h"
|
|
|
|
|
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
|
|
|
|
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
|