2013-09-15 12:48:57 +02:00
|
|
|
#ifndef CSM_DOC_SAVINGSTATE_H
|
|
|
|
#define CSM_DOC_SAVINGSTATE_H
|
|
|
|
|
2013-09-15 15:00:41 +02:00
|
|
|
#include <fstream>
|
2014-05-27 12:39:26 +02:00
|
|
|
#include <map>
|
2015-01-22 13:41:09 +01:00
|
|
|
#include <deque>
|
2013-09-15 15:00:41 +02:00
|
|
|
|
|
|
|
#include <boost/filesystem/path.hpp>
|
2014-05-19 15:52:19 +04:00
|
|
|
#include <boost/filesystem/fstream.hpp>
|
2013-09-15 15:00:41 +02:00
|
|
|
|
|
|
|
#include <components/esm/esmwriter.hpp>
|
|
|
|
|
2014-05-12 10:32:57 +02:00
|
|
|
#include <components/to_utf8/to_utf8.hpp>
|
|
|
|
|
2013-09-15 12:48:57 +02:00
|
|
|
namespace CSMDoc
|
|
|
|
{
|
|
|
|
class Operation;
|
2013-09-15 15:00:41 +02:00
|
|
|
class Document;
|
2013-09-15 12:48:57 +02:00
|
|
|
|
|
|
|
class SavingState
|
|
|
|
{
|
|
|
|
Operation& mOperation;
|
2013-09-15 15:00:41 +02:00
|
|
|
boost::filesystem::path mPath;
|
|
|
|
boost::filesystem::path mTmpPath;
|
|
|
|
ToUTF8::Utf8Encoder mEncoder;
|
2014-05-19 15:52:19 +04:00
|
|
|
boost::filesystem::ofstream mStream;
|
2013-09-15 15:00:41 +02:00
|
|
|
ESM::ESMWriter mWriter;
|
2013-09-27 11:36:06 +02:00
|
|
|
boost::filesystem::path mProjectPath;
|
|
|
|
bool mProjectFile;
|
2015-01-22 13:41:09 +01:00
|
|
|
std::map<std::string, std::deque<int> > mSubRecords; // record ID, list of subrecords
|
2013-09-15 12:48:57 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-05-12 10:32:57 +02:00
|
|
|
SavingState (Operation& operation, const boost::filesystem::path& projectPath,
|
|
|
|
ToUTF8::FromType encoding);
|
2013-09-15 12:48:57 +02:00
|
|
|
|
|
|
|
bool hasError() const;
|
2013-09-15 15:00:41 +02:00
|
|
|
|
2013-09-27 11:36:06 +02:00
|
|
|
void start (Document& document, bool project);
|
|
|
|
///< \param project Save project file instead of content file.
|
2013-09-15 15:00:41 +02:00
|
|
|
|
|
|
|
const boost::filesystem::path& getPath() const;
|
|
|
|
|
|
|
|
const boost::filesystem::path& getTmpPath() const;
|
|
|
|
|
2014-05-19 15:52:19 +04:00
|
|
|
boost::filesystem::ofstream& getStream();
|
2013-09-15 15:00:41 +02:00
|
|
|
|
|
|
|
ESM::ESMWriter& getWriter();
|
2013-09-27 11:36:06 +02:00
|
|
|
|
|
|
|
bool isProjectFile() const;
|
|
|
|
///< Currently saving project file? (instead of content file)
|
2014-05-27 12:39:26 +02:00
|
|
|
|
2015-01-22 13:41:09 +01:00
|
|
|
std::map<std::string, std::deque<int> >& getSubRecords();
|
2013-09-15 12:48:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-05-19 15:52:19 +04:00
|
|
|
#endif
|