OSDN Git Service

ProgressDlg: Changed 'OK' into 'Close' and 'Cancel' into 'Abort'
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / RevisionGraph / NodeClassification.h
1 // TortoiseSVN - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2003-2008 - TortoiseSVN\r
4 \r
5 // This program is free software; you can redistribute it and/or\r
6 // modify it under the terms of the GNU General Public License\r
7 // as published by the Free Software Foundation; either version 2\r
8 // of the License, or (at your option) any later version.\r
9 \r
10 // This program is distributed in the hope that it will be useful,\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 // GNU General Public License for more details.\r
14 \r
15 // You should have received a copy of the GNU General Public License\r
16 // along with this program; if not, write to the Free Software Foundation,\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
18 //\r
19 #pragma once\r
20 \r
21 #include "./Containers/DictionaryBasedTempPath.h"\r
22 \r
23 class CNodeClassification\r
24 {\r
25 public:\r
26 \r
27     /// classification for a revision graph tree node.\r
28     /// Only the first section will be used by the CPathClassificator.\r
29     /// All others are added by the revision graph.\r
30 \r
31     enum EFlags\r
32     {\r
33         IS_TRUNK           = 0x00000001,\r
34         IS_BRANCH          = 0x00000002,\r
35         IS_TAG             = 0x00000004,\r
36         IS_OTHER           = 0x00000008,\r
37 \r
38         IS_ADDED           = 0x00000010,\r
39         IS_MODIFIED        = 0x00000020,\r
40         IS_DELETED         = 0x00000040,\r
41         IS_RENAMED         = 0x00000080,     \r
42 \r
43         COPIES_TO_TRUNK    = 0x00000100,\r
44         COPIES_TO_BRANCH   = 0x00000200,\r
45         COPIES_TO_TAG      = 0x00000400,\r
46         COPIES_TO_OTHER    = 0x00000800,\r
47 \r
48         COPIES_TO_ADDED    = 0x00001000,\r
49         COPIES_TO_MODIFIED = 0x00002000,\r
50         COPIES_TO_DELETED  = 0x00004000,\r
51         COPIES_TO_RENAMED  = 0x00008000,\r
52 \r
53         ALL_COPIES_ADDED   = 0x00010000,\r
54         ALL_COPIES_MODIFIED= 0x00020000,\r
55         ALL_COPIES_DELETED = 0x00040000,\r
56         ALL_COPIES_RENAMED = 0x00080000,\r
57 \r
58         PATH_ONLY_ADDED    = 0x00100000,\r
59         PATH_ONLY_MODIFIED = 0x00200000,\r
60         PATH_ONLY_DELETED  = 0x00400000,\r
61         PATH_ONLY_RENAMED  = 0x00800000,\r
62 \r
63         IS_COPY_SOURCE     = 0x01000000,\r
64         IS_COPY_TARGET     = 0x02000000,\r
65         IS_FIRST           = 0x04000000,\r
66         IS_LAST            = 0x08000000,\r
67 \r
68         IS_WORKINGCOPY     = 0x10000000,\r
69         IS_MODIFIED_WC     = 0x20000000,\r
70 \r
71         // if set, the node should not be removed\r
72         // (only valid in visible graph)\r
73 \r
74         MUST_BE_PRESERVED  = 0x80000000\r
75     };\r
76 \r
77     enum \r
78     {\r
79         IS_MASK            = 0x000000ff,\r
80         IS_OPERATION_MASK  = 0x000000f0,\r
81         COPIES_TO_MASK     = 0x0000ff00,\r
82         ALL_COPIES_MASK    = 0x000f0000,\r
83         PATH_ONLY_MASK     = 0x00f00000,\r
84         SPECIAL_PROPS_MASK = 0xff000000,\r
85 \r
86         COPIES_TO_SHIFT    = 0x00000100,\r
87         ALL_COPIES_SHIFT   = 0x00001000,\r
88         PATH_ONLY_SHIFT    = 0x00010000,\r
89 \r
90         SUBTREE_DELETED    = IS_DELETED | ALL_COPIES_DELETED\r
91     };\r
92 \r
93 private:\r
94 \r
95     /// actually, this whole class is just a fancy DWORD\r
96 \r
97     DWORD flags;\r
98 \r
99 public:\r
100 \r
101     /// empty construction\r
102 \r
103     CNodeClassification();\r
104     CNodeClassification (DWORD flags);\r
105 \r
106     /// operations\r
107 \r
108     void Add (DWORD value);\r
109     void Remove (DWORD value);\r
110 \r
111     /// specific data access\r
112 \r
113     bool Matches (DWORD required, DWORD forbidden) const;\r
114     bool Is (DWORD value) const;\r
115     bool IsAnyOf (DWORD value) const;\r
116 \r
117     DWORD GetFlags() const;\r
118 };\r
119 \r
120 \r
121 /// empty construction\r
122 \r
123 inline CNodeClassification::CNodeClassification()\r
124     : flags (0) \r
125 {\r
126 }\r
127 \r
128 inline CNodeClassification::CNodeClassification (DWORD flags)\r
129     : flags (flags) \r
130 {\r
131 }\r
132 \r
133 /// operations\r
134 \r
135 inline void CNodeClassification::Add (DWORD value)\r
136 {\r
137     flags |= value;\r
138 }\r
139 \r
140 inline void CNodeClassification::Remove (DWORD value)\r
141 {\r
142     flags &= ~value;\r
143 }\r
144 \r
145 /// specific data access\r
146 \r
147 inline bool CNodeClassification::Matches (DWORD required, DWORD forbidden) const\r
148 {\r
149     return (flags & (required | forbidden)) == required;\r
150 }\r
151 \r
152 inline bool CNodeClassification::Is (DWORD value) const\r
153 {\r
154     return Matches (value, 0);\r
155 }\r
156 \r
157 inline bool CNodeClassification::IsAnyOf (DWORD value) const\r
158 {\r
159     return (flags & value) != 0;\r
160 }\r
161 \r
162 inline DWORD CNodeClassification::GetFlags() const\r
163 {\r
164     return flags;\r
165 }\r