Cogs.Core
Preprocessor.h
1#pragma once
2#include "Strings.h"
3
4#include "Foundation/StringView.h"
5
6#include <string>
7#include <functional>
8#include <unordered_set>
9#include <unordered_map>
10
11template<>
12struct std::hash<Cogs::Core::StringRef>
13{
14 std::hash<uint32_t> hasher;
15 size_t operator()(const Cogs::Core::StringRef& ref) const
16 {
17 return hasher(ref.value);
18 }
19};
20
21namespace Cogs::Core
22{
23 class Context;
24
25
41 struct COGSCORE_DLL_API PartialPreprocessor
42 {
48 std::string processed;
49
51 std::unordered_set<StringRef> identifiersSeen;
52
54 std::unordered_map<StringRef, StringRef> definitions;
55
63 [[nodiscard]] bool process(Context* context, const StringView input);
64 };
65}
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
Partial C preprocessor.
Definition: Preprocessor.h:42
std::unordered_map< StringRef, StringRef > definitions
Set of preprocessor defines encountered in active text.
Definition: Preprocessor.h:54
std::unordered_set< StringRef > identifiersSeen
Set of identifiers encountered in active text.
Definition: Preprocessor.h:51
std::string processed
Resulting processed text.
Definition: Preprocessor.h:48