mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Filesystem handling is now more flexible
- removed CResourceLoader class in favor of one that implements resource loader interface - removed global pool of files, in favour of more dynamic approach - renamed some files to match current situation All these changes are needed mostly for future mod manager + .zip support
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
* CInputStream.h, part of VCMI engine
|
||||
@@ -9,8 +10,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Abstract class which provides method definitions for reading from a stream.
|
||||
*/
|
||||
@@ -62,7 +61,17 @@ public:
|
||||
virtual si64 getSize() = 0;
|
||||
|
||||
/**
|
||||
* Closes the stream and releases any system resources associated with the stream explicitely.
|
||||
* @brief for convenience, reads whole stream at once
|
||||
*
|
||||
* @return pair, first = raw data, second = size of data
|
||||
*/
|
||||
//virtual void close() = 0;
|
||||
std::pair<std::unique_ptr<ui8[]>, size_t> readAll()
|
||||
{
|
||||
std::unique_ptr<ui8[]> data(new ui8[getSize()]);
|
||||
|
||||
size_t readSize = read(data.get(), getSize());
|
||||
assert(readSize == getSize());
|
||||
|
||||
return std::make_pair(std::move(data), getSize());
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user