diff options
author | Eugene Sandulenko | 2018-05-04 11:50:51 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-05-05 23:17:35 +0200 |
commit | c95cbdc2c913d4234554e3643051e1ca1e124d33 (patch) | |
tree | c2fea4402246b0ee6ddc5a446402c6b0b5329714 /engines | |
parent | 7352737a696e8b9889dce408482f8860cf92d287 (diff) | |
download | scummvm-rg350-c95cbdc2c913d4234554e3643051e1ca1e124d33.tar.gz scummvm-rg350-c95cbdc2c913d4234554e3643051e1ca1e124d33.tar.bz2 scummvm-rg350-c95cbdc2c913d4234554e3643051e1ca1e124d33.zip |
JANITORIAL: Fix formatting
Diffstat (limited to 'engines')
-rw-r--r-- | engines/prince/resource.h | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/engines/prince/resource.h b/engines/prince/resource.h index 6c823a7702..a2cd8a6262 100644 --- a/engines/prince/resource.h +++ b/engines/prince/resource.h @@ -32,66 +32,66 @@ namespace Prince { namespace Resource { - template <typename T> - bool loadFromStream(T &resource, Common::SeekableReadStream &stream) { - return resource.loadStream(stream); - } - - template<typename T> - bool loadResource(T *resource, const char *resourceName, bool required) { - Common::ScopedPtr<Common::SeekableReadStream> stream(SearchMan.createReadStreamForMember(resourceName)); - if (!stream) { - if (required) - error("Can't load %s", resourceName); - return false; - } +template <typename T> +bool loadFromStream(T &resource, Common::SeekableReadStream &stream) { + return resource.loadStream(stream); +} - return loadFromStream(*resource, *stream); +template<typename T> +bool loadResource(T *resource, const char *resourceName, bool required) { + Common::ScopedPtr<Common::SeekableReadStream> stream(SearchMan.createReadStreamForMember(resourceName)); + if (!stream) { + if (required) + error("Can't load %s", resourceName); + return false; } - template <typename T> - bool loadResource(Common::Array<T> &array, Common::SeekableReadStream &stream, bool required = true) { - T t; - while (t.loadFromStream(stream)) - array.push_back(t); + return loadFromStream(*resource, *stream); +} - return true; - } +template <typename T> +bool loadResource(Common::Array<T> &array, Common::SeekableReadStream &stream, bool required = true) { + T t; + while (t.loadFromStream(stream)) + array.push_back(t); + return true; +} - template <typename T> - bool loadResource(Common::Array<T> &array, const char *resourceName, bool required = true) { - Common::ScopedPtr<Common::SeekableReadStream> stream(SearchMan.createReadStreamForMember(resourceName)); - if (!stream) { - if (required) - error("Can't load %s", resourceName); - return false; - } - return loadResource(array, *stream, required); +template <typename T> +bool loadResource(Common::Array<T> &array, const char *resourceName, bool required = true) { + Common::ScopedPtr<Common::SeekableReadStream> stream(SearchMan.createReadStreamForMember(resourceName)); + if (!stream) { + if (required) + error("Can't load %s", resourceName); + return false; } - template <typename T> - bool loadResource(Common::Array<T *> &array, const char *resourceName, bool required = true) { + return loadResource(array, *stream, required); +} - Common::ScopedPtr<Common::SeekableReadStream> stream(SearchMan.createReadStreamForMember(resourceName)); - if (!stream) { - if (required) - error("Can't load %s", resourceName); - return false; - } +template <typename T> +bool loadResource(Common::Array<T *> &array, const char *resourceName, bool required = true) { - // FIXME: This is stupid. Maybe loadFromStream should be helper method that returns initialized object - while (true) { - T* t = new T(); - if (!t->loadFromStream(*stream)) { - delete t; - break; - } - array.push_back(t); + Common::ScopedPtr<Common::SeekableReadStream> stream(SearchMan.createReadStreamForMember(resourceName)); + if (!stream) { + if (required) + error("Can't load %s", resourceName); + return false; + } + + // FIXME: This is stupid. Maybe loadFromStream should be helper method that returns initialized object + while (true) { + T* t = new T(); + if (!t->loadFromStream(*stream)) { + delete t; + break; } - return true; + array.push_back(t); } + return true; +} } |