Diffstat (limited to 'noncore/apps/opie-reader/Bkmks.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/Bkmks.h | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/noncore/apps/opie-reader/Bkmks.h b/noncore/apps/opie-reader/Bkmks.h index b38184a..ee528e4 100644 --- a/noncore/apps/opie-reader/Bkmks.h +++ b/noncore/apps/opie-reader/Bkmks.h | |||
@@ -4,2 +4,3 @@ | |||
4 | #include "config.h" | 4 | #include "config.h" |
5 | #include "Filedata.h" | ||
5 | #include <stdio.h> | 6 | #include <stdio.h> |
@@ -12,7 +13,12 @@ class Bkmk | |||
12 | friend class BkmkFile; | 13 | friend class BkmkFile; |
13 | tchar* m_name; | 14 | unsigned char* m_name; |
14 | tchar* m_anno; | 15 | unsigned short m_namelen; |
16 | unsigned char* m_anno; | ||
17 | unsigned short m_annolen; | ||
15 | unsigned int m_position; | 18 | unsigned int m_position; |
19 | void init(const void*, unsigned short, const void*, unsigned short, unsigned int); | ||
16 | public: | 20 | public: |
17 | Bkmk() : m_name(NULL), m_anno(NULL), m_position(0) {}; | 21 | Bkmk() : m_name(NULL), m_namelen(0), m_anno(NULL), m_annolen(0), m_position(0) {}; |
22 | Bkmk(const unsigned char* _nm, unsigned short _nmlen, const unsigned char* _anno, unsigned short _annolen, unsigned int _p); | ||
23 | Bkmk(const tchar* _nm, const unsigned char* _anno, unsigned short _annolen, unsigned int _p); | ||
18 | Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p); | 24 | Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p); |
@@ -24,4 +30,5 @@ class Bkmk | |||
24 | unsigned int value() const { return m_position; } | 30 | unsigned int value() const { return m_position; } |
25 | tchar *name() const { return m_name; } | 31 | void value(unsigned int _v) { m_position = _v; } |
26 | tchar *anno() const { return m_anno; } | 32 | tchar *name() const { return (tchar*)m_name; } |
33 | tchar *anno() const { return (tchar*)m_anno; } | ||
27 | bool operator<(const Bkmk& rhs) { return (m_position < rhs.m_position); } | 34 | bool operator<(const Bkmk& rhs) { return (m_position < rhs.m_position); } |
@@ -30,2 +37,13 @@ class Bkmk | |||
30 | void setAnno(tchar* t); | 37 | void setAnno(tchar* t); |
38 | void setAnno(unsigned char* t, unsigned short len); | ||
39 | unsigned char* filedata() | ||
40 | { | ||
41 | CFiledata fd(anno()); | ||
42 | return m_anno+fd.length(); | ||
43 | } | ||
44 | unsigned short filedatalen() | ||
45 | { | ||
46 | CFiledata fd(anno()); | ||
47 | return m_annolen - fd.length(); | ||
48 | } | ||
31 | }; | 49 | }; |
@@ -39,7 +57,6 @@ class BkmkFile | |||
39 | private: | 57 | private: |
40 | Bkmk* read(); | 58 | static Bkmk* read06(FILE*); |
41 | Bkmk* read03(); | 59 | static Bkmk* read05(FILE*); |
42 | CList<Bkmk>* readall03(); | 60 | static Bkmk* read03(FILE*); |
43 | CList<Bkmk>* readall04(); | 61 | CList<Bkmk>* readall00(Bkmk*(*fn)(FILE*)); |
44 | void write(tchar* nm, tchar* an, const unsigned int& pos); | ||
45 | void write(const Bkmk& b); | 62 | void write(const Bkmk& b); |