1 // UpdateAction.h
2 
3 #ifndef __UPDATE_ACTION_H
4 #define __UPDATE_ACTION_H
5 
6 namespace NUpdateArchive {
7 
8   namespace NPairState
9   {
10     const unsigned kNumValues = 7;
11     enum EEnum
12     {
13       kNotMasked = 0,
14       kOnlyInArchive,
15       kOnlyOnDisk,
16       kNewInArchive,
17       kOldInArchive,
18       kSameFiles,
19       kUnknowNewerFiles
20     };
21   }
22 
23   namespace NPairAction
24   {
25     enum EEnum
26     {
27       kIgnore = 0,
28       kCopy,
29       kCompress,
30       kCompressAsAnti
31     };
32   }
33 
34   struct CActionSet
35   {
36     NPairAction::EEnum StateActions[NPairState::kNumValues];
37 
IsEqualToCActionSet38     bool IsEqualTo(const CActionSet &a) const
39     {
40       for (unsigned i = 0; i < NPairState::kNumValues; i++)
41         if (StateActions[i] != a.StateActions[i])
42           return false;
43       return true;
44     }
45 
NeedScanningCActionSet46     bool NeedScanning() const
47     {
48       unsigned i;
49       for (i = 0; i < NPairState::kNumValues; i++)
50         if (StateActions[i] == NPairAction::kCompress)
51           return true;
52       for (i = 1; i < NPairState::kNumValues; i++)
53         if (StateActions[i] != NPairAction::kIgnore)
54           return true;
55       return false;
56     }
57   };
58 
59   extern const CActionSet k_ActionSet_Add;
60   extern const CActionSet k_ActionSet_Update;
61   extern const CActionSet k_ActionSet_Fresh;
62   extern const CActionSet k_ActionSet_Sync;
63   extern const CActionSet k_ActionSet_Delete;
64 }
65 
66 #endif
67