CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Log.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "Report.hpp"
11
15
17
19 class Log {
20 public:
21 virtual ~Log() = default;
22
24 virtual void submitReport(const Report& report) = 0;
25
27 inline void setIndent(const String& indent) { mIndentHandler.setIndent(indent); }
28
31
34
35 protected:
36 Log() = default;
37
39 [[nodiscard]] inline const String& fullIndent() const { return mIndentHandler.getFullIndent(); }
40
41 private:
43 };
44
46 class StdLog : public Log {
47 public:
49 ~StdLog() override;
50
52 void submitReport(const Report& report) override;
53
55 void printAll(bool verbose = true);
56
57 private:
58 // PImple idiom
59 struct OpaqueData;
60 OpaqueData* mData = nullptr;
61 };
62
63} // namespace CeresEngine::ShaderCompiler
Indentation handler base class.
Definition CodeWriter.hpp:23
void decrementIndent()
Decrements the indentation.
void incrementIndent()
Increments the indentation.
void setIndent(const String &indent)
Sets the next indentation string. By default two spaces.
const String & getFullIndent() const
Returns the current full indentation string.
Log base class.
Definition Log.hpp:19
IndentHandler mIndentHandler
Definition Log.hpp:42
void incIndent()
Increments the indentation.
Definition Log.hpp:30
void setIndent(const String &indent)
Sets the next indentation string. By default two spaces.
Definition Log.hpp:27
virtual void submitReport(const Report &report)=0
Submits the specified report.
void decIndent()
Decrements the indentation.
Definition Log.hpp:33
const String & fullIndent() const
Returns the current full indentation string.
Definition Log.hpp:39
Report exception class which contains a completely constructed message with optional line marker,...
Definition Report.hpp:31
Standard output log (uses std::cout to submit a report).
Definition Log.hpp:46
void submitReport(const Report &report) override
Implements the base class interface.
void printAll(bool verbose=true)
Prints all submitted reports to the standard output.
OpaqueData * mData
Definition Log.hpp:60
Definition AST.hpp:33
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25