Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SdlIOContext.h
Go to the documentation of this file.
1#pragma once
2
3#include "SDL/sdl_fwd.h"
4
5#include <Common/assertion.h>
6
7#include <string>
8
9namespace ph { class Path; }
10
11namespace ph
12{
13
17{
18public:
19 std::string genPrettySrcInfo() const;
20
26 const Path& getWorkingDirectory() const;
27
32 const SdlClass* getSrcClass() const;
33
34 const SdlStruct* getSrcStruct() const;
35
36 void setSrcClass(const SdlClass* srcClass);
37 void setSrcStruct(const SdlStruct* srcStruct);
38
39// Protected, to prevent certain polymorphic usage
40protected:
42
48 explicit SdlIOContext(
49 const Path* workingDirectory,
50 const SdlClass* srcClass = nullptr,
51 const SdlStruct* srcStruct = nullptr);
52
53 SdlIOContext(const SdlIOContext& other) = default;
54 SdlIOContext(SdlIOContext&& other) = default;
55 SdlIOContext& operator = (const SdlIOContext& rhs) = default;
57
58private:
59 const Path* m_workingDirectory;
60 const SdlClass* m_srcClass;
61 const SdlStruct* m_srcStruct;
62};
63
64// In-header Implementation:
65
67 : m_workingDirectory(nullptr)
68 , m_srcClass (nullptr)
69 , m_srcStruct (nullptr)
70{}
71
73 const Path* const workingDirectory,
74 const SdlClass* const srcClass,
75 const SdlStruct* const srcStruct)
76
77 : m_workingDirectory(workingDirectory)
78 , m_srcClass (srcClass)
79 , m_srcStruct (srcStruct)
80{
81 PH_ASSERT(workingDirectory);
82}
83
85{
86 PH_ASSERT(m_workingDirectory);
87 return *m_workingDirectory;
88}
89
91{
92 return m_srcClass;
93}
94
96{
97 return m_srcStruct;
98}
99
100inline void SdlIOContext::setSrcClass(const SdlClass* const srcClass)
101{
102 m_srcClass = srcClass;
103}
104
105inline void SdlIOContext::setSrcStruct(const SdlStruct* const srcStruct)
106{
107 m_srcStruct = srcStruct;
108}
109
110}// end namespace ph
General path representation. Does not check whether the target actually exists (e....
Definition Path.h:21
Definition SdlClass.h:25
Data that SDL input/output process can rely on.
Definition SdlIOContext.h:17
std::string genPrettySrcInfo() const
Definition SdlIOContext.cpp:8
void setSrcStruct(const SdlStruct *srcStruct)
Definition SdlIOContext.h:105
SdlIOContext & operator=(const SdlIOContext &rhs)=default
SdlIOContext()
Definition SdlIOContext.h:66
const SdlClass * getSrcClass() const
The SDL class that is involved in the I/O process.
Definition SdlIOContext.h:90
const Path & getWorkingDirectory() const
Get working directory of the current I/O session. Do not treat this as the classical definition of wo...
Definition SdlIOContext.h:84
SdlIOContext(const SdlIOContext &other)=default
SdlIOContext(SdlIOContext &&other)=default
void setSrcClass(const SdlClass *srcClass)
Definition SdlIOContext.h:100
const SdlStruct * getSrcStruct() const
Definition SdlIOContext.h:95
Definition SdlStruct.h:25
The root for all renderer implementations.
Definition EEngineProject.h:6