Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SdlResourceLocator.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <string>
6#include <string_view>
7
8namespace ph
9{
10
11class Path;
12class SdlIOContext;
14
17enum class ESriType
18{
19 Unknown = 0,
20 Bundle,
22};
23
25{
26public:
32 static bool isRecognized(std::string_view sdlValueStr);
33
34public:
35 explicit SdlResourceLocator(const SdlIOContext& ctx);
36
37 bool resolve(ResourceIdentifier& identifier) override;
38
39 Path toPath(std::string_view sri) const;
40 std::string toBundleSRI(std::string_view sri) const;
41 std::string toExternalSRI(std::string_view sri) const;
42
47
52
57 ESriType getType(std::string_view identifier) const;
58
59 // TODO: method to migrate external to bundle or vice versa
60
61private:
62 static auto determineType(std::string_view sri) -> ESriType;
63
64 const SdlIOContext& m_ctx;
65};
66
67}// end namespace ph
Definition IResourceIdentifierResolver.h:12
General path representation. Does not check whether the target actually exists (e....
Definition Path.h:21
An general identifier that points to some resource. This is the most general form of a resource ident...
Definition ResourceIdentifier.h:20
Data that SDL input/output process can rely on.
Definition SdlIOContext.h:17
Definition SdlResourceLocator.h:25
bool resolve(ResourceIdentifier &identifier) override
Resolve the identifier;.
Definition SdlResourceLocator.cpp:58
SdlResourceLocator(const SdlIOContext &ctx)
Definition SdlResourceLocator.cpp:53
std::string toExternalSRI(std::string_view sri) const
Definition SdlResourceLocator.cpp:131
static bool isRecognized(std::string_view sdlValueStr)
Check whether the string is a SDL resource identifier. Checks the format of the string only....
Definition SdlResourceLocator.cpp:48
std::string toBundleSRI(std::string_view sri) const
Definition SdlResourceLocator.cpp:93
ResourceIdentifier toBundleIdentifier(const Path &path) const
Get an identifier representing the path.
Definition SdlResourceLocator.cpp:153
Path toPath(std::string_view sri) const
Definition SdlResourceLocator.cpp:73
ResourceIdentifier toExternalIdentifier(const Path &path) const
Get an identifier representing the path.
Definition SdlResourceLocator.cpp:160
ESriType getType(std::string_view identifier) const
Tries to get type information from a potential SRI.
Definition SdlResourceLocator.cpp:167
The root for all renderer implementations.
Definition EEngineProject.h:6
ESriType
Type of the SDL Resource Identifier (SRI).
Definition SdlResourceLocator.h:18