Cogs.Core
ExpressionComponent.h
1#pragma once
2
3#include "Components/Core/DynamicComponent.h"
4
5#include "Utilities/Expressions.h"
6
7namespace Cogs
8{
9 namespace Core
10 {
11 class Context;
12
14 {
15 Expression * expression = nullptr;
16
17 ComponentModel::ComponentHandle componentHandle;
21 };
22
24 {
25 public:
26 static void registerType();
27
28 ExpressionComponent() = default;
29
30 void initialize(Context * context);
31 void update();
32 void cleanup(Context * context);
33
34 std::vector<std::string> targets;
35 std::vector<std::string> expressions;
36
37 private:
38 Context * context = nullptr;
40 std::vector<CompiledExpression> compiledExpressions;
41 };
42 }
43}
44
45template<> inline Cogs::StringView getName<Cogs::Core::ExpressionComponent>() { return "ExpressionComponent"; }
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Base class for components implementing dynamic behavior.
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
uint16_t TypeId
Built in type used to uniquely identify a single type instance.
Definition: Name.h:48
uint16_t FieldId
Type used to index fields.
Definition: Name.h:54
constexpr FieldId NoField
No field id.
Definition: Name.h:60
constexpr TypeId NoType
Definition of no type.
Definition: Name.h:51
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
Handle to a Component instance.
Definition: Component.h:67
Provides a context for evaluation of expressions.
Definition: Expressions.h:54
Defines a string expression, to be parsed and evaluated by an expression context.
Definition: Expressions.h:35