OSDN Git Service

Add TortoiseProc
[tortoisegit/TortoiseGitJp.git] / 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 "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 \r
70         // if set, the node should not be removed\r
71         // (only valid in visible graph)\r
72 \r
73         MUST_BE_PRESERVED  = 0x80000000\r
74     };\r
75 \r
76     enum \r
77     {\r
78         IS_MASK            = 0x000000ff,\r
79         IS_OPERATION_MASK  = 0x000000f0,\r
80         COPIES_TO_MASK     = 0x0000ff00,\r
81         ALL_COPIES_MASK    = 0x000f0000,\r
82         PATH_ONLY_MASK     = 0x00f00000,\r
83         SPECIAL_PROPS_MASK = 0xff000000,\r
84 \r
85         COPIES_TO_SHIFT    = 0x00000100,\r
86         ALL_COPIES_SHIFT   = 0x00001000,\r
87         PATH_ONLY_SHIFT    = 0x00010000,\r
88 \r
89         SUBTREE_DELETED    = IS_DELETED | ALL_COPIES_DELETED\r
90     };\r
91 \r
92 private:\r
93 \r
94     /// actually, this whole class is just a fancy DWORD\r
95 \r
96     DWORD flags;\r
97 \r
98 public:\r
99 \r
100     /// empty construction\r
101 \r
102     CNodeClassification();\r
103     CNodeClassification (DWORD flags);\r
104 \r
105     /// operations\r
106 \r
107     void Add (DWORD value);\r
108     void Remove (DWORD value);\r
109 \r
110     /// specific data access\r
111 \r
112     bool Matches (DWORD required, DWORD forbidden) const;\r
113     bool Is (DWORD value) const;\r
114     bool IsAnyOf (DWORD value) const;\r
115 \r
116     DWORD GetFlags() const;\r
117 };\r
118 \r
119 \r
120 /// empty construction\r
121 \r
122 inline CNodeClassification::CNodeClassification()\r
123     : flags (0) \r
124 {\r
125 }\r
126 \r
127 inline CNodeClassification::CNodeClassification (DWORD flags)\r
128     : flags (flags) \r
129 {\r
130 }\r
131 \r
132 /// operations\r
133 \r
134 inline void CNodeClassification::Add (DWORD value)\r
135 {\r
136     flags |= value;\r
137 }\r
138 \r
139 inline void CNodeClassification::Remove (DWORD value)\r
140 {\r
141     flags |= ~value;\r
142 }\r
143 \r
144 /// specific data access\r
145 \r
146 inline bool CNodeClassification::Matches (DWORD required, DWORD forbidden) const\r
147 {\r
148     return (flags & (required | forbidden)) == required;\r
149 }\r
150 \r
151 inline bool CNodeClassification::Is (DWORD value) const\r
152 {\r
153     return Matches (value, 0);\r
154 }\r
155 \r
156 inline bool CNodeClassification::IsAnyOf (DWORD value) const\r
157 {\r
158     return (flags & value) != 0;\r
159 }\r
160 \r
161 inline DWORD CNodeClassification::GetFlags() const\r
162 {\r
163     return flags;\r
164 }\r