2013-09-15 10:48:57 +00:00
|
|
|
#ifndef CSM_DOC_SAVINGSTATE_H
|
|
|
|
#define CSM_DOC_SAVINGSTATE_H
|
|
|
|
|
2013-09-15 13:00:41 +00:00
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
#include <boost/filesystem/path.hpp>
|
|
|
|
|
|
|
|
#include <components/esm/esmwriter.hpp>
|
|
|
|
|
2013-09-15 10:48:57 +00:00
|
|
|
namespace CSMDoc
|
|
|
|
{
|
|
|
|
class Operation;
|
2013-09-15 13:00:41 +00:00
|
|
|
class Document;
|
2013-09-15 10:48:57 +00:00
|
|
|
|
|
|
|
class SavingState
|
|
|
|
{
|
|
|
|
Operation& mOperation;
|
2013-09-15 13:00:41 +00:00
|
|
|
boost::filesystem::path mPath;
|
|
|
|
boost::filesystem::path mTmpPath;
|
|
|
|
ToUTF8::Utf8Encoder mEncoder;
|
|
|
|
std::ofstream mStream;
|
|
|
|
ESM::ESMWriter mWriter;
|
2013-09-27 09:36:06 +00:00
|
|
|
boost::filesystem::path mProjectPath;
|
|
|
|
bool mProjectFile;
|
2013-09-15 10:48:57 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-09-27 09:36:06 +00:00
|
|
|
SavingState (Operation& operation, const boost::filesystem::path& projectPath);
|
2013-09-15 10:48:57 +00:00
|
|
|
|
|
|
|
bool hasError() const;
|
2013-09-15 13:00:41 +00:00
|
|
|
|
2013-09-27 09:36:06 +00:00
|
|
|
void start (Document& document, bool project);
|
|
|
|
///< \param project Save project file instead of content file.
|
2013-09-15 13:00:41 +00:00
|
|
|
|
|
|
|
const boost::filesystem::path& getPath() const;
|
|
|
|
|
|
|
|
const boost::filesystem::path& getTmpPath() const;
|
|
|
|
|
|
|
|
std::ofstream& getStream();
|
|
|
|
|
|
|
|
ESM::ESMWriter& getWriter();
|
2013-09-27 09:36:06 +00:00
|
|
|
|
|
|
|
bool isProjectFile() const;
|
|
|
|
///< Currently saving project file? (instead of content file)
|
2013-09-15 10:48:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|