1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2007-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 "DictionaryBasedTempPath.h"
\r
23 using namespace LogCache;
\r
25 class CFullGraphNode;
\r
28 * \ingroup TortoiseProc
\r
29 * Helper class for the revision graph to search the whole path tree
\r
31 class CSearchPathTree
\r
35 CDictionaryBasedTempPath path;
\r
37 /// when this entry becomes valid / active
\r
39 revision_t startRevision;
\r
41 /// previous node for this path (or its copy source)
\r
43 CFullGraphNode* lastEntry;
\r
47 CSearchPathTree* parent;
\r
48 CSearchPathTree* firstChild;
\r
49 CSearchPathTree* lastChild;
\r
50 CSearchPathTree* previous;
\r
51 CSearchPathTree* next;
\r
53 /// utilities: handle node insertion / removal
\r
56 void Link (CSearchPathTree* newParent);
\r
60 /// construction / destruction
\r
62 CSearchPathTree (const CPathDictionary* dictionary);
\r
63 CSearchPathTree ( const CDictionaryBasedTempPath& path
\r
64 , revision_t startrev
\r
65 , CSearchPathTree* parent);
\r
69 /// add a node for the given path and rev. to the tree
\r
71 CSearchPathTree* Insert ( const CDictionaryBasedTempPath& path
\r
72 , revision_t startrev);
\r
75 /// there is a new revision entry for this path
\r
77 void ChainEntries (CFullGraphNode* entry);
\r
81 const CDictionaryBasedTempPath& GetPath() const
\r
86 revision_t GetStartRevision() const
\r
88 return startRevision;
\r
91 void SetStartRevision (revision_t revision)
\r
93 startRevision = revision;
\r
96 CFullGraphNode* GetLastEntry() const
\r
101 CSearchPathTree* GetParent() const
\r
106 CSearchPathTree* GetFirstChild() const
\r
111 CSearchPathTree* GetLastChild() const
\r
116 CSearchPathTree* GetNext() const
\r
121 CSearchPathTree* GetPrevious() const
\r
126 bool IsActive() const
\r
128 return startRevision != NO_REVISION;
\r
131 bool IsEmpty() const
\r
133 return !IsActive() && (firstChild == NULL);
\r
136 /// return true for active paths that don't have a revEntry for this revision
\r
138 bool YetToCover (revision_t revision) const;
\r
140 /// return next node in pre-order
\r
142 CSearchPathTree* GetPreOrderNext (CSearchPathTree* lastNode = NULL);
\r
144 /// return next node in pre-order but skip this sub-tree
\r
146 CSearchPathTree* GetSkipSubTreeNext (CSearchPathTree* lastNode = NULL);
\r
148 /// find sub-tree of pathID
\r
149 /// (return closet match if there is no such node)
\r
151 CSearchPathTree* FindCommonParent (index_t pathID);
\r