1 /**
2  * @file mega/treeproc.h
3  * @brief Node tree processor
4  *
5  * (c) 2013-2014 by Mega Limited, Auckland, New Zealand
6  *
7  * This file is part of the MEGA SDK - Client Access Engine.
8  *
9  * Applications using the MEGA API must present a valid application key
10  * and comply with the the rules set forth in the Terms of Service.
11  *
12  * The MEGA SDK is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * @copyright Simplified (2-clause) BSD License.
17  *
18  * You should have received a copy of the license along with this
19  * program.
20  */
21 
22 #ifndef MEGA_TREEPROC_H
23 #define MEGA_TREEPROC_H 1
24 
25 #include "sharenodekeys.h"
26 #include "node.h"
27 #include "transfer.h"
28 #include "sync.h"
29 
30 namespace mega {
31 // node tree processor
32 class MEGA_API TreeProc
33 {
34 public:
35     virtual void proc(MegaClient*, Node*) = 0;
36 
~TreeProc()37     virtual ~TreeProc() { }
38 };
39 
40 class MEGA_API TreeProcDel : public TreeProc
41 {
42 public:
43     void proc(MegaClient*, Node*);
44 };
45 
46 class MEGA_API TreeProcApplyKey : public TreeProc
47 {
48 public:
49     void proc(MegaClient*, Node*);
50 };
51 
52 class MEGA_API TreeProcCopy : public TreeProc
53 {
54 public:
55     NewNode* nn;
56     unsigned nc;
57 
58     void allocnodes(void);
59 
60     void proc(MegaClient*, Node*);
61     TreeProcCopy();
62     ~TreeProcCopy();
63 };
64 
65 class MEGA_API TreeProcDU : public TreeProc
66 {
67 public:
68     m_off_t numbytes;
69     int numfiles;
70     int numfolders;
71 
72     void proc(MegaClient*, Node*);
73     TreeProcDU();
74 };
75 
76 class MEGA_API TreeProcShareKeys : public TreeProc
77 {
78     ShareNodeKeys snk;
79     Node* sn;
80 
81 public:
82     void proc(MegaClient*, Node*);
83     void get(Command*);
84 
85     TreeProcShareKeys(Node* = NULL);
86 };
87 
88 class MEGA_API TreeProcForeignKeys : public TreeProc
89 {
90 public:
91     void proc(MegaClient*, Node*);
92 };
93 
94 #ifdef ENABLE_SYNC
95 class MEGA_API TreeProcDelSyncGet : public TreeProc
96 {
97 public:
98     void proc(MegaClient*, Node*);
99 };
100 
101 class MEGA_API LocalTreeProc
102 {
103 public:
104     virtual void proc(MegaClient*, LocalNode*) = 0;
105 
~LocalTreeProc()106     virtual ~LocalTreeProc() { }
107 };
108 
109 class MEGA_API LocalTreeProcMove : public LocalTreeProc
110 {
111     Sync *newsync;
112     bool recreate;
113 
114 public:
115     LocalTreeProcMove(Sync*, bool);
116     void proc(MegaClient*, LocalNode*);
117     int nc;
118 };
119 
120 class MEGA_API LocalTreeProcUpdateTransfers : public LocalTreeProc
121 {
122 public:
123     void proc(MegaClient*, LocalNode*);
124 };
125 
126 class MEGA_API LocalTreeProcUnlinkNodes : public LocalTreeProc
127 {
128 public:
129     void proc(MegaClient*, LocalNode*);
130 };
131 
132 #endif
133 } // namespace
134 
135 #endif
136