libscratchcpp
A library for C++ based Scratch project players
Loading...
Searching...
No Matches
libscratchcpp::Variable Class Reference

The Variable class represents a Scratch variable. More...

#include <scratchcpp/variable.h>

Inheritance diagram for libscratchcpp::Variable:
Collaboration diagram for libscratchcpp::Variable:

Public Member Functions

 Variable (const std::string &id, const std::string &name, const Value &value=Value(), bool isCloudVariable=false)
 
 Variable (const Variable &)=delete
 
const std::string & name () const
 
const Valuevalue () const
 
ValuevaluePtr ()
 
void setValue (const Value &value)
 
bool isCloudVariable () const
 
void setIsCloudVariable (bool isCloudVariable)
 
Targettarget () const
 
void setTarget (Target *target)
 
Monitormonitor () const
 
void setMonitor (Monitor *monitor)
 
std::shared_ptr< Variableclone ()
 
const std::string & id () const
 
void setId (const std::string &newId)
 

Detailed Description

The Variable class represents a Scratch variable.

Constructor & Destructor Documentation

◆ Variable() [1/2]

Variable::Variable ( const std::string & id,
const std::string & name,
const Value & value = Value(),
bool isCloudVariable = false )

Constructs Variable.

◆ Variable() [2/2]

libscratchcpp::Variable::Variable ( const Variable & )
delete

Member Function Documentation

◆ clone()

std::shared_ptr< Variable > Variable::clone ( )

Creates a copy of the variable.

◆ id()

const std::string & Entity::id ( ) const
inherited

Returns the ID.

◆ isCloudVariable()

bool Variable::isCloudVariable ( ) const

Returns true if the variable is a cloud variable.

◆ monitor()

Monitor * Variable::monitor ( ) const

Returns the monitor of this variable.

◆ name()

const std::string & Variable::name ( ) const

Returns the name of the variable.

◆ setId()

void Entity::setId ( const std::string & newId)
inherited

Sets the ID.

◆ setIsCloudVariable()

void Variable::setIsCloudVariable ( bool isCloudVariable)

Toggles whether the variable is a cloud variable.

◆ setMonitor()

void Variable::setMonitor ( Monitor * monitor)

Sets the monitor of this variable.

◆ setTarget()

void Variable::setTarget ( Target * target)

Sets the sprite or stage this variable belongs to.

◆ setValue()

void Variable::setValue ( const Value & value)

Sets the value.

◆ target()

Target * Variable::target ( ) const

Returns the sprite or stage this variable belongs to.

◆ value()

const Value & Variable::value ( ) const

Returns the value.

◆ valuePtr()

Value * Variable::valuePtr ( )

Returns a pointer to the value.


The documentation for this class was generated from the following files: