Browse Source

Use COutputStream in CMapSaverJson

AlexVinS 10 years ago
parent
commit
7d16585f89
2 changed files with 24 additions and 1 deletions
  1. 10 1
      lib/mapping/MapFormatJson.cpp
  2. 14 0
      lib/mapping/MapFormatJson.h

+ 10 - 1
lib/mapping/MapFormatJson.cpp

@@ -11,6 +11,8 @@
 #include "StdInc.h"
 #include "MapFormatJson.h"
 
+#include "../filesystem/CInputStream.h"
+#include "../filesystem/COutputStream.h"
 #include "CMap.h"
 #include "../CModHandler.h"
 #include "../VCMI_Lib.h"
@@ -182,8 +184,15 @@ void CMapLoaderJson::readPlayerInfo()
 }
 
 ///CMapSaverJson
-void CMapSaverJson::saveMap(const std::unique_ptr<CMap>& map)
+CMapSaverJson::CMapSaverJson(COutputStream * stream):
+	output(stream)
 {
 	
 }
 
+
+void CMapSaverJson::saveMap(const std::unique_ptr<CMap>& map)
+{
+	assert(0); // Not implemented	
+}
+

+ 14 - 0
lib/mapping/MapFormatJson.h

@@ -16,6 +16,7 @@
 
 class TriggeredEvent;
 class CInputStream;
+class COutputStream;
 
 class DLL_LINKAGE CMapFormatJson
 {
@@ -116,5 +117,18 @@ private:
 class DLL_LINKAGE CMapSaverJson : public CMapFormatJson, public IMapSaver
 {
 public:
+	/**
+	 * Default constructor.
+	 *
+	 * @param stream a stream to save the map to
+	 */
+	CMapSaverJson(COutputStream * stream);	
+	
+	/**
+	 * Actually saves the VCMI/Json map into stream.
+	 *
+	 */	
 	void saveMap(const std::unique_ptr<CMap> & map) override;	
+private:
+	COutputStream * output;		
 };