1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2008 - TortoiseSVN
\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
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
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
21 #include "FullGraphNode.h"
\r
23 // forward declarations
\r
25 class CVisibleGraph;
\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
32 class CVisibleGraphNode
\r
37 * Represents a branch that has been recognized as "tag"
\r
38 * and folded into the copy source node.
\r
45 const CFullGraphNode* tagNode;
\r
53 CFoldedTag ( const CFullGraphNode* tagNode
\r
55 , CFoldedTag* next = NULL);
\r
59 const CFullGraphNode* GetTag() const;
\r
60 const CFoldedTag* GetNext() const;
\r
61 size_t GetDepth() const;
\r
63 bool IsAlias() const;
\r
64 bool IsDeleted() const;
\r
65 bool IsModified() const;
\r
67 /// used to modify the depth
\r
69 friend CVisibleGraphNode;
\r
72 /// copy target list type
\r
74 typedef simple_list<CVisibleGraphNode> CCopyTarget;
\r
82 boost::pool<> nodePool;
\r
83 boost::pool<> tagPool;
\r
84 CCopyTarget::factory copyTargetFactory;
\r
90 /// factory creation
\r
94 /// factory interface
\r
96 CVisibleGraphNode* Create ( const CFullGraphNode* base
\r
97 , CVisibleGraphNode* prev
\r
98 , bool preserveNode);
\r
99 void Destroy (CVisibleGraphNode* node);
\r
101 CFoldedTag* Create ( const CFullGraphNode* tagNode
\r
103 , CFoldedTag* next);
\r
104 void Destroy (CFoldedTag* tag);
\r
106 /// instance tracking
\r
108 size_t GetNodeCount() const;
\r
111 friend class CFactory;
\r
117 const CFullGraphNode* base;
\r
119 CCopyTarget* firstCopyTarget;
\r
120 CFoldedTag* firstTag;
\r
122 CVisibleGraphNode* prev;
\r
123 CVisibleGraphNode* next;
\r
125 CVisibleGraphNode* copySource;
\r
127 CNodeClassification classification;
\r
131 /// construction / destruction via pool
\r
135 /// protect construction / destruction to force usage of pool
\r
137 CVisibleGraphNode ( const CFullGraphNode* base
\r
138 , CVisibleGraphNode* prev
\r
139 , CCopyTarget::factory& copyTargetFactory
\r
140 , bool preserveNode);
\r
141 ~CVisibleGraphNode();
\r
143 /// destruction utilities
\r
145 void DestroySubNodes ( CFactory& factory
\r
146 , CCopyTarget::factory& copyTargetFactory);
\r
147 void DestroyTags (CFactory& factory);
\r
153 const CDictionaryBasedTempPath& GetPath() const;
\r
154 CDictionaryBasedPath GetRealPath() const;
\r
155 const CFoldedTag* GetFirstTag() const;
\r
157 const CVisibleGraphNode* GetCopySource() const;
\r
158 const CCopyTarget* GetFirstCopyTarget() const;
\r
160 const CVisibleGraphNode* GetPrevious() const;
\r
161 CVisibleGraphNode* GetPrevious();
\r
162 const CVisibleGraphNode* GetNext() const;
\r
163 CVisibleGraphNode* GetNext();
\r
165 revision_t GetRevision() const;
\r
166 CNodeClassification GetClassification() const;
\r
168 index_t GetIndex() const;
\r
170 /// set index members within the whole sub-tree
\r
172 index_t InitIndex (index_t startIndex);
\r
174 /// remove node and move links to pre-decessor
\r
176 void DropNode (CVisibleGraph* graph);
\r
178 /// remove node and add it as folded tag to the parent
\r
180 void FoldTag (CVisibleGraph* graph);
\r
183 /// CVisibleGraphNode::CFoldedTag construction
\r
185 inline CVisibleGraphNode::CFoldedTag::CFoldedTag
\r
186 ( const CFullGraphNode* tagNode
\r
188 , CFoldedTag* next)
\r
189 : tagNode (tagNode), depth (depth), next (next)
\r
193 /// CVisibleGraphNode::CFoldedTag data access
\r
195 inline const CFullGraphNode* CVisibleGraphNode::CFoldedTag::GetTag() const
\r
200 inline const CVisibleGraphNode::CFoldedTag*
\r
201 CVisibleGraphNode::CFoldedTag::GetNext() const
\r
206 inline size_t CVisibleGraphNode::CFoldedTag::GetDepth() const
\r
211 inline bool CVisibleGraphNode::CFoldedTag::IsDeleted() const
\r
213 return tagNode->GetClassification()
\r
214 .Is (CNodeClassification::PATH_ONLY_DELETED);
\r
217 inline bool CVisibleGraphNode::CFoldedTag::IsModified() const
\r
219 return tagNode->GetClassification()
\r
220 .Is (CNodeClassification::PATH_ONLY_MODIFIED);
\r
223 /// CVisibleGraphNode::CFactory data access
\r
225 inline size_t CVisibleGraphNode::CFactory::GetNodeCount() const
\r
230 /// CVisibleGraphNode data access
\r
232 inline const CDictionaryBasedTempPath& CVisibleGraphNode::GetPath() const
\r
234 return base->GetPath();
\r
237 inline CDictionaryBasedPath CVisibleGraphNode::GetRealPath() const
\r
239 return base->GetRealPath();
\r
242 inline const CVisibleGraphNode::CFoldedTag* CVisibleGraphNode::GetFirstTag() const
\r
247 inline const CVisibleGraphNode* CVisibleGraphNode::GetCopySource() const
\r
252 inline const CVisibleGraphNode::CCopyTarget*
\r
253 CVisibleGraphNode::GetFirstCopyTarget() const
\r
255 return firstCopyTarget;
\r
258 inline const CVisibleGraphNode* CVisibleGraphNode::GetPrevious() const
\r
263 inline CVisibleGraphNode* CVisibleGraphNode::GetPrevious()
\r
268 inline const CVisibleGraphNode* CVisibleGraphNode::GetNext() const
\r
273 inline CVisibleGraphNode* CVisibleGraphNode::GetNext()
\r
278 inline revision_t CVisibleGraphNode::GetRevision() const
\r
280 return base->GetRevision();
\r
283 inline CNodeClassification CVisibleGraphNode::GetClassification() const
\r
285 return classification;
\r
288 inline index_t CVisibleGraphNode::GetIndex() const
\r