write TES3 header

pull/51/head
Marc Zinnschlag 11 years ago
parent 1ee228a566
commit db70095148

@ -10,6 +10,9 @@ CSMDoc::Saving::Saving (Document& document)
{
appendStage (new OpenSaveStage (mDocument, mState));
appendStage (new WriteHeaderStage (mDocument, mState));
appendStage (new CloseSaveStage (mState));

@ -30,6 +30,32 @@ void CSMDoc::OpenSaveStage::perform (int stage, std::vector<std::string>& messag
}
CSMDoc::WriteHeaderStage::WriteHeaderStage (Document& document, SavingState& state)
: mDocument (document), mState (state)
{}
int CSMDoc::WriteHeaderStage::setup()
{
return 1;
}
void CSMDoc::WriteHeaderStage::perform (int stage, std::vector<std::string>& messages)
{
mState.getWriter().setVersion();
mState.getWriter().setFormat (0);
/// \todo fill in missing header information
mState.getWriter().setAuthor ("");
mState.getWriter().setDescription ("");
mState.getWriter().setRecordCount (0);
/// \todo fill in dependency list
mState.getWriter().save (mState.getStream());
}
CSMDoc::CloseSaveStage::CloseSaveStage (SavingState& state)
: mState (state)
{}

@ -24,6 +24,22 @@ namespace CSMDoc
///< Messages resulting from this stage will be appended to \a messages.
};
class WriteHeaderStage : public Stage
{
Document& mDocument;
SavingState& mState;
public:
WriteHeaderStage (Document& document, SavingState& state);
virtual int setup();
///< \return number of steps
virtual void perform (int stage, std::vector<std::string>& messages);
///< Messages resulting from this stage will be appended to \a messages.
};
class CloseSaveStage : public Stage
{
SavingState& mState;

Loading…
Cancel
Save