libscratchcpp
A library for C++ based Scratch project players
Loading...
Searching...
No Matches
inputvalue.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
3#pragma once
4
5#include <memory>
6
7#include "spimpl.h"
8#include "value.h"
9
10namespace libscratchcpp
11{
12
13class CompilerValue;
14class Block;
15class Entity;
16class InputValuePrivate;
17
20{
21 public:
22 enum class Type
23 {
24 Number = 4,
28 Angle = 8,
29 Color = 9,
30 String = 10,
33 List = 13
34 };
35
36 InputValue(Type type = Type::Number);
37
38 CompilerValue *compile(Compiler *compiler);
39
40 Type type() const;
41 void setType(Type newType);
42
43 const Value &value() const;
44 void setValue(const Value &newValue);
45
46 Block *valueBlock() const;
47 void setValueBlock(Block *newValueBlock);
48
49 const std::string &valueBlockId() const;
50 void setValueBlockId(const std::string &newValueBlockId);
51
52 std::shared_ptr<Entity> valuePtr() const;
53 void setValuePtr(const std::shared_ptr<Entity> &newValuePtr);
54
55 const std::string &valueId() const;
56 void setValueId(const std::string &newValueId);
57
58 private:
59 spimpl::impl_ptr<InputValuePrivate> impl;
60};
61
62} // namespace libscratchcpp
The Block class represents a Scratch block.
Definition block.h:24
The CompilerValue class represents a local value in compiled code.
Definition compilervalue.h:14
The Compiler class provides API for compiling Scratch scripts.
Definition compiler.h:33
The Entity class is the base class of everything that is identified by an ID (Target,...
Definition entity.h:17
The InputValue class provides methods for the value of an Input.
Definition inputvalue.h:20
Type
Definition inputvalue.h:23
@ String
Definition inputvalue.h:30
@ Angle
Definition inputvalue.h:28
@ Variable
Definition inputvalue.h:32
@ List
Definition inputvalue.h:33
@ PositiveInteger
Definition inputvalue.h:26
@ Integer
Definition inputvalue.h:27
@ Number
Definition inputvalue.h:24
@ Broadcast
Definition inputvalue.h:31
@ Color
Definition inputvalue.h:29
@ PositiveNumber
Definition inputvalue.h:25
InputValue(Type type=Type::Number)
Definition inputvalue.cpp:21
The Value class represents a Scratch value.
Definition value.h:22
#define LIBSCRATCHCPP_EXPORT
Definition global.h:17
The main namespace of the library.
Definition asset.h:10