Diffstat (limited to 'noncore/apps/opie-reader/Bkmks.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/Bkmks.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/Bkmks.h b/noncore/apps/opie-reader/Bkmks.h new file mode 100644 index 0000000..b38184a --- a/dev/null +++ b/noncore/apps/opie-reader/Bkmks.h | |||
@@ -0,0 +1,53 @@ | |||
1 | #ifndef __Bkmks_h | ||
2 | #define __Bkmks_h | ||
3 | |||
4 | #include "config.h" | ||
5 | #include <stdio.h> | ||
6 | |||
7 | template<class T> | ||
8 | class CList; | ||
9 | |||
10 | class Bkmk | ||
11 | { | ||
12 | friend class BkmkFile; | ||
13 | tchar* m_name; | ||
14 | tchar* m_anno; | ||
15 | unsigned int m_position; | ||
16 | public: | ||
17 | Bkmk() : m_name(NULL), m_anno(NULL), m_position(0) {}; | ||
18 | Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p); | ||
19 | Bkmk(const Bkmk& rhs) : m_name(NULL), m_anno(NULL) | ||
20 | { | ||
21 | *this = rhs; | ||
22 | } | ||
23 | ~Bkmk(); | ||
24 | unsigned int value() const { return m_position; } | ||
25 | tchar *name() const { return m_name; } | ||
26 | tchar *anno() const { return m_anno; } | ||
27 | bool operator<(const Bkmk& rhs) { return (m_position < rhs.m_position); } | ||
28 | Bkmk& operator=(const Bkmk& rhs); | ||
29 | bool operator==(const Bkmk& rhs); | ||
30 | void setAnno(tchar* t); | ||
31 | }; | ||
32 | |||
33 | class BkmkFile | ||
34 | { | ||
35 | FILE* f; | ||
36 | bool wt; | ||
37 | bool isUpgraded; | ||
38 | static const unsigned long magic; | ||
39 | private: | ||
40 | Bkmk* read(); | ||
41 | Bkmk* read03(); | ||
42 | CList<Bkmk>* readall03(); | ||
43 | CList<Bkmk>* readall04(); | ||
44 | void write(tchar* nm, tchar* an, const unsigned int& pos); | ||
45 | void write(const Bkmk& b); | ||
46 | public: | ||
47 | bool upgraded() { return isUpgraded; } | ||
48 | BkmkFile(const char *fnm, bool w = false); | ||
49 | ~BkmkFile(); | ||
50 | void write(CList<Bkmk>& bl); | ||
51 | CList<Bkmk>* readall(); | ||
52 | }; | ||
53 | #endif | ||