Cogs.Core
Source
Components
Behavior
ExpressionComponent.h
1
#pragma once
2
3
#include "Components/Core/DynamicComponent.h"
4
5
#include "Utilities/Expressions.h"
6
7
namespace
Cogs
8
{
9
namespace
Core
10
{
11
class
Context;
12
13
struct
CompiledExpression
14
{
15
Expression
* expression =
nullptr
;
16
17
ComponentModel::ComponentHandle
componentHandle;
18
Reflection::TypeId
componentId =
Reflection::NoType
;
19
Reflection::FieldId
fieldId =
Reflection::NoField
;
20
Reflection::TypeId
memberId =
Reflection::NoType
;
21
};
22
23
class
ExpressionComponent
:
public
DynamicComponent
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
;
39
ExpressionContext
ec;
40
std::vector<CompiledExpression> compiledExpressions;
41
};
42
}
43
}
44
45
template
<>
inline
Cogs::StringView
getName<Cogs::Core::ExpressionComponent>() {
return
"ExpressionComponent"
; }
Cogs::Core::Context
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition:
Context.h:83
Cogs::Core::DynamicComponent
Base class for components implementing dynamic behavior.
Definition:
DynamicComponent.h:31
Cogs::Core::ExpressionComponent
Definition:
ExpressionComponent.h:24
Cogs::StringView
Provides a weakly referenced view over the contents of a string.
Definition:
StringView.h:24
Cogs::Reflection::TypeId
uint16_t TypeId
Built in type used to uniquely identify a single type instance.
Definition:
Name.h:48
Cogs::Reflection::FieldId
uint16_t FieldId
Type used to index fields.
Definition:
Name.h:54
Cogs::Reflection::NoField
constexpr FieldId NoField
No field id.
Definition:
Name.h:60
Cogs::Reflection::NoType
constexpr TypeId NoType
Definition of no type.
Definition:
Name.h:51
Cogs
Contains all Cogs related functionality.
Definition:
FieldSetter.h:23
Cogs::ComponentModel::ComponentHandle
Handle to a Component instance.
Definition:
Component.h:67
Cogs::Core::CompiledExpression
Definition:
ExpressionComponent.h:14
Cogs::Core::ExpressionContext
Provides a context for evaluation of expressions.
Definition:
Expressions.h:54
Cogs::Core::Expression
Defines a string expression, to be parsed and evaluated by an expression context.
Definition:
Expressions.h:35
Generated by
1.9.6