OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
topicinfocheck.hpp
Go to the documentation of this file.
1 #ifndef CSM_TOOLS_TOPICINFOCHECK_HPP
2 #define CSM_TOOLS_TOPICINFOCHECK_HPP
3 
4 #include <set>
5 
13 
14 #include "../world/cell.hpp"
15 #include "../world/idcollection.hpp"
16 #include "../world/infocollection.hpp"
17 #include "../world/refiddata.hpp"
18 #include "../world/resources.hpp"
19 
20 #include "../doc/stage.hpp"
21 
22 namespace CSMTools
23 {
26  {
27  public:
28 
30  const CSMWorld::InfoCollection& topicInfos,
40  const CSMWorld::RefIdData& referencables,
41  const CSMWorld::Resources& soundFiles);
42 
43  virtual int setup();
45 
46  virtual void perform(int step, CSMDoc::Messages& messages);
48 
49  private:
50 
52 
62 
65 
66  std::set<std::string> mCellNames;
67 
68  // These return false when not successful and write an error
69  bool verifyActor(const std::string& name, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
70  bool verifyCell(const std::string& name, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
71  bool verifyFactionRank(const std::string& name, int rank, const CSMWorld::UniversalId& id,
72  CSMDoc::Messages& messages);
73  bool verifyItem(const std::string& name, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
75  CSMDoc::Messages& messages);
76  bool verifySound(const std::string& name, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
77 
78  template <typename T>
79  bool verifyId(const std::string& name, const CSMWorld::IdCollection<T>& collection,
80  const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
81 
82  // Common error messages
83  void writeMissingIdError(const std::string& specifier, const std::string& missingId,
84  const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
85 
86  void writeDeletedRecordError(const std::string& specifier, const std::string& recordId,
87  const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
88 
89  void writeInvalidTypeError(const std::string& specifier, const std::string& invalidId,
90  CSMWorld::UniversalId::Type invalidType, const std::string& expectedType,
91  const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
92  };
93 }
94 
95 #endif
const CSMWorld::IdCollection< CSMWorld::Cell > & mCells
Definition: topicinfocheck.hpp:53
const CSMWorld::Resources & mSoundFiles
Definition: topicinfocheck.hpp:64
void writeMissingIdError(const std::string &specifier, const std::string &missingId, const CSMWorld::UniversalId &id, CSMDoc::Messages &messages)
Definition: topicinfocheck.cpp:412
const CSMWorld::IdCollection< ESM::Dialogue > & mJournals
Definition: topicinfocheck.hpp:58
bool verifySound(const std::string &name, const CSMWorld::UniversalId &id, CSMDoc::Messages &messages)
Definition: topicinfocheck.cpp:376
Type
Definition: universalid.hpp:40
Definition: refiddata.hpp:219
virtual void perform(int step, CSMDoc::Messages &messages)
Messages resulting from this stage will be appended to messages.
Definition: topicinfocheck.cpp:73
virtual int setup()
Definition: topicinfocheck.cpp:34
bool verifySelectStruct(const ESM::DialInfo::SelectStruct &select, const CSMWorld::UniversalId &id, CSMDoc::Messages &messages)
Definition: topicinfocheck.cpp:280
const CSMWorld::IdCollection< ESM::GameSetting > & mGameSettings
Definition: topicinfocheck.hpp:56
Definition: infocollection.hpp:14
Definition: messages.hpp:38
std::vector< std::string > globals
Definition: defines.cpp:22
void writeInvalidTypeError(const std::string &specifier, const std::string &invalidId, CSMWorld::UniversalId::Type invalidType, const std::string &expectedType, const CSMWorld::UniversalId &id, CSMDoc::Messages &messages)
Definition: topicinfocheck.cpp:430
const CSMWorld::IdCollection< ESM::Dialogue > & mTopics
Definition: topicinfocheck.hpp:61
VerifyStage: check topics.
Definition: topicinfocheck.hpp:25
const CSMWorld::InfoCollection & mTopicInfos
Definition: topicinfocheck.hpp:51
bool verifyFactionRank(const std::string &name, int rank, const CSMWorld::UniversalId &id, CSMDoc::Messages &messages)
Definition: topicinfocheck.cpp:199
TopicInfoCheckStage(const CSMWorld::InfoCollection &topicInfos, const CSMWorld::IdCollection< CSMWorld::Cell > &cells, const CSMWorld::IdCollection< ESM::Class > &classes, const CSMWorld::IdCollection< ESM::Faction > &factions, const CSMWorld::IdCollection< ESM::GameSetting > &gmsts, const CSMWorld::IdCollection< ESM::Global > &globals, const CSMWorld::IdCollection< ESM::Dialogue > &journals, const CSMWorld::IdCollection< ESM::Race > &races, const CSMWorld::IdCollection< ESM::Region > &regions, const CSMWorld::IdCollection< ESM::Dialogue > &topics, const CSMWorld::RefIdData &referencables, const CSMWorld::Resources &soundFiles)
Definition: topicinfocheck.cpp:7
Definition: resources.hpp:17
const CSMWorld::IdCollection< ESM::Region > & mRegions
Definition: topicinfocheck.hpp:60
Definition: stage.hpp:15
const CSMWorld::RefIdData & mReferencables
Definition: topicinfocheck.hpp:63
std::set< std::string > mCellNames
Definition: topicinfocheck.hpp:66
bool verifyCell(const std::string &name, const CSMWorld::UniversalId &id, CSMDoc::Messages &messages)
Definition: topicinfocheck.cpp:185
Definition: loadinfo.hpp:50
bool verifyItem(const std::string &name, const CSMWorld::UniversalId &id, CSMDoc::Messages &messages)
Definition: topicinfocheck.cpp:235
const CSMWorld::IdCollection< ESM::Global > & mGlobals
Definition: topicinfocheck.hpp:57
bool verifyActor(const std::string &name, const CSMWorld::UniversalId &id, CSMDoc::Messages &messages)
Definition: topicinfocheck.cpp:159
const CSMWorld::IdCollection< ESM::Race > & mRaces
Definition: topicinfocheck.hpp:59
bool verifyId(const std::string &name, const CSMWorld::IdCollection< T > &collection, const CSMWorld::UniversalId &id, CSMDoc::Messages &messages)
Definition: topicinfocheck.cpp:391
const CSMWorld::IdCollection< ESM::Faction > & mFactions
Definition: topicinfocheck.hpp:55
const CSMWorld::IdCollection< ESM::Class > & mClasses
Definition: topicinfocheck.hpp:54
void writeDeletedRecordError(const std::string &specifier, const std::string &recordId, const CSMWorld::UniversalId &id, CSMDoc::Messages &messages)
Definition: topicinfocheck.cpp:421
const char * name
Definition: crashcatcher.cpp:59
Definition: universalid.hpp:12