1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00
OpenMW/apps/opencs/model/doc/savingstate.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

56 lines
1.3 KiB
C++
Raw Normal View History

#ifndef CSM_DOC_SAVINGSTATE_H
#define CSM_DOC_SAVINGSTATE_H
#include <deque>
#include <filesystem>
#include <fstream>
#include <map>
2022-10-19 19:02:00 +02:00
#include <string>
#include <components/esm3/esmwriter.hpp>
#include <components/to_utf8/to_utf8.hpp>
namespace CSMDoc
{
class Operation;
class Document;
class SavingState
{
Operation& mOperation;
std::filesystem::path mPath;
std::filesystem::path mTmpPath;
ToUTF8::Utf8Encoder mEncoder;
std::ofstream mStream;
ESM::ESMWriter mWriter;
std::filesystem::path mProjectPath;
bool mProjectFile;
std::map<std::string, std::deque<int>> mSubRecords; // record ID, list of subrecords
2022-09-22 21:26:05 +03:00
public:
SavingState(Operation& operation, std::filesystem::path projectPath, ToUTF8::FromType encoding);
bool hasError() const;
void start(Document& document, bool project);
///< \param project Save project file instead of content file.
const std::filesystem::path& getPath() const;
const std::filesystem::path& getTmpPath() const;
std::ofstream& getStream();
ESM::ESMWriter& getWriter();
bool isProjectFile() const;
///< Currently saving project file? (instead of content file)
std::map<std::string, std::deque<int>>& getSubRecords();
};
}
#endif