Files
OpenRCT2-Web/src/openrct2/object/ObjectAsset.h
T
Aaron van Geffen a053a84486 Move all object units into OpenRCT2 namespace (#24980)
* Move all object units into OpenRCT2 namespace

* Dealing with fallout, part 1

* Dealing with fallout, part 2

* Dealing with fallout, part 3

* Apply clang-format in a few more places

* Remove redundant 'virtual' keyword
2025-08-17 06:46:03 -03:00

58 lines
1.5 KiB
C++

/*****************************************************************************
* Copyright (c) 2014-2025 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include <memory>
#include <string>
#include <vector>
namespace OpenRCT2
{
struct IStream;
class ObjectAsset
{
private:
std::string _zipPath;
std::string _path;
public:
ObjectAsset() = default;
ObjectAsset(std::string_view path)
: _path(path)
{
}
ObjectAsset(std::string_view zipPath, std::string_view path)
: _zipPath(zipPath)
, _path(path)
{
}
[[nodiscard]] bool IsAvailable() const;
[[nodiscard]] uint64_t GetSize() const;
[[nodiscard]] std::vector<uint8_t> GetData() const;
[[nodiscard]] std::unique_ptr<IStream> GetStream() const;
const std::string& GetZipPath() const;
const std::string& GetPath() const;
size_t GetHash() const;
friend bool operator==(const ObjectAsset& l, const ObjectAsset& r);
};
} // namespace OpenRCT2
template<>
struct std::hash<OpenRCT2::ObjectAsset>
{
std::size_t operator()(const OpenRCT2::ObjectAsset& asset) const noexcept
{
return asset.GetHash();
}
};