From b99e38badb82c5cc79771a77c5f6ea180c67ee4f Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sat, 5 Oct 2024 14:24:39 +0200 Subject: move Asset from crepe::api to crepe --- src/crepe/Asset.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/crepe/Asset.h (limited to 'src/crepe/Asset.h') diff --git a/src/crepe/Asset.h b/src/crepe/Asset.h new file mode 100644 index 0000000..736ba44 --- /dev/null +++ b/src/crepe/Asset.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include + +namespace crepe { + +class Asset { +public: + Asset(const std::string & src); + +public: + //! Get an input stream to the contents of this resource + const std::istream & read(); + //! Get the canonical path to this resource + const char * canonical(); + +private: + std::string src; + std::ifstream file; +}; + +} // namespace crepe -- cgit v1.2.3 From c40332b990b025d2bd7b94e41184d7f0547da203 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sat, 5 Oct 2024 14:33:43 +0200 Subject: add doxygen comments to Asset class --- src/crepe/Asset.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/crepe/Asset.h') diff --git a/src/crepe/Asset.h b/src/crepe/Asset.h index 736ba44..0cb5834 100644 --- a/src/crepe/Asset.h +++ b/src/crepe/Asset.h @@ -6,8 +6,17 @@ namespace crepe { +/** + * \brief Asset location helper + * + * This class is used to locate and canonicalize paths to game asset files, and + * should *always* be used when retrieving files from disk. + */ class Asset { public: + /** + * \param src Unique identifier to asset + */ Asset(const std::string & src); public: -- cgit v1.2.3