The Block class represents a Scratch block.
More...
#include <scratchcpp/block.h>
The Block class represents a Scratch block.
◆ Block() [1/2]
| Block::Block |
( |
const std::string & | id, |
|
|
const std::string & | opcode, |
|
|
bool | isMonitorBlock = false ) |
◆ Block() [2/2]
| libscratchcpp::Block::Block |
( |
const Block & | | ) |
|
|
delete |
◆ addField()
| int Block::addField |
( |
std::shared_ptr< Field > | field | ) |
|
Adds a field and returns its index.
◆ addInput()
| int Block::addInput |
( |
std::shared_ptr< Input > | input | ) |
|
Adds an input and returns its index.
◆ comment()
| std::shared_ptr< Comment > Block::comment |
( |
| ) |
const |
Returns the comment which is attached to this block.
◆ commentId()
| const std::string & Block::commentId |
( |
| ) |
const |
Returns the ID of the comment which is attached to this block.
◆ compile()
Calls the compile function.
◆ compileFunction()
◆ engine()
◆ fieldAt()
| std::shared_ptr< Field > Block::fieldAt |
( |
int | index | ) |
const |
Returns the field at index.
◆ fields()
| const std::vector< std::shared_ptr< Field > > & Block::fields |
( |
| ) |
const |
Returns the list of fields.
◆ findField()
| int Block::findField |
( |
const std::string & | fieldName | ) |
const |
Returns the index of the field with the given name.
◆ findInput()
| int Block::findInput |
( |
const std::string & | inputName | ) |
const |
Returns the index of the input with the given name.
◆ hatPredicateCompileFunction()
Returns the edge-activated hat predicate compile function.
- See also
- Block sections
◆ id()
| const std::string & Entity::id |
( |
| ) |
const |
|
inherited |
◆ inputAt()
| std::shared_ptr< Input > Block::inputAt |
( |
int | index | ) |
const |
Returns the input at index.
◆ inputs()
| const std::vector< std::shared_ptr< Input > > & Block::inputs |
( |
| ) |
const |
Returns the list of inputs.
◆ isMonitorBlock()
| bool Block::isMonitorBlock |
( |
| ) |
const |
Returns true if this block belongs to a monitor.
◆ isTopLevelReporter()
| bool Block::isTopLevelReporter |
( |
| ) |
const |
Returns true if this is a top level reporter block for a variable or a list.
◆ mutationHasNext()
| bool Block::mutationHasNext |
( |
| ) |
const |
Returns true if the block can have a block following it.
◆ mutationPrototype()
Returns the block prototype (in custom block definition).
◆ next()
| Block * Block::next |
( |
| ) |
const |
◆ nextId()
| const std::string & Block::nextId |
( |
| ) |
const |
Returns the ID of the next block.
◆ opcode()
| const std::string & Block::opcode |
( |
| ) |
const |
◆ parent()
| Block * Block::parent |
( |
| ) |
const |
Returns the parent block.
◆ parentId()
| const std::string & Block::parentId |
( |
| ) |
const |
Returns the ID of the parent block.
◆ setComment()
| void Block::setComment |
( |
std::shared_ptr< Comment > | comment | ) |
|
Sets the comment which is attached to this block.
◆ setCommentId()
| void Block::setCommentId |
( |
const std::string & | commentId | ) |
|
Sets the ID of the comment which is attached to this block.
◆ setCompileFunction()
| void Block::setCompileFunction |
( |
BlockComp | newCompileFunction | ) |
|
◆ setEngine()
| void Block::setEngine |
( |
IEngine * | newEngine | ) |
|
◆ setHatPredicateCompileFunction()
Sets the edge-activated hat predicate compile function.
- See also
- Block sections
◆ setId()
| void Entity::setId |
( |
const std::string & | newId | ) |
|
|
inherited |
◆ setIsTopLevelReporter()
| void Block::setIsTopLevelReporter |
( |
bool | isTopLevelReporter | ) |
|
Sets whether this block is a top level reporter block for a variable or a list.
- Note
- Setting this to true will allow the use of topLevelReporterInfo().
◆ setMutationHasNext()
| void Block::setMutationHasNext |
( |
bool | newMutationHasNext | ) |
|
Sets whether the block can have a block following it.
◆ setNext()
| void Block::setNext |
( |
Block * | block | ) |
|
◆ setNextId()
| void Block::setNextId |
( |
const std::string & | nextId | ) |
|
Sets the next block by ID.
◆ setParent()
| void Block::setParent |
( |
Block * | block | ) |
|
◆ setParentId()
| void Block::setParentId |
( |
const std::string & | id | ) |
|
Sets the parent block by ID.
◆ setShadow()
| void Block::setShadow |
( |
bool | newShadow | ) |
|
Toggles whether this block is a shadow block.
◆ setTarget()
| void Block::setTarget |
( |
Target * | newTarget | ) |
|
◆ setX()
| void Block::setX |
( |
int | x | ) |
|
Sets the X-coordinate of the block in the code area (only for top level blocks).
◆ setY()
| void Block::setY |
( |
int | y | ) |
|
Sets the Y-coordinate of the block in the code area (only for top level blocks).
◆ shadow()
| bool Block::shadow |
( |
| ) |
const |
Returns true if this is a shadow block.
◆ target()
| Target * Block::target |
( |
| ) |
const |
◆ topLevel()
| bool Block::topLevel |
( |
| ) |
const |
Returns true if this is a top level block.
◆ topLevelReporterInfo()
Returns the information about this top level reporter block (if this is a top level reporter block).
- Note
- This function will return nullptr if this isn't a top level reporter block. Use setIsTopLevelReporter(true) before using this function.
◆ x()
Returns the X-coordinate of the block in the code area (only for top level blocks).
◆ y()
Returns the Y-coordinate of the block in the code area (only for top level blocks).
The documentation for this class was generated from the following files: