OSDN Git Service

Version browse in switch, export, new branch/tag and merge dialogs
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / RevisionGraph / FullGraphNode.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 #include "SimpleList.h"\r
23 #include "NodeClassification.h"\r
24 \r
25 using namespace LogCache;\r
26 \r
27 /**\r
28  * \ingroup TortoiseProc\r
29  * Helper class, representing a revision with all the required information\r
30  * which we need to draw a revision graph.\r
31  */\r
32 class CFullGraphNode\r
33 {\r
34 public:\r
35 \r
36     /// copy target list type\r
37 \r
38     typedef simple_list<CFullGraphNode> CCopyTarget;\r
39 \r
40     /// factory type\r
41 \r
42     class CFactory\r
43     {\r
44     private:\r
45 \r
46         boost::pool<> nodePool;\r
47         CCopyTarget::factory copyTargetFactory;\r
48 \r
49     public:\r
50 \r
51         /// factory creation\r
52 \r
53         CFactory();\r
54 \r
55         /// factory interface\r
56 \r
57         CFullGraphNode* Create ( const CDictionaryBasedTempPath& path\r
58                                , revision_t revision\r
59                                , CNodeClassification classification\r
60                                , CFullGraphNode* source);\r
61         void Replace ( CFullGraphNode* toReplace\r
62                      , CFullGraphNode::CCopyTarget*& toMove\r
63                      , CNodeClassification newClassification);\r
64         void Destroy (CFullGraphNode* node);\r
65     };\r
66 \r
67     friend class CFactory;\r
68 \r
69 private:\r
70 \r
71         ///members\r
72 \r
73         CDictionaryBasedTempPath path;\r
74         index_t              realPathID;\r
75 \r
76         CCopyTarget*         firstCopyTarget;\r
77 \r
78         CFullGraphNode*      prev;\r
79         CFullGraphNode*      next;\r
80 \r
81         CFullGraphNode*      copySource;\r
82 \r
83         revision_t                   revision;\r
84     CNodeClassification  classification;\r
85 \r
86 protected:\r
87 \r
88         /// protect construction / destruction to force usage of pool\r
89 \r
90         CFullGraphNode ( const CDictionaryBasedTempPath& path\r
91                    , revision_t revision\r
92                    , CNodeClassification classification\r
93                    , CFullGraphNode* source\r
94                    , CCopyTarget::factory& copyTargetFactory);\r
95     ~CFullGraphNode();\r
96 \r
97     /// destruction utility\r
98 \r
99     void InsertAt ( CFullGraphNode* source\r
100                   , CCopyTarget::factory& copyTargetFactory);\r
101     void DestroySubNodes ( CFactory& factory\r
102                          , CCopyTarget::factory& copyTargetFactory);\r
103 \r
104 public:\r
105 \r
106     /// modification\r
107 \r
108     void AddClassification (DWORD toAdd);\r
109 \r
110     /// data access\r
111 \r
112         const CDictionaryBasedTempPath& GetPath() const;\r
113         CDictionaryBasedPath GetRealPath() const;\r
114 \r
115         const CFullGraphNode* GetCopySource() const;\r
116         const CCopyTarget* GetFirstCopyTarget() const;\r
117         CCopyTarget*& GetFirstCopyTarget();\r
118 \r
119         const CFullGraphNode* GetPrevious() const;\r
120         CFullGraphNode* GetPrevious();\r
121         const CFullGraphNode* GetNext() const;\r
122         CFullGraphNode* GetNext();\r
123 \r
124         revision_t GetRevision() const;\r
125         CNodeClassification GetClassification() const;\r
126 \r
127 };\r
128 \r
129 /// CVisibleGraphNode  modification\r
130 \r
131 inline void CFullGraphNode::AddClassification (DWORD toAdd)\r
132 {\r
133     classification.Add (toAdd);\r
134 }\r
135 \r
136 /// CVisibleGraphNode data access\r
137 \r
138 inline const CDictionaryBasedTempPath& CFullGraphNode::GetPath() const\r
139 {\r
140     return path;\r
141 }\r
142 \r
143 inline CDictionaryBasedPath CFullGraphNode::GetRealPath() const\r
144 {\r
145     return CDictionaryBasedPath (path.GetBasePath().GetDictionary(), realPathID);\r
146 }\r
147 \r
148 inline const CFullGraphNode* CFullGraphNode::GetCopySource() const\r
149 {\r
150     return copySource;\r
151 }\r
152 \r
153 inline const CFullGraphNode::CCopyTarget* \r
154 CFullGraphNode::GetFirstCopyTarget() const\r
155 {\r
156     return firstCopyTarget;\r
157 }\r
158 \r
159 inline CFullGraphNode::CCopyTarget*& CFullGraphNode::GetFirstCopyTarget()\r
160 {\r
161     return firstCopyTarget;\r
162 }\r
163 \r
164 inline const CFullGraphNode* CFullGraphNode::GetPrevious() const\r
165 {\r
166     return prev;\r
167 }\r
168 \r
169 inline CFullGraphNode* CFullGraphNode::GetPrevious()\r
170 {\r
171     return prev;\r
172 }\r
173 \r
174 inline const CFullGraphNode* CFullGraphNode::GetNext() const\r
175 {\r
176     return next;\r
177 }\r
178 \r
179 inline CFullGraphNode* CFullGraphNode::GetNext()\r
180 {\r
181     return next;\r
182 }\r
183 \r
184 inline revision_t CFullGraphNode::GetRevision() const\r
185 {\r
186     return revision;\r
187 }\r
188 \r
189 inline CNodeClassification CFullGraphNode::GetClassification() const\r
190 {\r
191     return classification;\r
192 }\r
193 \r