Diffstat (limited to 'noncore/apps/opie-reader/CEncoding.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/CEncoding.h | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/noncore/apps/opie-reader/CEncoding.h b/noncore/apps/opie-reader/CEncoding.h index df0104a..1dfd74d 100644 --- a/noncore/apps/opie-reader/CEncoding.h +++ b/noncore/apps/opie-reader/CEncoding.h | |||
@@ -6,69 +6,89 @@ | |||
6 | #define MAX_ENCODING 6 | 6 | #define MAX_ENCODING 6 |
7 | 7 | ||
8 | class CEncoding : public CCharacterSource | 8 | class CEncoding : public CCharacterSource |
9 | { | 9 | { |
10 | friend class CFilterChain; | 10 | friend class CFilterChain; |
11 | protected: | 11 | protected: |
12 | CExpander* parent; | 12 | CExpander_Interface* parent; |
13 | linkType hyperlink(unsigned int n, QString& t) { return parent->hyperlink(n,t); } | 13 | linkType hyperlink(unsigned int n, unsigned int noff, QString& t, QString& nm) { return parent->hyperlink(n, noff, t, nm); } |
14 | public: | 14 | public: |
15 | CEncoding() : parent(NULL) {} | 15 | CEncoding() : parent(NULL) {} |
16 | void setparent(CExpander* p) { parent = p; } | 16 | void setparent(CExpander_Interface* p) { parent = p; } |
17 | virtual ~CEncoding() {}; | 17 | virtual ~CEncoding() {}; |
18 | void locate(unsigned int n) { parent->locate(n); } | ||
19 | bool findanchor(const QString& nm) { return false; } | ||
20 | void saveposn(const QString& f, size_t posn) { parent->saveposn(posn); } | ||
21 | void writeposn(const QString& f, size_t posn) { parent->writeposn(posn); } | ||
22 | linkType forward(QString& f, size_t& loc) { return parent->forward(loc); } | ||
23 | linkType back(QString& f, size_t& loc) { return parent->back(loc); } | ||
24 | bool hasnavigation() { return parent->hasnavigation(); } | ||
25 | virtual int getwidth() { return parent->getwidth(); } | ||
26 | QImage* getPicture(unsigned long tgt) { return parent->getPicture(tgt); } | ||
27 | QImage* getPicture(const QString& href) { return parent->getPicture(href); } | ||
28 | bool getFile(const QString& href) { qDebug("Encoding Get File"); return parent->getFile(href);} | ||
29 | |||
30 | |||
18 | }; | 31 | }; |
19 | 32 | ||
20 | class CUtf8 : public CEncoding | 33 | class CUtf8 : public CEncoding |
21 | { | 34 | { |
22 | public: | 35 | public: |
23 | void getch(tchar& ch, CStyle& sty); | 36 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
37 | QString about() { return QString("UTF8 decoder (c) Tim Wentford\n")+parent->about(); } | ||
24 | }; | 38 | }; |
25 | 39 | ||
26 | class CUcs16be : public CEncoding | 40 | class CUcs16be : public CEncoding |
27 | { | 41 | { |
28 | public: | 42 | public: |
29 | void getch(tchar& ch, CStyle& sty); | 43 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
44 | QString about() { return QString("UCS16 decoder (c) Tim Wentford\n")+parent->about(); } | ||
30 | }; | 45 | }; |
31 | 46 | ||
32 | class CUcs16le : public CEncoding | 47 | class CUcs16le : public CEncoding |
33 | { | 48 | { |
34 | public: | 49 | public: |
35 | void getch(tchar& ch, CStyle& sty); | 50 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
51 | QString about() { return QString("UCS16 decoder (c) Tim Wentford\n")+parent->about(); } | ||
36 | }; | 52 | }; |
37 | 53 | ||
38 | class Ccp1252 : public CEncoding | 54 | class Ccp1252 : public CEncoding |
39 | { | 55 | { |
40 | public: | 56 | public: |
41 | void getch(tchar& ch, CStyle& sty); | 57 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
58 | QString about() { return QString("Codepage 1252 decoder (c) Tim Wentford\n")+parent->about(); } | ||
42 | }; | 59 | }; |
43 | 60 | ||
44 | class CPalm : public Ccp1252 | 61 | class CPalm : public Ccp1252 |
45 | { | 62 | { |
46 | public: | 63 | public: |
47 | void getch(tchar& ch, CStyle& sty); | 64 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
65 | QString about() { return QString("Palm decoder (c) Tim Wentford\n")+parent->about(); } | ||
48 | }; | 66 | }; |
49 | 67 | ||
50 | class CAscii : public CEncoding | 68 | class CAscii : public CEncoding |
51 | { | 69 | { |
52 | public: | 70 | public: |
53 | void getch(tchar& ch, CStyle& sty); | 71 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
72 | QString about() { return QString("Vanilla Ascii decoder (c) Tim Wentford\n")+parent->about(); } | ||
54 | }; | 73 | }; |
55 | 74 | ||
56 | #include "CEncoding_tables.h" | 75 | #include "CEncoding_tables.h" |
57 | 76 | ||
58 | class CGeneral8Bit : public CEncoding | 77 | class CGeneral8Bit : public CEncoding |
59 | { | 78 | { |
60 | int m_index; | 79 | int m_index; |
61 | public: | 80 | public: |
62 | CGeneral8Bit(int _i) : m_index(_i) | 81 | CGeneral8Bit(int _i) : m_index(_i) |
63 | { | 82 | { |
64 | // odebug << "8Bit: " << _i << oendl; | 83 | // qDebug("8Bit:%d", _i); |
65 | // odebug << unicodetable::iterator(_i)->mime << oendl; | 84 | // qDebug("%s", unicodetable::iterator(_i)->mime); |
66 | } | 85 | } |
67 | void getch(tchar& ch, CStyle& sty) | 86 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
68 | { | 87 | { |
69 | parent->getch(ch, sty); | 88 | parent->getch(ch, sty, pos); |
70 | ch = unicodetable::unicodevalue(m_index, ch); | 89 | ch = unicodetable::unicodevalue(m_index, ch); |
71 | } | 90 | } |
91 | QString about() { return QString("8-bit decoder (c) Tim Wentford - based on QT code\n")+parent->about(); } | ||
72 | }; | 92 | }; |
73 | 93 | ||
74 | #endif | 94 | #endif |