Petr Onderka has submitted this change and it was merged.
Change subject: reorganize files
......................................................................
reorganize files
Change-Id: Iffb53863c3bc76e16fa19b58fe3993f60b32b07c
---
M Dump.h
A DumpException.cpp
A DumpException.h
R DumpObjects/DumpObject.cpp
R DumpObjects/DumpObject.h
R DumpObjects/DumpTraits.cpp
R DumpObjects/DumpTraits.h
R DumpObjects/FileHeader.cpp
R DumpObjects/FileHeader.h
R DumpObjects/Offset.cpp
R DumpObjects/Offset.h
R DumpObjects/Page.h
R DumpObjects/Revision.h
M DumpWriter.h
M Incremental dumps.vcxproj
D Index.h
D IndexLeafNode.h
A Indexes/Index.h
R Indexes/Index.tpp
A Indexes/IndexLeafNode.h
R Indexes/IndexLeafNode.tpp
R Indexes/IndexNode.h
R Indexes/IndexNode.tpp
A Indexes/Iterators/IndexIterator.h
A Indexes/Iterators/IndexIterator.tpp
A Indexes/Iterators/IndexLeafIterator.h
A Indexes/Iterators/IndexLeafIterator.tpp
A Indexes/Iterators/IndexNodeIterator.h
A Indexes/Iterators/IndexNodeIterator.tpp
M SpaceManager.h
M XmlPageProcessor.h
M XmlRevisionProcessor.h
M main.cpp
33 files changed, 253 insertions(+), 202 deletions(-)
Approvals:
Petr Onderka: Verified; Looks good to me, approved
diff --git a/Dump.h b/Dump.h
index cc1aba8..ddf0660 100644
--- a/Dump.h
+++ b/Dump.h
@@ -4,9 +4,9 @@
#include <memory>
#include <string>
#include <iostream>
-#include "FileHeader.h"
+#include "DumpObjects/FileHeader.h"
+#include "Indexes/Index.h"
#include "SpaceManager.h"
-#include "Index.h"
using std::int32_t;
using std::int64_t;
@@ -14,10 +14,6 @@
using std::shared_ptr;
using std::string;
using std::iostream;
-
-class DumpException : std::exception
-{
-};
class WritableDump;
diff --git a/DumpException.cpp b/DumpException.cpp
new file mode 100644
index 0000000..6c1e339
--- /dev/null
+++ b/DumpException.cpp
@@ -0,0 +1 @@
+#include "DumpException.h"
diff --git a/DumpException.h b/DumpException.h
new file mode 100644
index 0000000..f904033
--- /dev/null
+++ b/DumpException.h
@@ -0,0 +1,8 @@
+#pragma once
+
+#include <exception>
+
+using std::exception;
+
+class DumpException : public exception
+{};
\ No newline at end of file
diff --git a/DumpObject.cpp b/DumpObjects/DumpObject.cpp
similarity index 96%
rename from DumpObject.cpp
rename to DumpObjects/DumpObject.cpp
index 1435ca5..5356958 100644
--- a/DumpObject.cpp
+++ b/DumpObjects/DumpObject.cpp
@@ -1,5 +1,5 @@
#include "DumpObject.h"
-#include "Dump.h"
+#include "../Dump.h"
DumpObject::DumpObject(weak_ptr<WritableDump> dump)
: dump(dump), savedOffset(0), savedLength(0)
diff --git a/DumpObject.h b/DumpObjects/DumpObject.h
similarity index 100%
rename from DumpObject.h
rename to DumpObjects/DumpObject.h
diff --git a/DumpTraits.cpp b/DumpObjects/DumpTraits.cpp
similarity index 100%
rename from DumpTraits.cpp
rename to DumpObjects/DumpTraits.cpp
diff --git a/DumpTraits.h b/DumpObjects/DumpTraits.h
similarity index 100%
rename from DumpTraits.h
rename to DumpObjects/DumpTraits.h
diff --git a/FileHeader.cpp b/DumpObjects/FileHeader.cpp
similarity index 95%
rename from FileHeader.cpp
rename to DumpObjects/FileHeader.cpp
index aafb014..19533f5 100644
--- a/FileHeader.cpp
+++ b/DumpObjects/FileHeader.cpp
@@ -1,5 +1,6 @@
#include "FileHeader.h"
-#include "Dump.h"
+#include "../Dump.h"
+#include "../DumpException.h"
FileHeader::FileHeader(Offset fileEnd, Offset pageIdIndexRoot, Offset
freeSpaceIndexRoot, weak_ptr<WritableDump> dump)
: DumpObject(dump), FileEnd(fileEnd), PageIdIndexRoot(pageIdIndexRoot),
FreeSpaceIndexRoot(freeSpaceIndexRoot)
diff --git a/FileHeader.h b/DumpObjects/FileHeader.h
similarity index 100%
rename from FileHeader.h
rename to DumpObjects/FileHeader.h
diff --git a/Offset.cpp b/DumpObjects/Offset.cpp
similarity index 96%
rename from Offset.cpp
rename to DumpObjects/Offset.cpp
index a0c3e39..1a2e2de 100644
--- a/Offset.cpp
+++ b/DumpObjects/Offset.cpp
@@ -1,5 +1,5 @@
#include "Offset.h"
-#include "Dump.h"
+#include "../DumpException.h"
Offset::Offset(int64_t value)
: value(value)
diff --git a/Offset.h b/DumpObjects/Offset.h
similarity index 100%
rename from Offset.h
rename to DumpObjects/Offset.h
diff --git a/Page.h b/DumpObjects/Page.h
similarity index 100%
rename from Page.h
rename to DumpObjects/Page.h
diff --git a/Revision.h b/DumpObjects/Revision.h
similarity index 100%
rename from Revision.h
rename to DumpObjects/Revision.h
diff --git a/DumpWriter.h b/DumpWriter.h
index 12b9ad4..5b6c10c 100644
--- a/DumpWriter.h
+++ b/DumpWriter.h
@@ -2,8 +2,8 @@
#include <memory>
-#include "Page.h"
-#include "Revision.h"
+#include "DumpObjects/Page.h"
+#include "DumpObjects/Revision.h"
using std::shared_ptr;
diff --git a/Incremental dumps.vcxproj b/Incremental dumps.vcxproj
index 234f65c..4b6a00f 100644
--- a/Incremental dumps.vcxproj
+++ b/Incremental dumps.vcxproj
@@ -79,20 +79,22 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Dump.cpp" />
- <ClCompile Include="DumpObject.cpp" />
- <ClCompile Include="DumpTraits.cpp" />
- <ClCompile Include="FileHeader.cpp" />
- <ClInclude Include="Index.h" />
- <ClInclude Include="IndexLeafNode.hpp">
+ <ClCompile Include="DumpException.cpp" />
+ <ClCompile Include="DumpObjects\DumpObject.cpp" />
+ <ClCompile Include="DumpObjects\DumpTraits.cpp" />
+ <ClCompile Include="DumpObjects\FileHeader.cpp" />
+ <ClInclude Include="DumpException.h" />
+ <ClInclude Include="Indexes\Index.h" />
+ <ClInclude Include="Indexes\IndexLeafNode.tpp">
<FileType>CppCode</FileType>
</ClInclude>
- <ClInclude Include="IndexNode.hpp">
+ <ClInclude Include="Indexes\IndexNode.tpp">
<ExcludedFromBuild
Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<FileType>CppCode</FileType>
</ClInclude>
- <ClInclude Include="Index.hpp" />
+ <ClInclude Include="Indexes\Index.tpp" />
<ClCompile Include="main.cpp" />
- <ClCompile Include="Offset.cpp" />
+ <ClCompile Include="DumpObjects\Offset.cpp" />
<ClCompile Include="SpaceManager.cpp" />
<ClCompile Include="TestDumpWriter.cpp" />
<ClCompile Include="XmlPageProcessor.cpp" />
@@ -106,15 +108,21 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="Dump.h" />
- <ClInclude Include="DumpObject.h" />
- <ClInclude Include="DumpTraits.h" />
+ <ClInclude Include="DumpObjects\DumpObject.h" />
+ <ClInclude Include="DumpObjects\DumpTraits.h" />
<ClInclude Include="DumpWriter.h" />
- <ClInclude Include="FileHeader.h" />
- <ClInclude Include="IndexLeafNode.h" />
- <ClInclude Include="IndexNode.h" />
- <ClInclude Include="Offset.h" />
- <ClInclude Include="Page.h" />
- <ClInclude Include="Revision.h" />
+ <ClInclude Include="DumpObjects\FileHeader.h" />
+ <ClInclude Include="Indexes\IndexLeafNode.h" />
+ <ClInclude Include="Indexes\IndexNode.h" />
+ <ClInclude Include="DumpObjects\Offset.h" />
+ <ClInclude Include="DumpObjects\Page.h" />
+ <ClInclude Include="DumpObjects\Revision.h" />
+ <ClInclude Include="Indexes\Iterators\IndexIterator.h" />
+ <ClInclude Include="Indexes\Iterators\IndexIterator.tpp" />
+ <ClInclude Include="Indexes\Iterators\IndexLeafIterator.h" />
+ <ClInclude Include="Indexes\Iterators\IndexLeafIterator.tpp" />
+ <ClInclude Include="Indexes\Iterators\IndexNodeIterator.h" />
+ <ClInclude Include="Indexes\Iterators\IndexNodeIterator.tpp" />
<ClInclude Include="SpaceManager.h" />
<ClInclude Include="TestDumpWriter.h" />
<ClInclude Include="XmlPageProcessor.h" />
diff --git a/Index.h b/Index.h
deleted file mode 100644
index 324d197..0000000
--- a/Index.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#pragma once
-
-#include <utility>
-#include <iterator>
-#include "Offset.h"
-#include "IndexNode.h"
-
-using std::pair;
-using std::shared_ptr;
-using std::iterator;
-using std::input_iterator_tag;
-
-template<typename TKey, typename TValue>
-class IndexIterator : public iterator<input_iterator_tag, const pair<TKey,
TValue>, int32_t>
-{
- template<typename TKey, typename TValue>
- friend class Index;
-private:
- shared_ptr<IndexNodeIterator<TKey, TValue>> nodeIterator;
- IndexIterator(shared_ptr<IndexNodeIterator<TKey, TValue>> nodeIterator);
-public:
- const pair<TKey, TValue> operator *() const;
- IndexIterator<TKey, TValue>& operator ++();
- bool operator ==(const IndexIterator<TKey, TValue> other);
- bool operator !=(const IndexIterator<TKey, TValue> other);
-};
-
-template<typename TKey, typename TValue>
-class Index
-{
-private:
- bool fileHeaderZero;
- unique_ptr<IndexNode<TKey, TValue>> rootNode;
- weak_ptr<WritableDump> dump;
- weak_ptr<Offset> fileHeaderOffset;
-
- void Save();
-public:
- Index(weak_ptr<WritableDump> dump, weak_ptr<Offset> fileHeaderOffset);
-
- TValue operator[](TKey key);
- void Add(TKey key, TValue value);
- void Remove(TKey key);
-
- IndexIterator<TKey, TValue> begin() const;
- IndexIterator<TKey, TValue> end() const;
-};
-
-#include "Index.hpp"
\ No newline at end of file
diff --git a/IndexLeafNode.h b/IndexLeafNode.h
deleted file mode 100644
index e846097..0000000
--- a/IndexLeafNode.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#pragma once
-
-#include <utility>
-#include <map>
-#include "IndexNode.h"
-
-using std::pair;
-using std::map;
-
-template<typename TKey, typename TValue>
-class IndexLeafIterator : public IndexNodeIterator<TKey, TValue>
-{
- typedef typename map<TKey, TValue>::const_iterator MapIterator;
-
- template<typename TKey, typename TValue>
- friend class IndexLeafNode;
-private:
- MapIterator mapIterator;
-
- IndexLeafIterator(MapIterator mapIterator);
-public:
- virtual const pair<TKey, TValue> operator *() const;
- virtual IndexLeafIterator& operator ++();
- virtual bool equals(const IndexNodeIterator *other) const;
-};
-
-template<typename TKey, typename TValue>
-class IndexLeafNode : public IndexNode<TKey, TValue>
-{
-private:
- static const int Size = 10; // has to be at most 128 for now
-
- map<TKey, TValue> map;
-protected:
- virtual void Write(ostream &stream);
-public:
- static unique_ptr<IndexNode> Read(weak_ptr<WritableDump> dump, istream
&stream);
-
- IndexLeafNode(weak_ptr<WritableDump> dump);
-
- using DumpObject::Write;
- virtual int32_t NewLength();
-
- virtual TValue operator[](TKey key);
- virtual void Add(TKey key, TValue value);
- virtual void Remove(TKey key);
-
- virtual shared_ptr<IndexNodeIterator<TKey, TValue>> begin() const;
- virtual shared_ptr<IndexNodeIterator<TKey, TValue>> end() const;
-};
-
-#include "IndexLeafNode.hpp"
\ No newline at end of file
diff --git a/Indexes/Index.h b/Indexes/Index.h
new file mode 100644
index 0000000..37417fc
--- /dev/null
+++ b/Indexes/Index.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <utility>
+#include "DumpObjects/Offset.h"
+#include "Iterators/IndexIterator.h"
+#include "IndexNode.h"
+
+using std::pair;
+using std::shared_ptr;
+
+template<typename TKey, typename TValue>
+class Index
+{
+private:
+ bool fileHeaderZero;
+ unique_ptr<IndexNode<TKey, TValue>> rootNode;
+ weak_ptr<WritableDump> dump;
+ weak_ptr<Offset> fileHeaderOffset;
+
+ void Save();
+public:
+ Index(weak_ptr<WritableDump> dump, weak_ptr<Offset> fileHeaderOffset);
+
+ TValue operator[](TKey key);
+ void Add(TKey key, TValue value);
+ void Remove(TKey key);
+
+ IndexIterator<TKey, TValue> begin() const;
+ IndexIterator<TKey, TValue> end() const;
+};
+
+#include "Index.tpp"
\ No newline at end of file
diff --git a/Index.hpp b/Indexes/Index.tpp
similarity index 61%
rename from Index.hpp
rename to Indexes/Index.tpp
index 0662054..54281be 100644
--- a/Index.hpp
+++ b/Indexes/Index.tpp
@@ -5,36 +5,6 @@
using std::move;
template<typename TKey, typename TValue>
-IndexIterator<TKey, TValue>::IndexIterator(shared_ptr<IndexNodeIterator<TKey,
TValue>> nodeIterator)
- : nodeIterator(nodeIterator)
-{}
-
-template<typename TKey, typename TValue>
-const pair<TKey, TValue> IndexIterator<TKey, TValue>::operator *() const
-{
- return **nodeIterator;
-}
-
-template<typename TKey, typename TValue>
-IndexIterator<TKey, TValue>& IndexIterator<TKey, TValue>::operator ++()
-{
- ++(*nodeIterator);
- return *this;
-}
-
-template<typename TKey, typename TValue>
-bool IndexIterator<TKey, TValue>::operator ==(const IndexIterator<TKey,
TValue> other)
-{
- return nodeIterator->equals(other.nodeIterator.get());
-}
-
-template<typename TKey, typename TValue>
-bool IndexIterator<TKey, TValue>::operator !=(const IndexIterator<TKey,
TValue> other)
-{
- return !(*this == other);
-}
-
-template<typename TKey, typename TValue>
Index<TKey, TValue>::Index(weak_ptr<WritableDump> dump, weak_ptr<Offset>
fileHeaderOffset)
: dump(dump), fileHeaderOffset(fileHeaderOffset)
{
diff --git a/Indexes/IndexLeafNode.h b/Indexes/IndexLeafNode.h
new file mode 100644
index 0000000..0e94d78
--- /dev/null
+++ b/Indexes/IndexLeafNode.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <map>
+#include "IndexNode.h"
+
+using std::map;
+
+template<typename TKey, typename TValue>
+class IndexLeafNode : public IndexNode<TKey, TValue>
+{
+private:
+ static const int Size = 10; // has to be at most 128 for now
+
+ map<TKey, TValue> map;
+protected:
+ virtual void Write(ostream &stream);
+public:
+ static unique_ptr<IndexNode> Read(weak_ptr<WritableDump> dump, istream
&stream);
+
+ IndexLeafNode(weak_ptr<WritableDump> dump);
+
+ using DumpObject::Write;
+ virtual int32_t NewLength();
+
+ virtual TValue operator[](TKey key);
+ virtual void Add(TKey key, TValue value);
+ virtual void Remove(TKey key);
+
+ virtual shared_ptr<IndexNodeIterator<TKey, TValue>> begin() const;
+ virtual shared_ptr<IndexNodeIterator<TKey, TValue>> end() const;
+};
+
+#include "IndexLeafNode.tpp"
\ No newline at end of file
diff --git a/IndexLeafNode.hpp b/Indexes/IndexLeafNode.tpp
similarity index 73%
rename from IndexLeafNode.hpp
rename to Indexes/IndexLeafNode.tpp
index be2b37e..422a3b1 100644
--- a/IndexLeafNode.hpp
+++ b/Indexes/IndexLeafNode.tpp
@@ -1,37 +1,10 @@
#include <utility>
#include <vector>
-#include "DumpTraits.h"
+#include "../DumpObjects/DumpTraits.h"
+#include "Iterators/IndexLeafIterator.h"
using std::pair;
using std::vector;
-
-template<typename TKey, typename TValue>
-IndexLeafIterator<TKey, TValue>::IndexLeafIterator(MapIterator mapIterator)
- : mapIterator(mapIterator)
-{}
-
-template<typename TKey, typename TValue>
-const pair<TKey, TValue> IndexLeafIterator<TKey, TValue>::operator *() const
-{
- return *mapIterator;
-}
-
-template<typename TKey, typename TValue>
-IndexLeafIterator<TKey, TValue>& IndexLeafIterator<TKey, TValue>::operator ++()
-{
- ++mapIterator;
- return *this;
-}
-
-template<typename TKey, typename TValue>
-bool IndexLeafIterator<TKey, TValue>::equals(const IndexNodeIterator<TKey,
TValue> *other) const
-{
- auto otherCasted = dynamic_cast<const IndexLeafIterator<TKey,
TValue>*>(other);
- if (otherCasted == nullptr)
- return false;
-
- return mapIterator == otherCasted->mapIterator;
-}
template<typename TKey, typename TValue>
TValue IndexLeafNode<TKey, TValue>::operator[](TKey key)
diff --git a/IndexNode.h b/Indexes/IndexNode.h
similarity index 72%
rename from IndexNode.h
rename to Indexes/IndexNode.h
index 024e8b1..1908934 100644
--- a/IndexNode.h
+++ b/Indexes/IndexNode.h
@@ -1,19 +1,11 @@
#pragma once
-#include <utility>
-#include "DumpObject.h"
+#include "../DumpObjects/DumpObject.h"
-using std::pair;
using std::shared_ptr;
template<typename TKey, typename TValue>
-class IndexNodeIterator
-{
-public:
- virtual const pair<TKey, TValue> operator *() const = 0;
- virtual IndexNodeIterator& operator ++() = 0;
- virtual bool equals(const IndexNodeIterator *other) const = 0;
-};
+class IndexNodeIterator;
template<typename TKey, typename TValue>
class IndexNode : public DumpObject
@@ -42,4 +34,4 @@
virtual shared_ptr<IndexNodeIterator<TKey, TValue>> end() const = 0;
};
-#include "IndexNode.hpp"
\ No newline at end of file
+#include "IndexNode.tpp"
\ No newline at end of file
diff --git a/IndexNode.hpp b/Indexes/IndexNode.tpp
similarity index 96%
rename from IndexNode.hpp
rename to Indexes/IndexNode.tpp
index 9dde998..9b562fa 100644
--- a/IndexNode.hpp
+++ b/Indexes/IndexNode.tpp
@@ -1,5 +1,6 @@
#include "IndexNode.h"
#include "IndexLeafNode.h"
+#include "../DumpException.h"
template<typename TKey, typename TValue>
IndexNode<TKey, TValue>::IndexNode(weak_ptr<WritableDump> dump)
diff --git a/Indexes/Iterators/IndexIterator.h
b/Indexes/Iterators/IndexIterator.h
new file mode 100644
index 0000000..f73faab
--- /dev/null
+++ b/Indexes/Iterators/IndexIterator.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#include <utility>
+#include <memory>
+#include <iterator>
+#include "IndexNodeIterator.h"
+
+using std::pair;
+using std::shared_ptr;
+using std::iterator;
+using std::input_iterator_tag;
+
+template<typename TKey, typename TValue>
+class IndexIterator : public iterator<input_iterator_tag, const pair<TKey,
TValue>, int32_t>
+{
+ template<typename TKey, typename TValue>
+ friend class Index;
+private:
+ shared_ptr<IndexNodeIterator<TKey, TValue>> nodeIterator;
+ IndexIterator(shared_ptr<IndexNodeIterator<TKey, TValue>> nodeIterator);
+public:
+ const pair<TKey, TValue> operator *() const;
+ IndexIterator<TKey, TValue>& operator ++();
+ bool operator ==(const IndexIterator<TKey, TValue> other);
+ bool operator !=(const IndexIterator<TKey, TValue> other);
+};
+
+#include "IndexIterator.tpp"
\ No newline at end of file
diff --git a/Indexes/Iterators/IndexIterator.tpp
b/Indexes/Iterators/IndexIterator.tpp
new file mode 100644
index 0000000..af9f0cd
--- /dev/null
+++ b/Indexes/Iterators/IndexIterator.tpp
@@ -0,0 +1,33 @@
+#include "IndexIterator.h"
+
+using std::move;
+
+template<typename TKey, typename TValue>
+IndexIterator<TKey, TValue>::IndexIterator(shared_ptr<IndexNodeIterator<TKey,
TValue>> nodeIterator)
+ : nodeIterator(nodeIterator)
+{}
+
+template<typename TKey, typename TValue>
+const pair<TKey, TValue> IndexIterator<TKey, TValue>::operator *() const
+{
+ return **nodeIterator;
+}
+
+template<typename TKey, typename TValue>
+IndexIterator<TKey, TValue>& IndexIterator<TKey, TValue>::operator ++()
+{
+ ++(*nodeIterator);
+ return *this;
+}
+
+template<typename TKey, typename TValue>
+bool IndexIterator<TKey, TValue>::operator ==(const IndexIterator<TKey,
TValue> other)
+{
+ return nodeIterator->equals(other.nodeIterator.get());
+}
+
+template<typename TKey, typename TValue>
+bool IndexIterator<TKey, TValue>::operator !=(const IndexIterator<TKey,
TValue> other)
+{
+ return !(*this == other);
+}
\ No newline at end of file
diff --git a/Indexes/Iterators/IndexLeafIterator.h
b/Indexes/Iterators/IndexLeafIterator.h
new file mode 100644
index 0000000..730571d
--- /dev/null
+++ b/Indexes/Iterators/IndexLeafIterator.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <utility>
+#include <map>
+
+using std::pair;
+using std::map;
+
+template<typename TKey, typename TValue>
+class IndexLeafIterator : public IndexNodeIterator<TKey, TValue>
+{
+ typedef typename map<TKey, TValue>::const_iterator MapIterator;
+
+ template<typename TKey, typename TValue>
+ friend class IndexLeafNode;
+private:
+ MapIterator mapIterator;
+
+ IndexLeafIterator(MapIterator mapIterator);
+public:
+ virtual const pair<TKey, TValue> operator *() const;
+ virtual IndexLeafIterator& operator ++();
+ virtual bool equals(const IndexNodeIterator *other) const;
+};
+
+#include "IndexLeafIterator.tpp"
\ No newline at end of file
diff --git a/Indexes/Iterators/IndexLeafIterator.tpp
b/Indexes/Iterators/IndexLeafIterator.tpp
new file mode 100644
index 0000000..2ba8d87
--- /dev/null
+++ b/Indexes/Iterators/IndexLeafIterator.tpp
@@ -0,0 +1,33 @@
+#include <vector>
+#include "IndexLeafIterator.h"
+#include "../../DumpObjects/DumpTraits.h"
+
+using std::vector;
+
+template<typename TKey, typename TValue>
+IndexLeafIterator<TKey, TValue>::IndexLeafIterator(MapIterator mapIterator)
+ : mapIterator(mapIterator)
+{}
+
+template<typename TKey, typename TValue>
+const pair<TKey, TValue> IndexLeafIterator<TKey, TValue>::operator *() const
+{
+ return *mapIterator;
+}
+
+template<typename TKey, typename TValue>
+IndexLeafIterator<TKey, TValue>& IndexLeafIterator<TKey, TValue>::operator ++()
+{
+ ++mapIterator;
+ return *this;
+}
+
+template<typename TKey, typename TValue>
+bool IndexLeafIterator<TKey, TValue>::equals(const IndexNodeIterator<TKey,
TValue> *other) const
+{
+ auto otherCasted = dynamic_cast<const IndexLeafIterator<TKey,
TValue>*>(other);
+ if (otherCasted == nullptr)
+ return false;
+
+ return mapIterator == otherCasted->mapIterator;
+}
\ No newline at end of file
diff --git a/Indexes/Iterators/IndexNodeIterator.h
b/Indexes/Iterators/IndexNodeIterator.h
new file mode 100644
index 0000000..8aec9c1
--- /dev/null
+++ b/Indexes/Iterators/IndexNodeIterator.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include <utility>
+#include "../../DumpObjects/DumpObject.h"
+
+using std::pair;
+
+template<typename TKey, typename TValue>
+class IndexNodeIterator
+{
+public:
+ virtual const pair<TKey, TValue> operator *() const = 0;
+ virtual IndexNodeIterator& operator ++() = 0;
+ virtual bool equals(const IndexNodeIterator *other) const = 0;
+};
+
+#include "IndexNodeIterator.tpp"
\ No newline at end of file
diff --git a/Indexes/Iterators/IndexNodeIterator.tpp
b/Indexes/Iterators/IndexNodeIterator.tpp
new file mode 100644
index 0000000..7a9a05d
--- /dev/null
+++ b/Indexes/Iterators/IndexNodeIterator.tpp
@@ -0,0 +1 @@
+#include "IndexNodeIterator.h"
diff --git a/SpaceManager.h b/SpaceManager.h
index ae5449a..daf168f 100644
--- a/SpaceManager.h
+++ b/SpaceManager.h
@@ -3,7 +3,7 @@
#include <cstdint>
#include <memory>
#include <map>
-#include "Index.h"
+#include "Indexes/Index.h"
using std::int32_t;
using std::int64_t;
diff --git a/XmlPageProcessor.h b/XmlPageProcessor.h
index 5f4921a..55deab3 100644
--- a/XmlPageProcessor.h
+++ b/XmlPageProcessor.h
@@ -2,7 +2,7 @@
#include <memory>
#include "XML/xmlinput.h"
-#include "Page.h"
+#include "DumpObjects/Page.h"
#include "DumpWriter.h"
using std::shared_ptr;
diff --git a/XmlRevisionProcessor.h b/XmlRevisionProcessor.h
index 04ac0a7..a5238db 100644
--- a/XmlRevisionProcessor.h
+++ b/XmlRevisionProcessor.h
@@ -1,7 +1,7 @@
#pragma once
#include "XML/xmlinput.h"
-#include "Revision.h"
+#include "DumpObjects/Revision.h"
class XmlRevisionProcessor
{
diff --git a/main.cpp b/main.cpp
index 5320821..ec78254 100644
--- a/main.cpp
+++ b/main.cpp
@@ -4,7 +4,6 @@
#include "TestDumpWriter.h"
#include "XmlPageProcessor.h"
#include "Dump.h"
-#include "IndexLeafNode.h"
using std::cin;
--
To view, visit https://gerrit.wikimedia.org/r/72525
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iffb53863c3bc76e16fa19b58fe3993f60b32b07c
Gerrit-PatchSet: 1
Gerrit-Project: operations/dumps/incremental
Gerrit-Branch: gsoc
Gerrit-Owner: Petr Onderka <[email protected]>
Gerrit-Reviewer: Petr Onderka <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits