OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
mergestages.hpp
Go to the documentation of this file.
1 #ifndef CSM_TOOLS_MERGESTAGES_H
2 #define CSM_TOOLS_MERGESTAGES_H
3 
4 #include <algorithm>
5 #include <map>
6 
8 
9 #include "../doc/stage.hpp"
10 
11 #include "../world/data.hpp"
12 
13 #include "mergestate.hpp"
14 
15 namespace CSMTools
16 {
18  {
20 
21  public:
22 
23  StartMergeStage (MergeState& state);
24 
25  virtual int setup();
27 
28  virtual void perform (int stage, CSMDoc::Messages& messages);
30  };
31 
33  {
36 
37  public:
38 
40 
41  virtual int setup();
43 
44  virtual void perform (int stage, CSMDoc::Messages& messages);
46  };
47 
48  template<typename RecordType, typename Collection = CSMWorld::IdCollection<RecordType> >
50  {
52  Collection& (CSMWorld::Data::*mAccessor)();
53 
54  public:
55 
56  MergeIdCollectionStage (MergeState& state, Collection& (CSMWorld::Data::*accessor)());
57 
58  virtual int setup();
60 
61  virtual void perform (int stage, CSMDoc::Messages& messages);
63  };
64 
65  template<typename RecordType, typename Collection>
67  : mState (state), mAccessor (accessor)
68  {}
69 
70  template<typename RecordType, typename Collection>
72  {
73  return (mState.mSource.getData().*mAccessor)().getSize();
74  }
75 
76  template<typename RecordType, typename Collection>
78  {
79  const Collection& source = (mState.mSource.getData().*mAccessor)();
80  Collection& target = (mState.mTarget->getData().*mAccessor)();
81 
82  const CSMWorld::Record<RecordType>& record = source.getRecord (stage);
83 
84  if (!record.isDeleted())
86  }
87 
89  {
91 
92  public:
93 
95 
96  virtual int setup();
98 
99  virtual void perform (int stage, CSMDoc::Messages& messages);
101  };
102 
104  {
106  std::map<std::string, int> mIndex;
107 
108  public:
109 
111 
112  virtual int setup();
114 
115  virtual void perform (int stage, CSMDoc::Messages& messages);
117  };
118 
120  {
122 
123  public:
124 
126 
127  virtual int setup();
129 
130  virtual void perform (int stage, CSMDoc::Messages& messages);
132  };
133 
135  {
137  std::map<std::pair<uint16_t, int>, int>::iterator mNext;
138 
139  public:
140 
142 
143  virtual int setup();
145 
146  virtual void perform (int stage, CSMDoc::Messages& messages);
148  };
149 
151  {
153 
154  public:
155 
156  MergeLandStage (MergeState& state);
157 
158  virtual int setup();
160 
161  virtual void perform (int stage, CSMDoc::Messages& messages);
163  };
164 }
165 
166 #endif
virtual int setup()
Definition: mergestages.cpp:34
MergeState & mState
Definition: mergestages.hpp:152
Definition: mergestages.hpp:17
virtual int setup()
Definition: mergestages.cpp:155
virtual void perform(int stage, CSMDoc::Messages &messages)
Messages resulting from this stage will be appended to messages.
Definition: mergestages.cpp:23
StartMergeStage(MergeState &state)
Definition: mergestages.cpp:14
MergeState & mState
Definition: mergestages.hpp:136
MergeIdCollectionStage(MergeState &state, Collection &(CSMWorld::Data::*accessor)())
Definition: mergestages.hpp:66
virtual void perform(int stage, CSMDoc::Messages &messages)
Messages resulting from this stage will be appended to messages.
Definition: mergestages.cpp:163
virtual int setup()
Definition: mergestages.cpp:18
virtual int setup()
Definition: mergestages.cpp:83
ToUTF8::Utf8Encoder mEncoder
Definition: mergestages.hpp:35
virtual int setup()
Definition: mergestages.cpp:67
ListLandTexturesMergeStage(MergeState &state)
Definition: mergestages.cpp:112
Definition: messages.hpp:38
Definition: mergestages.hpp:49
Collection &(CSMWorld::Data::* mAccessor)()
Definition: mergestages.hpp:52
MergeLandTexturesStage(MergeState &state)
Definition: mergestages.cpp:151
Definition: nestedcolumnadapter.hpp:11
MergeRefIdsStage(MergeState &state)
Definition: mergestages.cpp:65
MergeState & mState
Definition: mergestages.hpp:90
Definition: mergestages.hpp:32
MergeState & mState
Definition: mergestages.hpp:34
MergeState & mState
Definition: mergestages.hpp:121
std::map< std::string, int > mIndex
Definition: mergestages.hpp:106
Definition: stage.hpp:15
Definition: mergestages.hpp:103
Definition: data.hpp:77
FromType
Definition: to_utf8.hpp:11
MergeReferencesStage(MergeState &state)
Definition: mergestages.cpp:79
virtual int setup()
Definition: mergestages.cpp:116
const ESXRecordT & get() const
Throws an exception, if the record is deleted.
Definition: record.hpp:106
virtual void perform(int stage, CSMDoc::Messages &messages)
Messages resulting from this stage will be appended to messages.
Definition: mergestages.cpp:72
Definition: mergestages.hpp:150
virtual void perform(int stage, CSMDoc::Messages &messages)
Messages resulting from this stage will be appended to messages.
Definition: mergestages.cpp:121
MergeState & mState
Definition: mergestages.hpp:105
FinishMergedDocumentStage(MergeState &state, ToUTF8::FromType encoding)
Definition: mergestages.cpp:30
virtual void perform(int stage, CSMDoc::Messages &messages)
Messages resulting from this stage will be appended to messages.
Definition: mergestages.cpp:214
MergeLandStage(MergeState &state)
Definition: mergestages.cpp:207
MergeState & mState
Definition: mergestages.hpp:51
MergeState & mState
Definition: mergestages.hpp:19
std::map< std::pair< uint16_t, int >, int >::iterator mNext
Definition: mergestages.hpp:137
Definition: to_utf8.hpp:25
Definition: mergestate.hpp:13
virtual int setup()
Definition: mergestages.cpp:209
Definition: mergestages.hpp:119
Definition: mergestages.hpp:88
virtual void perform(int stage, CSMDoc::Messages &messages)
Messages resulting from this stage will be appended to messages.
Definition: mergestages.hpp:77
virtual int setup()
Definition: mergestages.hpp:71
bool isDeleted() const
Definition: record.cpp:5
Definition: mergestages.hpp:134
virtual void perform(int stage, CSMDoc::Messages &messages)
Messages resulting from this stage will be appended to messages.
Definition: mergestages.cpp:39
virtual void perform(int stage, CSMDoc::Messages &messages)
Messages resulting from this stage will be appended to messages.
Definition: mergestages.cpp:89