Guiliani  Version 2.5 revision 7293 (documentation build 13)
ArabicUTFConverter.h
1/* Adapted implementation of BidiJoin algithm from https://github.com/xbmc/xbmc/ */
2
3/*Original copyright info:*/
4/*
5* Copyright (C) 2005-2008 Team XBMC
6* http://www.xbmc.org
7*
8* A port of Mohammed Yousif's C Arabic shaping code
9* Ported by Nibras Al-shaiba
10*
11* This Program is free software; you can redistribute it and/or modify
12* it under the terms of the GNU General Public License as published by
13* the Free Software Foundation; either version 2, or (at your option)
14* any later version.
15*
16* This Program is distributed in the hope that it will be useful,
17* but WITHOUT ANY WARRANTY; without even the implied warranty of
18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19* GNU General Public License for more details.
20*
21* You should have received a copy of the GNU General Public License
22* along with XBMC; see the file COPYING. If not, write to
23* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24* http://www.gnu.org/copyleft/gpl.html
25*
26*/
27
28#ifndef __ARABIC_UTF_CONVERTER_H__
29#define __ARABIC_UTF_CONVERTER_H__
30
31#include "bidi.h"
32#include "eC_String.h"
33
34#define MAP_LENGTH 37
35#define COMB_MAP_LENGTH 4
36#define TRANS_CHARS_LENGTH 39
37
42{
43public:
46 typedef struct
47 {
48 eC_UTF16 code;
49 eC_UTF16 mIsolated;
50 eC_UTF16 mInitial;
51 eC_UTF16 mMedial;
52 eC_UTF16 mFinal;
53 } CharRep_t;
54
57 typedef struct
58 {
59 eC_UTF16 code[2];
60 eC_UTF16 mIsolated;
61 eC_UTF16 mInitial;
62 eC_UTF16 mMedial;
63 eC_UTF16 mFinal;
65
66public:
73 static eC_String ConvertArabic(const eC_String& rkSourceString, eC_Bool& bConverted);
74
79 static CharRep_t GetCharRep(eC_UTF16 c);
80
85 static CombCharRep_t GetcombCharRep(eC_UTF16 c);
86
91 static eC_UTF16 GetCode(eC_UTF16 c);
92
97 static void GetTextInUTF16(const eC_String& kSource, eC_UInt& ruiLength);
98
104 static eC_String GetInternTextData(const eC_String& rkSourceString, const eC_Bool& bGlobalCodePresentation = true);
105
110 static eC_Bool IsArabicChar(eC_UTF16 cCharacter);
111
112private:
113 static eC_Int GetTextContextualForm(eC_UTF16* pcInputString, const eC_UInt& uiLength, eC_UTF16* pcOutputString, const eC_Bool& bGlobalCodePresentation = true);
114 static eC_UTF16* GetCombCode(eC_UTF16 c);
115
116 static eC_Int ShapeArabic(eC_UTF16* paInputString, const eC_UInt& uiLength, eC_UTF16* paOutputString, eC_Bool& bConverted);
117
118 static eC_Bool CharacterMapContains(eC_UTF16 c);
119 static eC_Bool CombiCharacterMapContains(eC_UTF16 c);
120
121 static CombCharRep_t GetCombCharRep(eC_UTF16 c1, eC_UTF16 c2);
122
123 static eC_Bool IsTransparent(eC_UTF16 c);
124};
125
126#endif
This class is a helper to convert strings containing bi-directional text-parts.
Definition: ArabicUTFConverter.h:42
static void GetTextInUTF16(const eC_String &kSource, eC_UInt &ruiLength)
static eC_String ConvertArabic(const eC_String &rkSourceString, eC_Bool &bConverted)
static eC_String GetInternTextData(const eC_String &rkSourceString, const eC_Bool &bGlobalCodePresentation=true)
static eC_UTF16 GetCode(eC_UTF16 c)
static CombCharRep_t GetcombCharRep(eC_UTF16 c)
static CharRep_t GetCharRep(eC_UTF16 c)
static eC_Bool IsArabicChar(eC_UTF16 cCharacter)
Definition: ArabicUTFConverter.h:47
eC_UTF16 mInitial
character-code for use as first character
Definition: ArabicUTFConverter.h:50
eC_UTF16 code
character-code
Definition: ArabicUTFConverter.h:48
eC_UTF16 mIsolated
character-code for isolated use
Definition: ArabicUTFConverter.h:49
eC_UTF16 mMedial
character-code for use as middle-character
Definition: ArabicUTFConverter.h:51
eC_UTF16 mFinal
character-code for use as terminating character
Definition: ArabicUTFConverter.h:52
Definition: ArabicUTFConverter.h:58
eC_UTF16 mFinal
character-code for use as terminating character
Definition: ArabicUTFConverter.h:63
eC_UTF16 mInitial
character-code for use as first character
Definition: ArabicUTFConverter.h:61
eC_UTF16 mMedial
character-code for use as middle-character
Definition: ArabicUTFConverter.h:62
eC_UTF16 mIsolated
character-code for isolated use
Definition: ArabicUTFConverter.h:60