Develop and Download Open Source Software

Browse CVS Repository

Contents of /tombo/Tombo/Src/URIScanner.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Sat Sep 24 14:12:27 2005 UTC (18 years, 6 months ago) by hirami
Branch: MAIN
CVS Tags: Tombo_1_15, Tombo_1_17, Tombo_1_16, Tombo_2_0a3, B187, Tombo_1_17_1, B189, B208, B213, B212, B211, B217, B216, B215, B214, B231, B230, B219, B218, SNAPSHOT20051220, B206, B207, B188, Tombo_2_0b2, Tombo_2_0b3, Tombo_2_0b1, Tombo_2_0b4, B191, B192, B193, B194, B196, B197, B198, B199, B200, B201, B202, B203, B205, B228, B229, B226, B227, B224, B225, B222, B223, B220, B221, HEAD
Branch point for: Tombo_1_17_1_branch
Changes since 1.2: +13 -6 lines
File MIME type: text/x-chdr
- replace tree search scan implementation.

1 #ifndef URISCANNER_H
2 #define URISCANNER_H
3
4 class TomboURI;
5 class IEnumRepository;
6
7 //////////////////////////////////////////////////
8 // List of URI
9 //////////////////////////////////////////////////
10 //
11 // item order is display order.
12
13 class URIList {
14 protected:
15 struct URIListItem {
16 TomboURI *pURI;
17 LPTSTR pTitle;
18
19 URIListItem() : pURI(NULL), pTitle(NULL) {}
20 };
21
22 TVector<URIListItem> liList;
23 public:
24 URIList();
25 virtual ~URIList();
26
27 BOOL Init();
28
29 DWORD GetSize() { return liList.NumItems(); }
30 const TomboURI *GetURI(DWORD n) { return liList.GetUnit(n)->pURI; }
31 LPCTSTR GetTitle(DWORD n) { return liList.GetUnit(n)->pTitle; }
32
33 BOOL Add(const TomboURI *pURI, LPCTSTR pTitle);
34 };
35
36 //////////////////////////////////////////////////
37 // URI Scanner class
38 //////////////////////////////////////////////////
39
40 class URIScanner {
41 private:
42 struct StackFrame {
43 URIList *pList;
44 DWORD nPos;
45
46 StackFrame *pNext;
47 };
48 StackFrame *pTop;
49 IEnumRepository *pRepository;
50 TomboURI *pBaseURI;
51 TString *pBaseTitle;
52 BOOL bSkipEncrypt;
53
54 int iDirection; // 1 or -1
55
56 const TomboURI *pCurrentURI;
57 LPCTSTR pTitle;
58
59 BOOL bStopScan;
60
61 BOOL PushFrame(const TomboURI *pURI);
62 void ClearStack();
63 void LeaveFrame();
64
65 BOOL MakeFrame(const TomboURI *pStartPos);
66
67 protected:
68 LPCTSTR GetTitle() { return pTitle; }
69
70 // Request to stop scanning.
71 // even if this flag is set, 5 methods are not interrupted and done at finish the method.
72 // Notice PostFolder() and AfterScan() is called even if flag is set.
73
74 virtual void InitialScan();
75 virtual void AfterScan();
76
77 virtual void PreFolder();
78 virtual void PostFolder();
79
80 virtual void Node();
81
82 public:
83 URIScanner();
84 ~URIScanner();
85
86 BOOL Init(IEnumRepository *pEnumIF, const TomboURI *pTopURI, BOOL bSkipEncrypt);
87
88 void StopScan() { bStopScan = TRUE; }
89 BOOL IsStopScan() { return bStopScan; }
90
91 // The URI now scanning. You can use this value in 5 customizable methods.
92 const TomboURI* CurrentURI() { return pCurrentURI; }
93
94 BOOL FullScan();
95 BOOL Scan(const TomboURI *pStartURL, BOOL bReverse);
96 };
97
98 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26