diff --git a/Sources/NodeEngineTest/NodeEditorTest.cpp b/Sources/NodeEngineTest/NodeEditorTest.cpp index d535717b..ac286bd4 100644 --- a/Sources/NodeEngineTest/NodeEditorTest.cpp +++ b/Sources/NodeEngineTest/NodeEditorTest.cpp @@ -20,7 +20,7 @@ TEST (NodeEditorNeedToSaveTest) ASSERT (env.nodeEditor.NeedToSave ()); MemoryOutputStream outputStream; - ASSERT (env.nodeEditor.Save (outputStream, nullptr)); + ASSERT (env.nodeEditor.Save (outputStream)); ASSERT (!env.nodeEditor.NeedToSave ()); env.nodeEditor.New (); @@ -29,7 +29,7 @@ TEST (NodeEditorNeedToSaveTest) ASSERT (env.nodeEditor.NeedToSave ()); MemoryInputStream inputStream (outputStream.GetBuffer ()); - ASSERT (env.nodeEditor.Open (inputStream, nullptr)); + ASSERT (env.nodeEditor.Open (inputStream)); ASSERT (!env.nodeEditor.NeedToSave ()); env.nodeEditor.AddNode (UINodePtr (new IntegerUpDownNode (String (L"Integer"), Point (0.0, 0.0), 0, 1))); ASSERT (env.nodeEditor.NeedToSave ()); diff --git a/Sources/NodeUIEngine/NUIE_NodeEditor.cpp b/Sources/NodeUIEngine/NUIE_NodeEditor.cpp index d750f37e..c8b6d598 100644 --- a/Sources/NodeUIEngine/NUIE_NodeEditor.cpp +++ b/Sources/NodeUIEngine/NUIE_NodeEditor.cpp @@ -11,11 +11,6 @@ namespace NUIE static const std::string NodeEditorFileMarker = "NodeEditorFile"; -ExternalHeaderIO::~ExternalHeaderIO () -{ - -} - ExternalFileIO::~ExternalFileIO () { @@ -187,7 +182,7 @@ void NodeEditor::New () Update (); } -bool NodeEditor::Open (const std::wstring& fileName, const ExternalFileIO* externalFileIO, const ExternalHeaderIO* externalHeader) +bool NodeEditor::Open (const std::wstring& fileName, const ExternalFileIO* externalFileIO) { std::vector buffer; if (DBGERROR (!externalFileIO->ReadBufferFromFile (fileName, buffer))) { @@ -195,17 +190,11 @@ bool NodeEditor::Open (const std::wstring& fileName, const ExternalFileIO* exter } NE::MemoryInputStream inputStream (buffer); - return Open (inputStream, externalHeader); + return Open (inputStream); } -bool NodeEditor::Open (NE::InputStream& inputStream, const ExternalHeaderIO* externalHeader) +bool NodeEditor::Open (NE::InputStream& inputStream) { - if (externalHeader != nullptr) { - if (!externalHeader->Read (inputStream)) { - return false; - } - } - std::string fileMarker; inputStream.Read (fileMarker); if (fileMarker != NodeEditorFileMarker) { @@ -226,10 +215,10 @@ bool NodeEditor::Open (NE::InputStream& inputStream, const ExternalHeaderIO* ext return true; } -bool NodeEditor::Save (const std::wstring& fileName, const ExternalFileIO* externalFileIO, const ExternalHeaderIO* externalHeader) const +bool NodeEditor::Save (const std::wstring& fileName, const ExternalFileIO* externalFileIO) const { NE::MemoryOutputStream outputStream; - if (DBGERROR (!Save (outputStream, externalHeader))) { + if (DBGERROR (!Save (outputStream))) { return false; } @@ -241,12 +230,8 @@ bool NodeEditor::Save (const std::wstring& fileName, const ExternalFileIO* exter return true; } -bool NodeEditor::Save (NE::OutputStream& outputStream, const ExternalHeaderIO* externalHeader) const +bool NodeEditor::Save (NE::OutputStream& outputStream) const { - if (externalHeader != nullptr) { - externalHeader->Write (outputStream); - } - const Version& currentVersion = GetCurrentVersion (); outputStream.Write (NodeEditorFileMarker); currentVersion.Write (outputStream); diff --git a/Sources/NodeUIEngine/NUIE_NodeEditor.hpp b/Sources/NodeUIEngine/NUIE_NodeEditor.hpp index 17db6d2d..e16675db 100644 --- a/Sources/NodeUIEngine/NUIE_NodeEditor.hpp +++ b/Sources/NodeUIEngine/NUIE_NodeEditor.hpp @@ -12,15 +12,6 @@ namespace NUIE { -class ExternalHeaderIO -{ -public: - virtual ~ExternalHeaderIO (); - - virtual bool Read (NE::InputStream& inputStream) const = 0; - virtual void Write (NE::OutputStream& outputStream) const = 0; -}; - class ExternalFileIO { public: @@ -72,10 +63,10 @@ class NodeEditor void SetSelectedNodes (const NE::NodeCollection& newSelectedNodes); void New (); - bool Open (const std::wstring& fileName, const ExternalFileIO* externalFileIO, const ExternalHeaderIO* externalHeader); - bool Open (NE::InputStream& inputStream, const ExternalHeaderIO* externalHeader); - bool Save (const std::wstring& fileName, const ExternalFileIO* externalFileIO, const ExternalHeaderIO* externalHeader) const; - bool Save (NE::OutputStream& outputStream, const ExternalHeaderIO* externalHeader) const; + bool Open (const std::wstring& fileName, const ExternalFileIO* externalFileIO); + bool Open (NE::InputStream& inputStream); + bool Save (const std::wstring& fileName, const ExternalFileIO* externalFileIO) const; + bool Save (NE::OutputStream& outputStream) const; bool NeedToSave () const; void SetSelectedNodesParameters ();