Explorar o código

Merge branch 'master' into rendering-2

Conflicts:
	src/ScriptResource.cpp
	src/os/linux/CMakeLists.txt
	src/renderers/gl/glx/GLContext.h
	tools/compilers/lua/LuaCompiler.cpp
Daniele Bartolini %!s(int64=12) %!d(string=hai) anos
pai
achega
92e6a7a0ef
Modificáronse 48 ficheiros con 391 adicións e 398 borrados
  1. 1 1
      CMakeLists.txt
  2. 2 2
      samples/json/json.cpp
  3. 5 5
      src/ArchiveResourceArchive.cpp
  4. 4 4
      src/ArchiveResourceArchive.h
  5. 24 22
      src/CMakeLists.txt
  6. 6 9
      src/Crown.h
  7. 4 4
      src/FileResourceArchive.cpp
  8. 3 3
      src/FileResourceArchive.h
  9. 17 17
      src/JSONParser.cpp
  10. 4 4
      src/JSONParser.h
  11. 3 3
      src/ResourceArchive.h
  12. 2 2
      src/ResourceManager.cpp
  13. 2 2
      src/TextResource.cpp
  14. 2 2
      src/TextureResource.cpp
  15. 10 10
      src/core/filesystem/BinaryReader.cpp
  16. 4 4
      src/core/filesystem/BinaryReader.h
  17. 10 10
      src/core/filesystem/BinaryWriter.cpp
  18. 4 4
      src/core/filesystem/BinaryWriter.h
  19. 20 20
      src/core/filesystem/DiskFile.cpp
  20. 21 24
      src/core/filesystem/DiskFile.h
  21. 9 9
      src/core/filesystem/File.cpp
  22. 34 34
      src/core/filesystem/File.h
  23. 4 4
      src/core/filesystem/Filesystem.cpp
  24. 4 4
      src/core/filesystem/Filesystem.h
  25. 20 18
      src/core/filesystem/MemoryFile.cpp
  26. 23 23
      src/core/filesystem/MemoryFile.h
  27. 24 24
      src/core/filesystem/NullFile.h
  28. 4 4
      src/core/filesystem/TextReader.cpp
  29. 6 6
      src/core/filesystem/TextReader.h
  30. 3 3
      src/core/filesystem/TextWriter.cpp
  31. 6 6
      src/core/filesystem/TextWriter.h
  32. 14 16
      src/os/android/OsFile.cpp
  33. 6 6
      src/os/android/OsFile.h
  34. 1 1
      src/os/linux/OsFile.h
  35. 16 16
      src/os/posix/OsFile.cpp
  36. 6 6
      src/os/posix/OsFile.h
  37. 0 3
      src/renderers/gl/glx/GLContext.h
  38. 8 8
      tools/compilers/Compiler.cpp
  39. 9 9
      tools/compilers/Compiler.h
  40. 5 5
      tools/compilers/ps/PSCompiler.cpp
  41. 4 4
      tools/compilers/ps/PSCompiler.h
  42. 4 4
      tools/compilers/resource-linker.cpp
  43. 7 7
      tools/compilers/tga/TGACompiler.cpp
  44. 7 7
      tools/compilers/tga/TGACompiler.h
  45. 5 5
      tools/compilers/txt/TXTCompiler.cpp
  46. 5 5
      tools/compilers/txt/TXTCompiler.h
  47. 5 5
      tools/compilers/vs/VSCompiler.cpp
  48. 4 4
      tools/compilers/vs/VSCompiler.h

+ 1 - 1
CMakeLists.txt

@@ -20,7 +20,7 @@ set (CROWN_INCLUDES
 	${CMAKE_SOURCE_DIR}/src/core/math
 	${CMAKE_SOURCE_DIR}/src/core/mem
 	${CMAKE_SOURCE_DIR}/src/core/compressors
-	${CMAKE_SOURCE_DIR}/src/core/streams
+	${CMAKE_SOURCE_DIR}/src/core/filesystem
 	${CMAKE_SOURCE_DIR}/src/core/strings
 	${CMAKE_SOURCE_DIR}/src/core/settings
 	${CMAKE_SOURCE_DIR}/src/os

+ 2 - 2
samples/json/json.cpp

@@ -2,7 +2,7 @@
 #include <string.h>
 #include "JSONParser.h"
 #include "Filesystem.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 
 using namespace crown;
 
@@ -24,7 +24,7 @@ int main(int argc, char** argv)
 	
 	char dst[10][256];
 
-	FileStream* stream = (FileStream*)conf_root.open("json.json", SOM_READ);
+	DiskFile* stream = (DiskFile*)conf_root.open("json.json", FOM_READ);
 
  	JSONParser* parser = new JSONParser(stream);
 

+ 5 - 5
src/ArchiveResourceArchive.cpp

@@ -26,7 +26,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "ArchiveResourceArchive.h"
 #include "Filesystem.h"
 #include "Resource.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 #include "Log.h"
 
 namespace crown
@@ -40,7 +40,7 @@ ArchiveResourceArchive::ArchiveResourceArchive(Filesystem& fs) :
 	m_entries(NULL)
 {
 	// FIXME Default archive name
-	m_archive_file = (FileStream*)m_filesystem.open("archive.bin", SOM_READ);
+	m_archive_file = (DiskFile*)m_filesystem.open("archive.bin", FOM_READ);
 	
 	ArchiveHeader header;
 	
@@ -76,7 +76,7 @@ ArchiveResourceArchive::~ArchiveResourceArchive()
 }
 
 //-----------------------------------------------------------------------------
-FileStream* ArchiveResourceArchive::open(ResourceId name)
+DiskFile* ArchiveResourceArchive::open(ResourceId name)
 {
 	// Search the resource in the archive
 	for (uint32_t i = 0; i < m_entries_count; i++)
@@ -86,7 +86,7 @@ FileStream* ArchiveResourceArchive::open(ResourceId name)
 			// If found, seek to the first byte of the resource data
 			m_archive_file->seek(m_entries[i].offset);
 
-			return (FileStream*)m_archive_file;
+			return (DiskFile*)m_archive_file;
 		}
 	}
 
@@ -94,7 +94,7 @@ FileStream* ArchiveResourceArchive::open(ResourceId name)
 }
 
 //-----------------------------------------------------------------------------
-void ArchiveResourceArchive::close(FileStream* resource)
+void ArchiveResourceArchive::close(DiskFile* resource)
 {
 	// Does nothing, the stream is automatically closed at exit.
 	(void)resource;

+ 4 - 4
src/ArchiveResourceArchive.h

@@ -32,7 +32,7 @@ namespace crown
 {
 
 class Filesystem;
-class FileStream;
+class DiskFile;
 
 /// Structure of the archive
 ///
@@ -62,16 +62,16 @@ public:
 					~ArchiveResourceArchive();
 
 	/// @copydoc ResourceArchive::open()
-	FileStream*		open(ResourceId name);
+	DiskFile*		open(ResourceId name);
 
 	/// @copydoc ResourceArchive::close()
-	void			close(FileStream* resource);
+	void			close(DiskFile* resource);
 
 private:
 
 	Filesystem&		m_filesystem;
 
-	FileStream*		m_archive_file;
+	DiskFile*		m_archive_file;
 
 	uint32_t		m_entries_count;
 	ArchiveEntry*	m_entries;

+ 24 - 22
src/CMakeLists.txt

@@ -1,7 +1,6 @@
 set (SRC
 	Camera.cpp
 	Device.cpp
-	Filesystem.cpp
 	MaterialResource.cpp
 	ResourceManager.cpp
 	Skybox.cpp
@@ -23,7 +22,6 @@ set (HEADERS
 	Config.h
 	Crown.h
 	Device.h
-	Filesystem.h
 	Glyph.h
 	MaterialResource.h
 	Resource.h
@@ -115,27 +113,31 @@ set (MATH_HEADERS
 	core/math/Vec4.h
 )
 
-set (STREAMS_SRC
-	core/streams/FileStream.cpp
-	core/streams/MemoryStream.cpp
-	core/streams/Stream.cpp
+set (FILESYSTEM_SRC
+	core/filesystem/DiskFile.cpp
+	core/filesystem/MemoryFile.cpp
+	core/filesystem/File.cpp
 	
-	core/streams/BinaryReader.cpp
-	core/streams/BinaryWriter.cpp
-	core/streams/TextReader.cpp
-	core/streams/TextWriter.cpp
+	core/filesystem/BinaryReader.cpp
+	core/filesystem/BinaryWriter.cpp
+	core/filesystem/TextReader.cpp
+	core/filesystem/TextWriter.cpp
+
+	core/filesystem/Filesystem.cpp
 )
 
-set (STREAMS_HEADERS
-	core/streams/FileStream.h
-	core/streams/MemoryStream.h
-	core/streams/NullStream.h
-	core/streams/Stream.h
+set (FILESYSTEM_HEADERS
+	core/filesystem/DiskFile.h
+	core/filesystem/MemoryFile.h
+	core/filesystem/NullFile.h
+	core/filesystem/File.h
+
+	core/filesystem/BinaryReader.h
+	core/filesystem/BinaryWriter.h
+	core/filesystem/TextReader.h
+	core/filesystem/TextWriter.h
 
-	core/streams/BinaryReader.h
-	core/streams/BinaryWriter.h
-	core/streams/TextReader.h
-	core/streams/TextWriter.h
+	core/filesystem/Filesystem.h
 )
 
 set (STRINGS_SRC
@@ -304,7 +306,7 @@ set (CROWN_SOURCES
 	${BV_SRC}
 	${CONTAINERS_SRC}
 	${MATH_SRC}
-	${STREAMS_SRC}
+	${FILESYSTEM_SRC}
 	${MEM_SRC}
 	${COMPRESSORS_SRC}
 	${SETTINGS_SRC}
@@ -325,7 +327,7 @@ set (CROWN_HEADERS
 	${BV_HEADERS}
 	${CONTAINERS_HEADERS}
 	${MATH_HEADERS}
-	${STREAMS_HEADERS}
+	${FILESYSTEM_HEADERS}
 	${MEM_HEADERS}
 	${COMPRESSORS_HEADERS}
 	${SETTINGS_HEADERS}
@@ -362,7 +364,7 @@ install (FILES ${CORE_HEADERS} DESTINATION include/${CMAKE_PROJECT_NAME}/core)
 install (FILES ${BV_HEADERS} DESTINATION include/${CMAKE_PROJECT_NAME}/core/bv)
 install (FILES ${CONTAINERS_HEADERS} DESTINATION include/${CMAKE_PROJECT_NAME}/core/containers)
 install (FILES ${MATH_HEADERS} DESTINATION include/${CMAKE_PROJECT_NAME}/core/math)
-install (FILES ${STREAMS_HEADERS} DESTINATION include/${CMAKE_PROJECT_NAME}/core/streams)
+install (FILES ${FILESYSTEM_HEADERS} DESTINATION include/${CMAKE_PROJECT_NAME}/core/filesystem)
 install (FILES ${MEM_HEADERS} DESTINATION include/${CMAKE_PROJECT_NAME}/core/mem)
 install (FILES ${COMPRESSORS_HEADERS} DESTINATION include/${CMAKE_PROJECT_NAME}/core/compressors)
 install (FILES ${THREADS_HEADERS} DESTINATION include/${CMAKE_PROJECT_NAME}/core/threads)

+ 6 - 9
src/Crown.h

@@ -75,16 +75,16 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "MallocAllocator.h"
 #include "ProxyAllocator.h"
 
-// Core/Streams
-#include "Stream.h"
-#include "FileStream.h"
-#include "MemoryStream.h"
-#include "NullStream.h"
-
+// Core/Filesystem
+#include "File.h"
+#include "DiskFile.h"
+#include "MemoryFile.h"
+#include "NullFile.h"
 #include "BinaryReader.h"
 #include "BinaryWriter.h"
 #include "TextReader.h"
 #include "TextWriter.h"
+#include "Filesystem.h"
 
 // Core/Threads
 #include "Thread.h"
@@ -112,9 +112,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "VertexShaderResource.h"
 #include "PixelShaderResource.h"
 
-// Engine/Filesystem
-#include "Filesystem.h"
-
 // Engine/Input
 #include "EventDispatcher.h"
 #include "InputManager.h"

+ 4 - 4
src/FileResourceArchive.cpp

@@ -27,7 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "FileResourceArchive.h"
 #include "Filesystem.h"
 #include "Resource.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 #include "Log.h"
 #include "String.h"
 
@@ -46,7 +46,7 @@ FileResourceArchive::~FileResourceArchive()
 }
 
 //-----------------------------------------------------------------------------
-FileStream* FileResourceArchive::open(ResourceId name)
+DiskFile* FileResourceArchive::open(ResourceId name)
 {
 	// Convert name/type into strings
 	char resource_name[512];
@@ -60,7 +60,7 @@ FileStream* FileResourceArchive::open(ResourceId name)
 		return NULL;
 	}
 
-	FileStream* file = (FileStream*)m_filesystem.open(resource_name, SOM_READ);
+	DiskFile* file = (DiskFile*)m_filesystem.open(resource_name, FOM_READ);
 
 	file->skip(sizeof(ResourceHeader));
 
@@ -68,7 +68,7 @@ FileStream* FileResourceArchive::open(ResourceId name)
 }
 
 //-----------------------------------------------------------------------------
-void FileResourceArchive::close(FileStream* resource)
+void FileResourceArchive::close(DiskFile* resource)
 {
 	m_filesystem.close(resource);
 }

+ 3 - 3
src/FileResourceArchive.h

@@ -32,7 +32,7 @@ namespace crown
 {
 
 class Filesystem;
-class FileStream;
+class DiskFile;
 
 // The header of every compiled resource file.
 // KEEP IN SYNC WITH CompiledResource struct in Compiler.h!
@@ -54,10 +54,10 @@ public:
 					~FileResourceArchive();
 
 	/// @copydoc ResourceArchive::open()
-	FileStream*		open(ResourceId name);
+	DiskFile*		open(ResourceId name);
 
 	/// @copydoc ResourceArchive::close()
-	void			close(FileStream* resource);
+	void			close(DiskFile* resource);
 
 
 private:

+ 17 - 17
src/JSONParser.cpp

@@ -1,11 +1,11 @@
 #include "JSONParser.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 
 namespace crown
 {
 
 //--------------------------------------------------------------------------
-JSONParser::JSONParser(Stream* stream, size_t size)
+JSONParser::JSONParser(File* file, size_t size)
 {
 	if (size > 1024)
 	{
@@ -18,9 +18,9 @@ JSONParser::JSONParser(Stream* stream, size_t size)
 
 	m_size = size;
 
-	m_stream = stream;
+	m_file = file;
 
-	m_pos = m_stream->position();
+	m_pos = m_file->position();
 
 	m_next_token = 0;
 
@@ -67,12 +67,12 @@ JSONParser::parse()
 
 	char c;
 
-	while(!m_stream->end_of_stream())
+	while(!m_file->end_of_file())
 	{
 		JSONType type;
 
-		m_stream->read(&c, 1);
-		m_pos = m_stream->position();
+		m_file->read(&c, 1);
+		m_pos = m_file->position();
 
 		switch(c)
 		{
@@ -198,10 +198,10 @@ JSONParser::parse_string()
 
 	char c; 
 
-	while(!m_stream->end_of_stream())
+	while(!m_file->end_of_file())
 	{	
-		m_stream->read(&c, 1);
-		m_pos = m_stream->position();
+		m_file->read(&c, 1);
+		m_pos = m_file->position();
 
 		if (c == '\"' || c == '\'')
 		{
@@ -221,8 +221,8 @@ JSONParser::parse_string()
 
 		if (c == '\\')
 		{
-			m_stream->read(&c, 1);
-			m_pos = m_stream->position();
+			m_file->read(&c, 1);
+			m_pos = m_file->position();
 
 			switch(c)
 			{
@@ -256,14 +256,14 @@ JSONParser::parse_primitive()
 {
 	JSONToken* token;
 
-	int start = m_stream->position();
+	int start = m_file->position();
 
 	char c;
 
-	while (!m_stream->end_of_stream())
+	while (!m_file->end_of_file())
 	{
-		m_stream->read(&c, 1);
-		m_pos = m_stream->position();
+		m_file->read(&c, 1);
+		m_pos = m_file->position();
 
 		switch (c)
 		{
@@ -285,7 +285,7 @@ JSONParser::parse_primitive()
 
 				token->m_parent = m_prev_token;
 
-				m_stream->seek(start);
+				m_file->seek(start);
 
 				return JSON_SUCCESS;
 			}

+ 4 - 4
src/JSONParser.h

@@ -2,7 +2,7 @@
 
 #include "Types.h"
 #include "OS.h"
-#include "Stream.h"
+#include "File.h"
 
 namespace crown
 {
@@ -55,7 +55,7 @@ class JSONParser
 {
 public:
 	/// Constructor
-					JSONParser(Stream* stream, size_t size = 1024);
+					JSONParser(File* file, size_t size = 1024);
 	/// Destructor
 					~JSONParser();
 	// /// Init JSON parser, must be called for each different JSON string
@@ -79,8 +79,8 @@ private:
 	/// Fill token and set boundaries
 	void			fill_token(JSONToken* token, JSONType type, int32_t start, int32_t end);
 
-	/// JSON stream of data
-	Stream*			m_stream;
+	/// JSON file of data
+	File*			m_file;
 	/// JSON string offset
 	uint32_t 		m_pos;
 	/// Next token to allocate				

+ 3 - 3
src/ResourceArchive.h

@@ -49,7 +49,7 @@ struct ArchiveEntry
 };
 
 class Filesystem;
-class FileStream;
+class DiskFile;
 
 class ResourceArchive
 {
@@ -63,10 +63,10 @@ public:
 	/// The resource stream points exactly at the start
 	/// of the useful resource data, so you do not have to
 	/// care about skipping headers, metadatas and so on.
-	virtual FileStream*		open(ResourceId name) = 0;
+	virtual DiskFile*		open(ResourceId name) = 0;
 
 	/// Closes the resource file.
-	virtual void			close(FileStream* resource) = 0;
+	virtual void			close(DiskFile* resource) = 0;
 };
 
 } // namespace crown

+ 2 - 2
src/ResourceManager.cpp

@@ -35,7 +35,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Device.h"
 #include "Filesystem.h"
 #include "TextReader.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 #include "TextResource.h"
 #include "TextureResource.h"
 #include "VertexShaderResource.h"
@@ -55,7 +55,7 @@ ResourceManager::ResourceManager(ResourceArchive& archive, Allocator& allocator)
 	m_background_thread_should_run(true),
 	m_thread(ResourceManager::background_thread, (void*)this, "resource-loader-thread")
 {
-	FileStream* seed_file = device()->filesystem()->open("seed.ini", SOM_READ);
+	DiskFile* seed_file = device()->filesystem()->open("seed.ini", FOM_READ);
 	TextReader reader(*seed_file);
 
 	char tmp_buf[32];

+ 2 - 2
src/TextResource.cpp

@@ -1,5 +1,5 @@
 #include "TextResource.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 #include "ResourceArchive.h"
 #include "Log.h"
 #include "Allocator.h"
@@ -10,7 +10,7 @@ namespace crown
 //-----------------------------------------------------------------------------
 void* TextResource::load(Allocator& allocator, ResourceArchive& archive, ResourceId id)
 {
-	FileStream* stream = archive.open(id);
+	DiskFile* stream = archive.open(id);
 
 	CE_ASSERT(stream != NULL, "Resource does not exist: %.8X%.8X", id.name, id.type);
 

+ 2 - 2
src/TextureResource.cpp

@@ -1,7 +1,7 @@
 #include "TextureResource.h"
 #include "ResourceArchive.h"
 #include "Log.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 #include "Assert.h"
 #include "Allocator.h"
 #include "Device.h"
@@ -13,7 +13,7 @@ namespace crown
 //-----------------------------------------------------------------------------
 void* TextureResource::load(Allocator& allocator, ResourceArchive& archive, ResourceId id)
 {
-	FileStream* stream = archive.open(id);
+	DiskFile* stream = archive.open(id);
 
 	CE_ASSERT(stream != NULL, "Resource does not exist: %.8X%.8X", id.name, id.type);
 

+ 10 - 10
src/core/streams/BinaryReader.cpp → src/core/filesystem/BinaryReader.cpp

@@ -24,13 +24,13 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "BinaryReader.h"
-#include "Stream.h"
+#include "File.h"
 
 namespace crown
 {
 
 //-----------------------------------------------------------------------------
-BinaryReader::BinaryReader(Stream& stream) : m_stream(stream)
+BinaryReader::BinaryReader(File& file) : m_file(file)
 {
 }
 
@@ -38,7 +38,7 @@ BinaryReader::BinaryReader(Stream& stream) : m_stream(stream)
 int8_t BinaryReader::read_byte()
 {
 	int8_t buffer;
-	m_stream.read(&buffer, sizeof(int8_t));
+	m_file.read(&buffer, sizeof(int8_t));
 	return buffer;
 }
 
@@ -46,7 +46,7 @@ int8_t BinaryReader::read_byte()
 int16_t BinaryReader::read_int16()
 {
 	int16_t buffer;
-	m_stream.read(&buffer, sizeof(int16_t));
+	m_file.read(&buffer, sizeof(int16_t));
 	return buffer;
 }
 
@@ -54,7 +54,7 @@ int16_t BinaryReader::read_int16()
 uint16_t BinaryReader::read_uint16()
 {
 	uint16_t buffer;
-	m_stream.read(&buffer, sizeof(uint16_t));
+	m_file.read(&buffer, sizeof(uint16_t));
 	return buffer;
 }
 
@@ -62,7 +62,7 @@ uint16_t BinaryReader::read_uint16()
 int32_t BinaryReader::read_int32()
 {
 	int32_t buffer;
-	m_stream.read(&buffer, sizeof(int32_t));
+	m_file.read(&buffer, sizeof(int32_t));
 	return buffer;
 }
 
@@ -70,7 +70,7 @@ int32_t BinaryReader::read_int32()
 uint32_t BinaryReader::read_uint32()
 {
 	uint32_t buffer;
-	m_stream.read(&buffer, sizeof(uint32_t));
+	m_file.read(&buffer, sizeof(uint32_t));
 	return buffer;
 }
 
@@ -78,7 +78,7 @@ uint32_t BinaryReader::read_uint32()
 int64_t BinaryReader::read_int64()
 {
 	int64_t buffer;
-	m_stream.read(&buffer, sizeof(int64_t));
+	m_file.read(&buffer, sizeof(int64_t));
 	return buffer;
 }
 
@@ -86,7 +86,7 @@ int64_t BinaryReader::read_int64()
 double BinaryReader::read_double()
 {
 	double buffer;
-	m_stream.read(&buffer, sizeof(double));
+	m_file.read(&buffer, sizeof(double));
 	return buffer;
 }
 
@@ -94,7 +94,7 @@ double BinaryReader::read_double()
 float BinaryReader::read_float()
 {
 	float buffer;
-	m_stream.read(&buffer, sizeof(float));
+	m_file.read(&buffer, sizeof(float));
 	return buffer;
 }
 

+ 4 - 4
src/core/streams/BinaryReader.h → src/core/filesystem/BinaryReader.h

@@ -28,14 +28,14 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-class Stream;
+class File;
 
-/// A reader that offers a convenient way to read from a Stream
+/// A reader that offers a convenient way to read from a File
 class BinaryReader
 {
 public:
 
-						BinaryReader(Stream& s);
+						BinaryReader(File& file);
 
 	int8_t				read_byte();
 	int16_t				read_int16();
@@ -48,7 +48,7 @@ public:
 
 private:
 
-	Stream&				m_stream;
+	File&				m_file;
 };
 
 } // namespace crown

+ 10 - 10
src/core/streams/BinaryWriter.cpp → src/core/filesystem/BinaryWriter.cpp

@@ -24,62 +24,62 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "BinaryWriter.h"
-#include "Stream.h"
+#include "File.h"
 
 namespace crown
 {
 
 //-----------------------------------------------------------------------------
-BinaryWriter::BinaryWriter(Stream& stream) : m_stream(stream)
+BinaryWriter::BinaryWriter(File& file) : m_file(file)
 {
 }
 
 //-----------------------------------------------------------------------------
 void BinaryWriter::write_byte(int8_t buffer)
 {
-	m_stream.write(&buffer, sizeof(int8_t));
+	m_file.write(&buffer, sizeof(int8_t));
 }
 
 //-----------------------------------------------------------------------------
 void BinaryWriter::write_int16(int16_t buffer)
 {
-	m_stream.write(&buffer, sizeof(int16_t));
+	m_file.write(&buffer, sizeof(int16_t));
 }
 
 //-----------------------------------------------------------------------------
 void BinaryWriter::write_uint16(uint16_t buffer)
 {
-	m_stream.write(&buffer, sizeof(uint16_t));
+	m_file.write(&buffer, sizeof(uint16_t));
 }
 
 //-----------------------------------------------------------------------------
 void BinaryWriter::write_int32(int32_t buffer)
 {
-	m_stream.write(&buffer, sizeof(int32_t));
+	m_file.write(&buffer, sizeof(int32_t));
 }
 
 //-----------------------------------------------------------------------------
 void BinaryWriter::write_uint32(uint32_t buffer)
 {
-	m_stream.write(&buffer, sizeof(uint32_t));
+	m_file.write(&buffer, sizeof(uint32_t));
 }
 
 //-----------------------------------------------------------------------------
 void BinaryWriter::write_int64(int64_t buffer)
 {
-	m_stream.write(&buffer, sizeof(int64_t));
+	m_file.write(&buffer, sizeof(int64_t));
 }
 
 //-----------------------------------------------------------------------------
 void BinaryWriter::write_double(double buffer)
 {
-	m_stream.write(&buffer, sizeof(double));
+	m_file.write(&buffer, sizeof(double));
 }
 
 //-----------------------------------------------------------------------------
 void BinaryWriter::write_float(float buffer)
 {
-	m_stream.write(&buffer, sizeof(float));
+	m_file.write(&buffer, sizeof(float));
 }
 
 } // namespace crown

+ 4 - 4
src/core/streams/BinaryWriter.h → src/core/filesystem/BinaryWriter.h

@@ -28,14 +28,14 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-class Stream;
+class File;
 
-/// A writer that offers a convenient way to write to a Stream
+/// A writer that offers a convenient way to write to a File
 class BinaryWriter
 {
 public:
 
-						BinaryWriter(Stream& s);
+						BinaryWriter(File& file);
 
 	void				write_byte(int8_t);
 	void				write_int16(int16_t);
@@ -48,7 +48,7 @@ public:
 
 private:
 
-	Stream&				m_stream;
+	File&				m_file;
 };
 
 } // namespace crown

+ 20 - 20
src/core/streams/FileStream.cpp → src/core/filesystem/DiskFile.cpp

@@ -23,7 +23,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include "FileStream.h"
+#include "DiskFile.h"
 #include "Types.h"
 #include "Log.h"
 #include "MathUtils.h"
@@ -32,21 +32,21 @@ namespace crown
 {
 
 //-----------------------------------------------------------------------------
-FileStream::FileStream(StreamOpenMode mode, const char* filename) :
-	Stream(mode),
+DiskFile::DiskFile(FileOpenMode mode, const char* filename) :
+	File(mode),
 	m_file(filename, mode),
 	m_last_was_read(true)
 {
 }
 
 //-----------------------------------------------------------------------------
-FileStream::~FileStream()
+DiskFile::~DiskFile()
 {
 	//m_file.close();
 }
 
 //-----------------------------------------------------------------------------
-void FileStream::seek(size_t position)
+void DiskFile::seek(size_t position)
 {
 	check_valid();
 
@@ -54,7 +54,7 @@ void FileStream::seek(size_t position)
 }
 
 //-----------------------------------------------------------------------------
-void FileStream::seek_to_end()
+void DiskFile::seek_to_end()
 {
 	check_valid();
 
@@ -62,7 +62,7 @@ void FileStream::seek_to_end()
 }
 
 //-----------------------------------------------------------------------------
-void FileStream::skip(size_t bytes)
+void DiskFile::skip(size_t bytes)
 {
 	check_valid();
 
@@ -70,7 +70,7 @@ void FileStream::skip(size_t bytes)
 }
 
 //-----------------------------------------------------------------------------
-void FileStream::read(void* buffer, size_t size)
+void DiskFile::read(void* buffer, size_t size)
 {
 	check_valid();
 
@@ -85,7 +85,7 @@ void FileStream::read(void* buffer, size_t size)
 }
 
 //-----------------------------------------------------------------------------
-void FileStream::write(const void* buffer, size_t size)
+void DiskFile::write(const void* buffer, size_t size)
 {
 	check_valid();
 
@@ -100,7 +100,7 @@ void FileStream::write(const void* buffer, size_t size)
 }
 
 //-----------------------------------------------------------------------------
-bool FileStream::copy_to(Stream& stream, size_t size)
+bool DiskFile::copy_to(File& file, size_t size)
 {
 	check_valid();
 
@@ -123,7 +123,7 @@ bool FileStream::copy_to(Stream& stream, size_t size)
 			{
 				if (read_bytes != 0)
 				{
-					stream.write(buff, read_bytes);
+					file.write(buff, read_bytes);
 				}
 			}
 
@@ -132,7 +132,7 @@ bool FileStream::copy_to(Stream& stream, size_t size)
 			return false;
 		}
 
-		stream.write(buff, read_bytes);
+		file.write(buff, read_bytes);
 		tot_read_bytes += read_bytes;
 	}
 
@@ -141,19 +141,19 @@ bool FileStream::copy_to(Stream& stream, size_t size)
 }
 
 //-----------------------------------------------------------------------------
-bool FileStream::end_of_stream() const
+bool DiskFile::end_of_file() const
 {
 	return position() == size();
 }
 
 //-----------------------------------------------------------------------------
-bool FileStream::is_valid() const
+bool DiskFile::is_valid() const
 {
 	return m_file.is_open();
 }
 
 //-----------------------------------------------------------------------------
-void FileStream::flush()
+void DiskFile::flush()
 {
 	check_valid();
 	
@@ -161,7 +161,7 @@ void FileStream::flush()
 }
 
 //-----------------------------------------------------------------------------
-size_t FileStream::position() const
+size_t DiskFile::position() const
 {
 	check_valid();
 
@@ -169,7 +169,7 @@ size_t FileStream::position() const
 }
 
 //-----------------------------------------------------------------------------
-size_t FileStream::size() const
+size_t DiskFile::size() const
 {
 	check_valid();
 	
@@ -177,7 +177,7 @@ size_t FileStream::size() const
 }
 
 //-----------------------------------------------------------------------------
-bool FileStream::can_read() const
+bool DiskFile::can_read() const
 {
 	check_valid();
 
@@ -185,7 +185,7 @@ bool FileStream::can_read() const
 }
 
 //-----------------------------------------------------------------------------
-bool FileStream::can_write() const
+bool DiskFile::can_write() const
 {
 	check_valid();
 
@@ -193,7 +193,7 @@ bool FileStream::can_write() const
 }
 
 //-----------------------------------------------------------------------------
-bool FileStream::can_seek() const
+bool DiskFile::can_seek() const
 {
 	return true;
 }

+ 21 - 24
src/core/streams/FileStream.h → src/core/filesystem/DiskFile.h

@@ -26,69 +26,66 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Assert.h"
-
-#include "Stream.h"
+#include "OsFile.h"
 #include "File.h"
 
 namespace crown
 {
 
-
-/// File stream.
 /// Provides common facilities to access files on disk.
-class FileStream: public Stream
+class DiskFile: public File
 {
 public:
 
 	/// Opens @filename with specified @mode
-					FileStream(StreamOpenMode mode, const char* filename);
-	virtual			~FileStream();
+					DiskFile(FileOpenMode mode, const char* filename);
+	virtual			~DiskFile();
 
-	/// @copydoc Stream::seek() 
+	/// @copydoc File::seek() 
 	void			seek(size_t position);
 
-	/// @copydoc Stream::seek_to_end() 
+	/// @copydoc File::seek_to_end() 
 	void			seek_to_end();
 
-	/// @copydoc Stream::skip() 
+	/// @copydoc File::skip() 
 	void			skip(size_t bytes);
 
-	/// @copydoc Stream::read() 
+	/// @copydoc File::read() 
 	void			read(void* buffer, size_t size);
 
-	/// @copydoc Stream::write() 
+	/// @copydoc File::write() 
 	void			write(const void* buffer, size_t size);
 
-	/// @copydoc Stream::copy_to() 
-	bool			copy_to(Stream& stream, size_t size = 0);
+	/// @copydoc File::copy_to() 
+	bool			copy_to(File& file, size_t size = 0);
 
-	/// @copydoc Stream::flush() 
+	/// @copydoc File::flush() 
 	void			flush();
 
-	/// @copydoc Stream::end_of_stream() 
-	bool			end_of_stream() const;
+	/// @copydoc File::end_of_file() 
+	bool			end_of_file() const;
 
-	/// @copydoc Stream::is_valid() 
+	/// @copydoc File::is_valid() 
 	bool			is_valid() const;
 
-	/// @copydoc Stream::size() 
+	/// @copydoc File::size() 
 	size_t			size() const;
 
-	/// @copydoc Stream::position() 
+	/// @copydoc File::position() 
 	size_t			position() const;
 
-	/// @copydoc Stream::can_read() 
+	/// @copydoc File::can_read() 
 	bool			can_read() const;
 
-	/// @copydoc Stream::can_write() 
+	/// @copydoc File::can_write() 
 	bool			can_write() const;
 
-	/// @copydoc Stream::can_seek() 
+	/// @copydoc File::can_seek() 
 	bool			can_seek() const;
 
 protected:
 
-	File			m_file;
+	OsFile			m_file;
 	bool			m_last_was_read;
 
 protected:

+ 9 - 9
src/core/streams/Stream.cpp → src/core/filesystem/File.cpp

@@ -23,7 +23,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include "Stream.h"
+#include "File.h"
 #include "Types.h"
 #include "Compressor.h"
 #include "MallocAllocator.h"
@@ -32,7 +32,7 @@ namespace crown
 {
 
 //-----------------------------------------------------------------------------
-bool Stream::compress_to(Stream& stream, size_t size, size_t& zipped_size, Compressor& compressor)
+bool File::compress_to(File& file, size_t size, size_t& zipped_size, Compressor& compressor)
 {
 	MallocAllocator allocator;
 	void* in_buffer = (void*)allocator.allocate(size);
@@ -41,24 +41,24 @@ bool Stream::compress_to(Stream& stream, size_t size, size_t& zipped_size, Compr
 
 	void* compressed_buffer = compressor.compress(in_buffer, size, zipped_size);
 
-	stream.write(compressed_buffer, zipped_size);
+	file.write(compressed_buffer, zipped_size);
 
 	return true;
 }
 
 //-----------------------------------------------------------------------------
-bool Stream::uncompress_to(Stream& stream, size_t& unzipped_size, Compressor& compressor)
+bool File::uncompress_to(File& file, size_t& unzipped_size, Compressor& compressor)
 {
 	MallocAllocator allocator;
 
-	size_t stream_size = size();
-	void* in_buffer = (void*)allocator.allocate(stream_size);
+	size_t file_size = size();
+	void* in_buffer = (void*)allocator.allocate(file_size);
 
-	read(in_buffer, stream_size);
+	read(in_buffer, file_size);
 
-	void* uncompressed_buffer = compressor.uncompress(in_buffer, stream_size, unzipped_size);
+	void* uncompressed_buffer = compressor.uncompress(in_buffer, file_size, unzipped_size);
 
-	stream.write(uncompressed_buffer, unzipped_size);
+	file.write(uncompressed_buffer, unzipped_size);
 
 	return true;
 }

+ 34 - 34
src/core/streams/Stream.h → src/core/filesystem/File.h

@@ -30,90 +30,90 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-enum StreamOpenMode
+enum FileOpenMode
 {
-	SOM_READ		= 1,
-	SOM_WRITE		= 2
+	FOM_READ		= 1,
+	FOM_WRITE		= 2
 };
 
 class Compressor;
 
-/// An abstraction to access data streams.
+/// An abstraction to access data files.
 /// 
 /// It represents a flow of data attached to a 'file' which can be an archived file,
 /// a regular file, a location in memory or anything that can be read or wrote.
-/// A Stream is an abstraction to interact with these in an uniform way; every stream
+/// A File is an abstraction to interact with these in an uniform way; every file
 /// comes with a convenient set of methods to facilitate reading from it, writing to
 /// it and so on.
-class Stream
+class File
 {
 public:
 
-	/// Opens the stream with the given @mode
-						Stream(StreamOpenMode mode) : m_open_mode(mode) {}
-	virtual				~Stream() {};
+	/// Opens the file with the given @mode
+						File(FileOpenMode mode) : m_open_mode(mode) {}
+	virtual				~File() {};
 
-	/// Sets the position indicator of the stream to position.
+	/// Sets the position indicator of the file to position.
 	virtual void		seek(size_t position) = 0;
 
-	/// Sets the position indicator to the end of the stream
+	/// Sets the position indicator to the end of the file
 	virtual void		seek_to_end() = 0;
 
 	/// Sets the position indicator to bytes after current position
 	virtual void		skip(size_t bytes) = 0;
 
-	/// Reads a block of data from the stream.
+	/// Reads a block of data from the file.
 	virtual void		read(void* buffer, size_t size) = 0;
 
-	/// Writes a block of data to the stream.
+	/// Writes a block of data to the file.
 	virtual void		write(const void* buffer, size_t size) = 0;
 
-	/// Copies a chunk of 'size' bytes of data from this to another stream.
-	virtual bool		copy_to(Stream& stream, size_t size = 0) = 0;
+	/// Copies a chunk of 'size' bytes of data from this to another file.
+	virtual bool		copy_to(File& file, size_t size = 0) = 0;
 
-	/// Zips a chunk of 'size' bytes of data from this to another stream using compressor.
-	virtual bool		compress_to(Stream& stream, size_t size, size_t& compressed_size, Compressor& compressor);
+	/// Zips a chunk of 'size' bytes of data from this to another file using compressor.
+	virtual bool		compress_to(File& file, size_t size, size_t& compressed_size, Compressor& compressor);
 
-	/// Unzip a zipped stream of data from this to another stream using compressor.
-	virtual bool		uncompress_to(Stream& stream, size_t& uncompressed_size, Compressor& compressor);
+	/// Unzip a zipped file of data from this to another file using compressor.
+	virtual bool		uncompress_to(File& file, size_t& uncompressed_size, Compressor& compressor);
 
 	/// Forces the previouses write operations to complete.
-	/// Generally, when a Stream is attached to a file,
+	/// Generally, when a File is attached to a file,
 	/// write operations are not performed instantly, the output data
 	/// may be stored to a temporary buffer before making its way to
 	/// the file. This method forces all the pending output operations
-	/// to be written to the stream.
+	/// to be written to the file.
 	virtual void		flush() = 0;
 
-	/// Returns whether the stream is valid.
-	/// A stream is valid when the buffer where it operates
-	/// exists. (i.e. a file descriptor is attached to the stream, 
-	/// a memory area is attached to the stream etc.)
+	/// Returns whether the file is valid.
+	/// A file is valid when the buffer where it operates
+	/// exists. (i.e. a file descriptor is attached to the file, 
+	/// a memory area is attached to the file etc.)
 	virtual bool		is_valid() const = 0;
 
-	/// Returns whether the position is at end of stream.
-	virtual bool		end_of_stream() const = 0;
+	/// Returns whether the position is at end of file.
+	virtual bool		end_of_file() const = 0;
 
-	/// Returns the size of stream in bytes.
+	/// Returns the size of file in bytes.
 	virtual size_t		size() const = 0;
 
-	/// Returns the current position in stream.
+	/// Returns the current position in file.
 	/// Generally, for binary data, it means the number of bytes
-	/// from the beginning of the stream.
+	/// from the beginning of the file.
 	virtual size_t		position() const = 0;
 
-	/// Returns whether the stream can be read.
+	/// Returns whether the file can be read.
 	virtual bool		can_read() const = 0;
 
-	/// Returns whether the stream can be wrote.
+	/// Returns whether the file can be wrote.
 	virtual bool		can_write() const = 0;
 
-	/// Returns whether the stream can be sought.
+	/// Returns whether the file can be sought.
 	virtual bool		can_seek() const = 0;
 
 protected:
 
-	StreamOpenMode		m_open_mode;
+	FileOpenMode		m_open_mode;
 };
 
 } // namespace crown

+ 4 - 4
src/Filesystem.cpp → src/core/filesystem/Filesystem.cpp

@@ -26,7 +26,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Filesystem.h"
 #include "Log.h"
 #include "OS.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 
 namespace crown
 {
@@ -184,18 +184,18 @@ const char* Filesystem::os_path(const char* relative_path)
 }
 
 //-----------------------------------------------------------------------------
-FileStream* Filesystem::open(const char* relative_path, StreamOpenMode mode)
+DiskFile* Filesystem::open(const char* relative_path, FileOpenMode mode)
 {
 	FilesystemEntry info;
 
 	CE_ASSERT(get_info(relative_path, info), "File does not exist: %s", relative_path);
 	CE_ASSERT(info.type == FilesystemEntry::FILE, "File is not a regular file: %s", relative_path);
 
-	return new FileStream(mode, info.os_path);
+	return new DiskFile(mode, info.os_path);
 }
 
 //-----------------------------------------------------------------------------
-void Filesystem::close(FileStream* stream)
+void Filesystem::close(DiskFile* stream)
 {
 	delete stream;
 }

+ 4 - 4
src/Filesystem.h → src/core/filesystem/Filesystem.h

@@ -27,7 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "String.h"
 #include "OS.h"
-#include "Stream.h"
+#include "File.h"
 
 namespace crown
 {
@@ -49,7 +49,7 @@ struct FilesystemEntry
 	char			relative_path[MAX_PATH_LENGTH];		///< Relative path of the entry
 };
 
-class FileStream;
+class DiskFile;
 
 /// Provides a platform-independent way to access files and directories
 /// on the host filesystem.
@@ -139,10 +139,10 @@ public:
 	const char*			os_path(const char* relative_path);
 
 	/// Opens the file @relative_path with the specified access @mode
-	FileStream*			open(const char* relative_path, StreamOpenMode mode);
+	DiskFile*			open(const char* relative_path, FileOpenMode mode);
 
 	/// Closes a previously opened file @stream
-	void				close(FileStream* stream);
+	void				close(DiskFile* stream);
 
 private:
 

+ 20 - 18
src/core/streams/MemoryStream.cpp → src/core/filesystem/MemoryFile.cpp

@@ -24,7 +24,8 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include <stdlib.h>
-#include "MemoryStream.h"
+
+#include "MemoryFile.h"
 #include "MathUtils.h"
 #include "Log.h"
 #include "Types.h"
@@ -100,33 +101,34 @@ void DynamicMemoryBuffer::allocate(size_t capacity)
 {
 	// FIXME
 }
+
 //-----------------------------------------------------------------------------
-MemoryStream::MemoryStream(MemoryBuffer* buffer, StreamOpenMode mode) :
-	Stream(mode),
+MemoryFile::MemoryFile(MemoryBuffer* buffer, FileOpenMode mode) :
+	File(mode),
 	m_memory(buffer),
 	m_memory_offset(0)
 {
 }
 
 //-----------------------------------------------------------------------------
-MemoryStream::~MemoryStream()
+MemoryFile::~MemoryFile()
 {
 }
 
 //-----------------------------------------------------------------------------
-void MemoryStream::seek(size_t position)
+void MemoryFile::seek(size_t position)
 {
 	check_valid();
 	
 	m_memory_offset = position;
 
-	// Allow seek to m_memory->size() position, that means end of stream,
+	// Allow seek to m_memory->size() position, that means end of file,
 	// reading not allowed but you can write if it's dynamic
-	CE_ASSERT(m_memory_offset <= m_memory->size(), "Trying to seek beyond end of stream");
+	CE_ASSERT(m_memory_offset <= m_memory->size(), "Trying to seek beyond end of file");
 }
 
 //-----------------------------------------------------------------------------
-void MemoryStream::seek_to_end()
+void MemoryFile::seek_to_end()
 {
 	check_valid();
 
@@ -134,18 +136,18 @@ void MemoryStream::seek_to_end()
 }
 
 //-----------------------------------------------------------------------------
-void MemoryStream::skip(size_t bytes)
+void MemoryFile::skip(size_t bytes)
 {
 	check_valid();
 
 	m_memory_offset += bytes;
 
-	//Allow seek to m_memory->getSize() position, that means end of stream, reading not allowed but you can write if it's dynamic
-	CE_ASSERT(m_memory_offset <= m_memory->size(), "Trying to skip beyond end of stream");
+	//Allow seek to m_memory->getSize() position, that means end of file, reading not allowed but you can write if it's dynamic
+	CE_ASSERT(m_memory_offset <= m_memory->size(), "Trying to skip beyond end of file");
 }
 
 //-----------------------------------------------------------------------------
-void MemoryStream::read(void* buffer, size_t size)
+void MemoryFile::read(void* buffer, size_t size)
 {
 	check_valid();
 	uint8_t* src = m_memory->data();
@@ -153,7 +155,7 @@ void MemoryStream::read(void* buffer, size_t size)
 
 	if (m_memory_offset + size > m_memory->size())
 	{
-		Log::e("Trying to read beyond the end of stream.");
+		Log::e("Trying to read beyond the end of file.");
 	}
 
 	for (size_t i = 0; i < size; i++)
@@ -165,17 +167,17 @@ void MemoryStream::read(void* buffer, size_t size)
 }
 
 //-----------------------------------------------------------------------------
-bool MemoryStream::copy_to(Stream& stream, size_t size)
+bool MemoryFile::copy_to(File& file, size_t size)
 {
 	check_valid();
 
-	stream.write(&(m_memory->data()[m_memory_offset]), math::min(m_memory->size()-m_memory_offset, size));
+	file.write(&(m_memory->data()[m_memory_offset]), math::min(m_memory->size()-m_memory_offset, size));
 
 	return true;
 }
 
 //-----------------------------------------------------------------------------
-void MemoryStream::write(const void* buffer, size_t size)
+void MemoryFile::write(const void* buffer, size_t size)
 {
 	check_valid();
 	m_memory->write((uint8_t*)buffer, m_memory_offset, size);
@@ -183,13 +185,13 @@ void MemoryStream::write(const void* buffer, size_t size)
 }
 
 //-----------------------------------------------------------------------------
-void MemoryStream::flush()
+void MemoryFile::flush()
 {
 	return;
 }
 
 //-----------------------------------------------------------------------------
-void MemoryStream::dump()
+void MemoryFile::dump()
 {
 	uint8_t* buff = m_memory->data();
 

+ 23 - 23
src/core/streams/MemoryStream.h → src/core/filesystem/MemoryFile.h

@@ -26,7 +26,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Types.h"
-#include "Stream.h"
+#include "File.h"
 #include "Allocator.h"
 #include "Assert.h"
 
@@ -78,58 +78,58 @@ protected:
 	size_t				m_size;
 };
 
-/// Memory stream.
+/// Memory file.
 /// Access memory buffers.
-class MemoryStream: public Stream
+class MemoryFile: public File
 {
 public:
 
-	/// @copydoc Stream::Stream()
-						MemoryStream(MemoryBuffer* buffer, StreamOpenMode mode);
+	/// @copydoc File::File()
+						MemoryFile(MemoryBuffer* buffer, FileOpenMode mode);
 
-	/// @copydoc Stream::~Stream()
-	virtual				~MemoryStream();
+	/// @copydoc File::~File()
+	virtual				~MemoryFile();
 
-	/// @copydoc Stream::seek()
+	/// @copydoc File::seek()
 	void				seek(size_t position);
 
-	/// @copydoc Stream::seek_to_end()
+	/// @copydoc File::seek_to_end()
 	void				seek_to_end();
 
-	/// @copydoc Stream::skip()
+	/// @copydoc File::skip()
 	void				skip(size_t bytes);
 
-	/// @copydoc Stream::read()
+	/// @copydoc File::read()
 	void				read(void* buffer, size_t size);
 
-	/// @copydoc Stream::write()
+	/// @copydoc File::write()
 	void				write(const void* buffer, size_t size);
 
-	/// @copydoc Stream::copy_to()
-	bool				copy_to(Stream& stream, size_t size = 0);
+	/// @copydoc File::copy_to()
+	bool				copy_to(File& file, size_t size = 0);
 
-	/// @copydoc Stream::flush()
+	/// @copydoc File::flush()
 	void				flush();
 
-	/// @copydoc Stream::end_of_stream()
-	bool				end_of_stream() const { return size() == m_memory_offset; }
+	/// @copydoc File::end_of_file()
+	bool				end_of_file() const { return size() == m_memory_offset; }
 
-	/// @copydoc Stream::is_valid()
+	/// @copydoc File::is_valid()
 	bool				is_valid() const { CE_ASSERT(m_memory != NULL, "Memory is NULL"); return m_memory->is_valid(); }
 
-	/// @copydoc Stream::size()
+	/// @copydoc File::size()
 	size_t				size() const { CE_ASSERT(m_memory != NULL, "Memory is NULL"); return m_memory->size(); }
 
-	/// @copydoc Stream::position()
+	/// @copydoc File::position()
 	size_t				position() const { return m_memory_offset; }
 
-	/// @copydoc Stream::can_read()
+	/// @copydoc File::can_read()
 	bool				can_read() const { return true; }
 
-	/// @copydoc Stream::can_write()
+	/// @copydoc File::can_write()
 	bool				can_write() const { return true; }
 
-	/// @copydoc Stream::can_seek()
+	/// @copydoc File::can_seek()
 	bool				can_seek() const { return true; }
 
 	/// Dumps the data to the console.

+ 24 - 24
src/core/streams/NullStream.h → src/core/filesystem/NullFile.h

@@ -25,34 +25,34 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "Stream.h"
+#include "File.h"
 
 namespace crown
 {
 
 
-/// Bit bucket stream.
+/// Bit bucket file.
 /// Discards all data written to it and provides null data reading from it; plain and simple.
-class NullStream: public Stream
+class NullFile: public File
 {
 public:
 
-	/// @copydoc Stream::Stream()
-				NullStream(StreamOpenMode mode) : Stream(mode) {}
+	/// @copydoc File::File()
+				NullFile(FileOpenMode mode) : File(mode) {}
 
-	/// @copydoc Stream::~Stream()
-	virtual		~NullStream() {}
+	/// @copydoc File::~File()
+	virtual		~NullFile() {}
 
-	/// @copydoc Stream::seek()
+	/// @copydoc File::seek()
 	void		seek(size_t position) { (void)position; }
 
-	/// @copydoc Stream::seek_to_end()
+	/// @copydoc File::seek_to_end()
 	void		seek_to_end() {}
 
-	/// @copydoc Stream::skip()
+	/// @copydoc File::skip()
 	void		skip(size_t bytes) { (void)bytes; }
 				
-	/// @copydoc Stream::read()
+	/// @copydoc File::read()
 	/// @note
 	///	Fills buffer with zeroes
 	void		read(void* buffer, size_t size)
@@ -63,53 +63,53 @@ public:
 		}
 	}
 
-	/// @copydoc Stream::write()
+	/// @copydoc File::write()
 	void		write(const void* buffer, size_t size) { (void)buffer; (void)size; }
 
-	/// @copydoc Stream::copy_to()
+	/// @copydoc File::copy_to()
 	/// @note
 	///	Returns always true
-	bool		copy_to(Stream& stream, size_t size = 0)
+	bool		copy_to(File& file, size_t size = 0)
 	{
 		char zero = 0;
-		stream.write(&zero, size);		
+		file.write(&zero, size);		
 		return true;
 	}
 
-	/// @copydoc Stream::flush()
+	/// @copydoc File::flush()
 	void		flush() {};
 				
-	/// @copydoc Stream::is_valid()
+	/// @copydoc File::is_valid()
 	/// @note
 	///	Returns always true
 	bool		is_valid() { return true; }
 				
-	/// @copydoc Stream::end_of_stream()
+	/// @copydoc File::end_of_file()
 	/// @note
 	///	Returns always false
-	bool		end_of_stream() { return false; }
+	bool		end_of_file() { return false; }
 				
-	/// @copydoc Stream::size()
+	/// @copydoc File::size()
 	/// @note
 	///	Returns always 0xFFFFFFFF
 	size_t		size() { return ~0; }
 				
-	/// @copydoc Stream::position()
+	/// @copydoc File::position()
 	/// @note
 	///	Returns always zero
 	size_t		position() { return 0; }
 				
-	/// @copydoc Stream::can_read()
+	/// @copydoc File::can_read()
 	/// @note
 	///	Returns always true
 	bool		can_read() { return true; }
 				
-	/// @copydoc Stream::can_write()
+	/// @copydoc File::can_write()
 	/// @note
 	///	Returns always true
 	bool		can_write() { return true; }
 				
-	/// @copydoc Stream::can_seek()
+	/// @copydoc File::can_seek()
 	/// @note
 	///	Returns always true
 	bool		can_seek() { return true; }

+ 4 - 4
src/core/streams/TextReader.cpp → src/core/filesystem/TextReader.cpp

@@ -24,14 +24,14 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "TextReader.h"
-#include "Stream.h"
+#include "File.h"
 #include "Types.h"
 
 namespace crown
 {
 
 //-----------------------------------------------------------------------------
-TextReader::TextReader(Stream& stream) : m_stream(stream)
+TextReader::TextReader(File& file) : m_file(file)
 {
 }
 
@@ -41,9 +41,9 @@ size_t TextReader::read_string(char* string, size_t size)
 	char current_char;
 	size_t bytes_read = 0;
 
-	while(!m_stream.end_of_stream() && bytes_read < size - 1)
+	while(!m_file.end_of_file() && bytes_read < size - 1)
 	{
-		m_stream.read(&current_char, 1);
+		m_file.read(&current_char, 1);
 		string[bytes_read] = current_char;
 
 		bytes_read++;

+ 6 - 6
src/core/streams/TextReader.h → src/core/filesystem/TextReader.h

@@ -28,18 +28,18 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-class Stream;
+class File;
 
-/// A reader that offers a convenient way to read text from a Stream
+/// A reader that offers a convenient way to read text from a File
 class TextReader
 {
 public:
 
-						TextReader(Stream& s);
+						TextReader(File& file);
 
-	/// Reads characters from stream and stores them as a C string
+	/// Reads characters from file and stores them as a C string
 	/// into string until (size-1) characters have been read or
-	/// either a newline or the End-of-Stream is reached, whichever
+	/// either a newline or the End-of-File is reached, whichever
 	/// comes first.
 	/// A newline character makes fgets stop reading, but it is considered
 	/// a valid character and therefore it is included in the string copied to string.
@@ -49,7 +49,7 @@ public:
 
 private:
 
-	Stream&				m_stream;
+	File&				m_file;
 };
 
 } // namespace crown

+ 3 - 3
src/core/streams/TextWriter.cpp → src/core/filesystem/TextWriter.cpp

@@ -24,21 +24,21 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "TextWriter.h"
-#include "Stream.h"
+#include "File.h"
 #include "String.h"
 
 namespace crown
 {
 
 //-----------------------------------------------------------------------------
-TextWriter::TextWriter(Stream& stream) : m_stream(stream)
+TextWriter::TextWriter(File& file) : m_file(file)
 {
 }
 
 //-----------------------------------------------------------------------------
 void TextWriter::write_string(const char* string)
 {
-	m_stream.write(string, string::strlen(string));
+	m_file.write(string, string::strlen(string));
 }
 
 } // namespace crown

+ 6 - 6
src/core/streams/TextWriter.h → src/core/filesystem/TextWriter.h

@@ -26,24 +26,24 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-class Stream;
+class File;
 
-/// A reader that offers a convenient way to write text to a Stream
+/// A reader that offers a convenient way to write text to a File
 class TextWriter
 {
 public:
 
-						TextWriter(Stream& s);
+						TextWriter(File& file);
 	
-	/// Writes the string pointed by string to the stream.
+	/// Writes the string pointed by string to the file.
 	/// The function begins copying from the address specified (string)
 	/// until it reaches the terminating null character ('\0').
-	/// The final null character is not copied to the stream.
+	/// The final null character is not copied to the file.
 	void				write_string(const char* string);
 
 private:
 
-	Stream&				m_stream;
+	File&				m_file;
 };
 
 } // namespace crown

+ 14 - 16
src/os/android/File.cpp → src/os/android/OsFile.cpp

@@ -24,17 +24,15 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "Assert.h"
-#include <stdio.h>
-
 #include "OS.h"
-#include "File.h"
+#include "OsFile.h"
 #include "AndroidOS.h"
 
 namespace crown
 {
 
 //-----------------------------------------------------------------------------
-File::File(const char* path, StreamOpenMode mode) :
+OsFile::OsFile(const char* path, FileOpenMode mode) :
 	m_asset(NULL),
 {
 	// Android assets are always read-only
@@ -46,13 +44,13 @@ File::File(const char* path, StreamOpenMode mode) :
 }
 
 //-----------------------------------------------------------------------------
-File::~File()
+OsFile::~OsFile()
 {
 	close();
 }
 
 //-----------------------------------------------------------------------------
-void File::close()
+void OsFile::close()
 {
 	if (m_asset != NULL)
 	{
@@ -62,25 +60,25 @@ void File::close()
 }
 
 //-----------------------------------------------------------------------------
-bool File::is_open() const
+bool OsFile::is_open() const
 {
 	return m_asset != NULL;
 }
 
 //-----------------------------------------------------------------------------
-StreamOpenMode File::mode() const
+FileOpenMode OsFile::mode() const
 {
 	return m_mode;
 }
 
 //-----------------------------------------------------------------------------
-size_t File::size() const
+size_t OsFile::size() const
 {
 	return AAsset_getLength(m_asset);
 }
 
 //-----------------------------------------------------------------------------
-size_t File::read(void* data, size_t size)
+size_t OsFile::read(void* data, size_t size)
 {
 	CE_ASSERT(data != NULL, "Data must be != NULL");
 
@@ -88,7 +86,7 @@ size_t File::read(void* data, size_t size)
 }
 
 //-----------------------------------------------------------------------------
-size_t File::write(const void* data, size_t size)
+size_t OsFile::write(const void* data, size_t size)
 {
 	CE_ASSERT(data != NULL, "Data must be != NULL");
 
@@ -98,34 +96,34 @@ size_t File::write(const void* data, size_t size)
 }
 
 //-----------------------------------------------------------------------------
-void File::seek(size_t position)
+void OsFile::seek(size_t position)
 {
 	off_t seek_result = AAsset_seek(m_asset, (off_t)position, SEEK_SET);
 	CE_ASSERT(seek_result != (off_t) -1, "Failed to seek");
 }
 
 //-----------------------------------------------------------------------------
-void File::seek_to_end()
+void OsFile::seek_to_end()
 {
 	off_t seek_result = AAsset_seek(m_asset, 0, SEEK_END);
 	CE_ASSERT(seek_result != (off_t) -1, "Failed to seek");
 }
 
 //-----------------------------------------------------------------------------
-void File::skip(size_t bytes)
+void OsFile::skip(size_t bytes)
 {
 	off_t seek_result = AAsset_seek(m_asset, (off_t) bytes, SEEK_CUR);
 	CE_ASSERT(seek_result != (off_t) -1, "Failed to seek");
 }
 
 //-----------------------------------------------------------------------------
-size_t File::position() const
+size_t OsFile::position() const
 {
 	return (size_t) (AAsset_getLength(m_asset) - AAsset_getRemainingLength(m_asset));
 }
 
 //-----------------------------------------------------------------------------
-bool File::eof() const
+bool OsFile::eof() const
 {
 	return AAsset_getRemainingLength(m_asset) == 0;
 }

+ 6 - 6
src/os/android/File.h → src/os/android/OsFile.h

@@ -29,19 +29,19 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include <android/asset_manager.h>
 
 #include "Types.h"
-#include "Stream.h"
+#include "File.h"
 
 namespace crown
 {
 
 /// Android assets wrapper
-class File
+class OsFile
 {
 public:
 
 	/// Opens the file located at @path with the given @mode.
-							File(const char* path, StreamOpenMode mode);
-							~File();
+							OsFile(const char* path, FileOpenMode mode);
+							~OsFile();
 
 	/// Closes the file.
 	void					close();
@@ -52,7 +52,7 @@ public:
 	size_t					size() const;
 
 	/// Returs the mode used to open the file.
-	StreamOpenMode			mode() const;
+	FileOpenMode			mode() const;
 
 	/// Reads @size bytes from the file and stores it into @data.
 	/// Returns the number of bytes read.
@@ -82,7 +82,7 @@ public:
 private:
 
 	AAsset*					m_asset;
-	StreamOpenMode			m_mode;
+	FileOpenMode			m_mode;
 };
 
 } // namespace crown

+ 1 - 1
src/os/linux/File.h → src/os/linux/OsFile.h

@@ -25,4 +25,4 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "../posix/File.h"
+#include "../posix/OsFile.h"

+ 16 - 16
src/os/posix/File.cpp → src/os/posix/OsFile.cpp

@@ -23,33 +23,33 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include "Assert.h"
 #include <stdio.h>
 
+#include "Assert.h"
 #include "OS.h"
-#include "File.h"
+#include "OsFile.h"
 
 namespace crown
 {
 
 //-----------------------------------------------------------------------------
-File::File(const char* path, StreamOpenMode mode) :
+OsFile::OsFile(const char* path, FileOpenMode mode) :
 	m_file_handle(NULL)
 {
-	m_file_handle = fopen(path, (mode == SOM_READ) ? "rb" : "wb");
+	m_file_handle = fopen(path, (mode == FOM_READ) ? "rb" : "wb");
 	CE_ASSERT(m_file_handle != NULL, "Unable to open file: %s", path);
 
 	m_mode = mode;
 }
 
 //-----------------------------------------------------------------------------
-File::~File()
+OsFile::~OsFile()
 {
 	close();
 }
 
 //-----------------------------------------------------------------------------
-void File::close()
+void OsFile::close()
 {
 	if (m_file_handle != NULL)
 	{
@@ -59,19 +59,19 @@ void File::close()
 }
 
 //-----------------------------------------------------------------------------
-bool File::is_open() const
+bool OsFile::is_open() const
 {
 	return m_file_handle != NULL;
 }
 
 //-----------------------------------------------------------------------------
-StreamOpenMode File::mode()
+FileOpenMode OsFile::mode()
 {
 	return m_mode;
 }
 
 //-----------------------------------------------------------------------------
-size_t File::size() const
+size_t OsFile::size() const
 {
 	size_t pos = position();
 
@@ -87,7 +87,7 @@ size_t File::size() const
 }
 
 //-----------------------------------------------------------------------------
-size_t File::read(void* data, size_t size)
+size_t OsFile::read(void* data, size_t size)
 {
 	CE_ASSERT(data != NULL, "Data must be != NULL");
 
@@ -95,7 +95,7 @@ size_t File::read(void* data, size_t size)
 }
 
 //-----------------------------------------------------------------------------
-size_t File::write(const void* data, size_t size)
+size_t OsFile::write(const void* data, size_t size)
 {
 	CE_ASSERT(data != NULL, "Data must be != NULL");
 
@@ -103,34 +103,34 @@ size_t File::write(const void* data, size_t size)
 }
 
 //-----------------------------------------------------------------------------
-void File::seek(size_t position)
+void OsFile::seek(size_t position)
 {
 	int fseek_result = fseek(m_file_handle, (long) position, SEEK_SET);
 	CE_ASSERT(fseek_result == 0, "Failed to seek");
 }
 
 //-----------------------------------------------------------------------------
-void File::seek_to_end()
+void OsFile::seek_to_end()
 {
 	int fseek_result = fseek(m_file_handle, 0, SEEK_END);
 	CE_ASSERT(fseek_result == 0, "Failed to seek");
 }
 
 //-----------------------------------------------------------------------------
-void File::skip(size_t bytes)
+void OsFile::skip(size_t bytes)
 {
 	int fseek_result = fseek(m_file_handle, bytes, SEEK_CUR);
 	CE_ASSERT(fseek_result == 0, "Failed to seek");
 }
 
 //-----------------------------------------------------------------------------
-size_t File::position() const
+size_t OsFile::position() const
 {
 	return (size_t) ftell(m_file_handle);
 }
 
 //-----------------------------------------------------------------------------
-bool File::eof() const
+bool OsFile::eof() const
 {
 	return feof(m_file_handle) != 0;
 }

+ 6 - 6
src/os/posix/File.h → src/os/posix/OsFile.h

@@ -28,19 +28,19 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include <cstdio>
 
 #include "Types.h"
-#include "Stream.h"
+#include "File.h"
 
 namespace crown
 {
 
 /// Standard C file wrapper
-class File
+class OsFile
 {
 public:
 
 	/// Opens the file located at @path with the given @mode.
-							File(const char* path, StreamOpenMode mode);
-							~File();
+							OsFile(const char* path, FileOpenMode mode);
+							~OsFile();
 
 	/// Closes the file.
 	void					close();
@@ -51,7 +51,7 @@ public:
 	size_t					size() const;
 
 	/// Returs the mode used to open the file.
-	StreamOpenMode			mode();
+	FileOpenMode			mode();
 
 	/// Reads @size bytes from the file and stores it into @data.
 	/// Returns the number of bytes read.
@@ -81,7 +81,7 @@ public:
 private:
 
 	FILE*					m_file_handle;
-	StreamOpenMode			m_mode;
+	FileOpenMode			m_mode;
 };
 
 } // namespace crown

+ 0 - 3
src/renderers/gl/glx/GLContext.h

@@ -30,8 +30,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include <X11/Xlib.h>
 #include <GL/glx.h>
 
-#include "Config.h"
-
 namespace crown
 {
 
@@ -40,7 +38,6 @@ void set_x11_display_and_window(Display* dpy, Window win);
 class GLContext
 {
 public:
-
 					GLContext();
 
 	void			create_context();

+ 8 - 8
tools/compilers/Compiler.cpp

@@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Compiler.h"
 #include "Hash.h"
 #include "Path.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 #include "Log.h"
 
 namespace crown
@@ -77,13 +77,13 @@ size_t Compiler::compile(const char* resource, uint32_t name, uint32_t type)
 	}
 
 	// Read source file
-	FileStream* input_file = m_root_fs.open(resource, SOM_READ);
+	DiskFile* input_file = m_root_fs.open(resource, FOM_READ);
 
 	size_t header_size = read_header(input_file);
 	size_t resource_size = read_resource(input_file);
 
 	// Write compiled file
-	FileStream* output_file;
+	DiskFile* output_file;
 
 	if (m_dest_fs.exists(output_name))
 	{
@@ -91,7 +91,7 @@ size_t Compiler::compile(const char* resource, uint32_t name, uint32_t type)
 	}
 
 	m_dest_fs.create_file(output_name);
-	output_file = m_dest_fs.open(output_name, SOM_WRITE);
+	output_file = m_dest_fs.open(output_name, FOM_WRITE);
 
 	write_header(output_file, name, type, resource_size);
 	write_resource(output_file);
@@ -104,19 +104,19 @@ size_t Compiler::compile(const char* resource, uint32_t name, uint32_t type)
 }
 
 //-----------------------------------------------------------------------------
-size_t Compiler::read_header(FileStream* in_file)
+size_t Compiler::read_header(DiskFile* in_file)
 {
 	return read_header_impl(in_file);
 }
 
 //-----------------------------------------------------------------------------
-size_t Compiler::read_resource(FileStream* in_file)
+size_t Compiler::read_resource(DiskFile* in_file)
 {
 	return read_resource_impl(in_file);
 }
 
 //-----------------------------------------------------------------------------
-void Compiler::write_header(FileStream* out_file, uint32_t name, uint32_t type, uint32_t resource_size)
+void Compiler::write_header(DiskFile* out_file, uint32_t name, uint32_t type, uint32_t resource_size)
 {
 	CompiledHeader header;
 	header.magic = COMPILED_HEADER_MAGIC_NUMBER;
@@ -131,7 +131,7 @@ void Compiler::write_header(FileStream* out_file, uint32_t name, uint32_t type,
 }
 
 //-----------------------------------------------------------------------------
-void Compiler::write_resource(FileStream* out_file)
+void Compiler::write_resource(DiskFile* out_file)
 {
 	write_resource_impl(out_file);
 }

+ 9 - 9
tools/compilers/Compiler.h

@@ -50,7 +50,7 @@ struct CompiledHeader
 	uint32_t	size;		// Size of the resource data _not_ including header (in bytes)
 };
 
-class FileStream;
+class DiskFile;
 
 /// Resource compiler interface.
 /// Every specific resource compiler must inherith from this
@@ -64,11 +64,11 @@ public:
 
 	size_t					compile(const char* resource, uint32_t name, uint32_t type);
 
-	size_t					read_header(FileStream* in_file);
-	size_t					read_resource(FileStream* in_file);
+	size_t					read_header(DiskFile* in_file);
+	size_t					read_resource(DiskFile* in_file);
 
-	void					write_header(FileStream* out_file, uint32_t name, uint32_t type, uint32_t resource_size);
-	void					write_resource(FileStream* out_file);
+	void					write_header(DiskFile* out_file, uint32_t name, uint32_t type, uint32_t resource_size);
+	void					write_resource(DiskFile* out_file);
 
 	void					cleanup();
 
@@ -78,11 +78,11 @@ public:
 
 protected:
 
-	virtual size_t			read_header_impl(FileStream* in_file) = 0;
-	virtual size_t			read_resource_impl(FileStream* in_file) = 0;
+	virtual size_t			read_header_impl(DiskFile* in_file) = 0;
+	virtual size_t			read_resource_impl(DiskFile* in_file) = 0;
 
-	virtual void			write_header_impl(FileStream* out_file) = 0;
-	virtual void			write_resource_impl(FileStream* out_file) = 0;
+	virtual void			write_header_impl(DiskFile* out_file) = 0;
+	virtual void			write_resource_impl(DiskFile* out_file) = 0;
 
 	virtual void			cleanup_impl() = 0;
 

+ 5 - 5
tools/compilers/ps/PSCompiler.cpp

@@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "PSCompiler.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 #include "Resource.h"
 
 namespace crown
@@ -45,14 +45,14 @@ PSCompiler::~PSCompiler()
 }
 
 //-----------------------------------------------------------------------------
-size_t PSCompiler::read_header_impl(FileStream* in_file)
+size_t PSCompiler::read_header_impl(DiskFile* in_file)
 {
 	(void) in_file;
 	return 0;
 }
 
 //-----------------------------------------------------------------------------
-size_t PSCompiler::read_resource_impl(FileStream* in_file)
+size_t PSCompiler::read_resource_impl(DiskFile* in_file)
 {
 	m_file_size = in_file->size();
 
@@ -66,13 +66,13 @@ size_t PSCompiler::read_resource_impl(FileStream* in_file)
 }
 
 //-----------------------------------------------------------------------------
-void PSCompiler::write_header_impl(FileStream* out_file)
+void PSCompiler::write_header_impl(DiskFile* out_file)
 {
 	out_file->write(&m_file_size, sizeof(uint32_t));
 }
 
 //-----------------------------------------------------------------------------
-void PSCompiler::write_resource_impl(FileStream* out_file)
+void PSCompiler::write_resource_impl(DiskFile* out_file)
 {
 	out_file->write(m_file_data, m_file_size);
 }

+ 4 - 4
tools/compilers/ps/PSCompiler.h

@@ -37,11 +37,11 @@ public:
 					PSCompiler(const char* root_path, const char* dest_path);
 					~PSCompiler();
 
-	size_t			read_header_impl(FileStream* in_file);
-	size_t			read_resource_impl(FileStream* in_file);
+	size_t			read_header_impl(DiskFile* in_file);
+	size_t			read_resource_impl(DiskFile* in_file);
 
-	void			write_header_impl(FileStream* out_file);
-	void			write_resource_impl(FileStream* out_file);
+	void			write_header_impl(DiskFile* out_file);
+	void			write_resource_impl(DiskFile* out_file);
 
 	void			cleanup_impl();
 

+ 4 - 4
tools/compilers/resource-linker.cpp

@@ -1,12 +1,12 @@
 #include <stdio.h>
 #include "Filesystem.h"
-#include "Stream.h"
+#include "File.h"
 #include "Path.h"
 #include "String.h"
 #include "Hash.h"
 #include "Resource.h"
 #include "ResourceArchive.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 #include <cstring>
 
 using namespace crown;
@@ -45,7 +45,7 @@ int main(int argc, char** argv)
 	}
 
 	// Open the archive file for both reading and writing
-	FileStream* archive = (FileStream*)fs_root.open("archive.bin", (StreamOpenMode)(SOM_READ | SOM_WRITE));
+	DiskFile* archive = (DiskFile*)fs_root.open("archive.bin", (FileOpenMode)(FOM_READ | FOM_WRITE));
 	
 	// The archive header used throughout the code
 	ArchiveHeader header;
@@ -88,7 +88,7 @@ int main(int argc, char** argv)
 	//-------------------------------------------------------------------------
 
 	// Open the resource
-	FileStream* resource = (FileStream*)fs_root.open(resource_name, SOM_READ);
+	DiskFile* resource = (DiskFile*)fs_root.open(resource_name, FOM_READ);
 	
 	// If the resource is malformed, abort
 	if (resource->size() < sizeof(ArchiveEntry))

+ 7 - 7
tools/compilers/tga/TGACompiler.cpp

@@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "TGACompiler.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 #include "PixelFormat.h"
 #include "Resource.h"
 #include "Log.h"
@@ -50,7 +50,7 @@ TGACompiler::~TGACompiler()
 }
 
 //-----------------------------------------------------------------------------
-size_t TGACompiler::read_header_impl(FileStream* in_file)
+size_t TGACompiler::read_header_impl(DiskFile* in_file)
 {
 	// Read the header
 	in_file->read(&m_tga_header, sizeof(TGAHeader));
@@ -62,7 +62,7 @@ size_t TGACompiler::read_header_impl(FileStream* in_file)
 }
 
 //-----------------------------------------------------------------------------
-size_t TGACompiler::read_resource_impl(FileStream* in_file)
+size_t TGACompiler::read_resource_impl(DiskFile* in_file)
 {
 	// Compute color channels	
 	m_image_channels = m_tga_header.pixel_depth / 8;
@@ -128,7 +128,7 @@ size_t TGACompiler::read_resource_impl(FileStream* in_file)
 }
 
 //-----------------------------------------------------------------------------
-void TGACompiler::write_header_impl(FileStream* out_file)
+void TGACompiler::write_header_impl(DiskFile* out_file)
 {
 	// Write the texture header
 	out_file->write(&m_image_format, sizeof(PixelFormat));
@@ -137,7 +137,7 @@ void TGACompiler::write_header_impl(FileStream* out_file)
 }
 
 //-----------------------------------------------------------------------------
-void TGACompiler::write_resource_impl(FileStream* out_file)
+void TGACompiler::write_resource_impl(DiskFile* out_file)
 {
 	// Write out the data
 	out_file->write(m_image_data, m_image_size * m_image_channels);
@@ -154,7 +154,7 @@ void TGACompiler::cleanup_impl()
 }
 
 //-----------------------------------------------------------------------------
-void TGACompiler::load_uncompressed(FileStream* in_file)
+void TGACompiler::load_uncompressed(DiskFile* in_file)
 {
 	uint64_t size = m_tga_header.width * m_tga_header.height;
 
@@ -184,7 +184,7 @@ void TGACompiler::load_uncompressed(FileStream* in_file)
 }
 
 //-----------------------------------------------------------------------------
-void TGACompiler::load_compressed(FileStream* in_file)
+void TGACompiler::load_compressed(DiskFile* in_file)
 {
 	uint8_t rle_id = 0;
 	uint32_t i = 0;

+ 7 - 7
tools/compilers/tga/TGACompiler.h

@@ -26,7 +26,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Compiler.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 #include "PixelFormat.h"
 
 namespace crown
@@ -54,18 +54,18 @@ public:
 					TGACompiler(const char* root_path, const char* dest_path);
 					~TGACompiler();
 
-	size_t			read_header_impl(FileStream* in_file);
-	size_t			read_resource_impl(FileStream* in_file);
+	size_t			read_header_impl(DiskFile* in_file);
+	size_t			read_resource_impl(DiskFile* in_file);
 
-	void			write_header_impl(FileStream* out_file);
-	void			write_resource_impl(FileStream* out_file);
+	void			write_header_impl(DiskFile* out_file);
+	void			write_resource_impl(DiskFile* out_file);
 
 	void			cleanup_impl();
 
 private:
 
-	void			load_uncompressed(FileStream* in_file);
-	void			load_compressed(FileStream* in_file);
+	void			load_uncompressed(DiskFile* in_file);
+	void			load_compressed(DiskFile* in_file);
 	void			swap_red_blue();
 
 private:

+ 5 - 5
tools/compilers/txt/TXTCompiler.cpp

@@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "TXTCompiler.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 #include "Resource.h"
 
 namespace crown
@@ -45,14 +45,14 @@ TXTCompiler::~TXTCompiler()
 }
 
 //-----------------------------------------------------------------------------
-size_t TXTCompiler::read_header_impl(FileStream* in_file)
+size_t TXTCompiler::read_header_impl(DiskFile* in_file)
 {
 	(void) in_file;
 	return 0;
 }
 
 //-----------------------------------------------------------------------------
-size_t TXTCompiler::read_resource_impl(FileStream* in_file)
+size_t TXTCompiler::read_resource_impl(DiskFile* in_file)
 {
 	m_file_size = in_file->size();
 
@@ -66,13 +66,13 @@ size_t TXTCompiler::read_resource_impl(FileStream* in_file)
 }
 
 //-----------------------------------------------------------------------------
-void TXTCompiler::write_header_impl(FileStream* out_file)
+void TXTCompiler::write_header_impl(DiskFile* out_file)
 {
 	out_file->write(&m_file_size, sizeof(uint32_t));
 }
 
 //-----------------------------------------------------------------------------
-void TXTCompiler::write_resource_impl(FileStream* out_file)
+void TXTCompiler::write_resource_impl(DiskFile* out_file)
 {
 	out_file->write(m_file_data, m_file_size);
 }

+ 5 - 5
tools/compilers/txt/TXTCompiler.h

@@ -26,7 +26,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Compiler.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 
 namespace crown
 {
@@ -38,11 +38,11 @@ public:
 					TXTCompiler(const char* root_path, const char* dest_path);
 					~TXTCompiler();
 
-	size_t			read_header_impl(FileStream* in_file);
-	size_t			read_resource_impl(FileStream* in_file);
+	size_t			read_header_impl(DiskFile* in_file);
+	size_t			read_resource_impl(DiskFile* in_file);
 
-	void			write_header_impl(FileStream* out_file);
-	void			write_resource_impl(FileStream* out_file);
+	void			write_header_impl(DiskFile* out_file);
+	void			write_resource_impl(DiskFile* out_file);
 
 	void			cleanup_impl();
 

+ 5 - 5
tools/compilers/vs/VSCompiler.cpp

@@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "VSCompiler.h"
-#include "FileStream.h"
+#include "DiskFile.h"
 #include "Resource.h"
 
 namespace crown
@@ -45,14 +45,14 @@ VSCompiler::~VSCompiler()
 }
 
 //-----------------------------------------------------------------------------
-size_t VSCompiler::read_header_impl(FileStream* in_file)
+size_t VSCompiler::read_header_impl(DiskFile* in_file)
 {
 	(void) in_file;
 	return 0;
 }
 
 //-----------------------------------------------------------------------------
-size_t VSCompiler::read_resource_impl(FileStream* in_file)
+size_t VSCompiler::read_resource_impl(DiskFile* in_file)
 {
 	m_file_size = in_file->size();
 
@@ -66,13 +66,13 @@ size_t VSCompiler::read_resource_impl(FileStream* in_file)
 }
 
 //-----------------------------------------------------------------------------
-void VSCompiler::write_header_impl(FileStream* out_file)
+void VSCompiler::write_header_impl(DiskFile* out_file)
 {
 	out_file->write(&m_file_size, sizeof(uint32_t));
 }
 
 //-----------------------------------------------------------------------------
-void VSCompiler::write_resource_impl(FileStream* out_file)
+void VSCompiler::write_resource_impl(DiskFile* out_file)
 {
 	out_file->write(m_file_data, m_file_size);
 }

+ 4 - 4
tools/compilers/vs/VSCompiler.h

@@ -37,11 +37,11 @@ public:
 					VSCompiler(const char* root_path, const char* dest_path);
 					~VSCompiler();
 
-	size_t			read_header_impl(FileStream* in_file);
-	size_t			read_resource_impl(FileStream* in_file);
+	size_t			read_header_impl(DiskFile* in_file);
+	size_t			read_resource_impl(DiskFile* in_file);
 
-	void			write_header_impl(FileStream* out_file);
-	void			write_resource_impl(FileStream* out_file);
+	void			write_header_impl(DiskFile* out_file);
+	void			write_resource_impl(DiskFile* out_file);
 
 	void			cleanup_impl();