@@ -322,7 +322,7 @@ std::shared_ptr<IBlockSection> Engine::blockSection(const std::string &opcode) c
322322}
323323
324324/* ! Returns the list of broadcasts. */
325- std::vector<std::shared_ptr<Broadcast>> Engine::broadcasts () const
325+ const std::vector<std::shared_ptr<Broadcast>> & Engine::broadcasts () const
326326{
327327 return m_broadcasts;
328328}
@@ -375,7 +375,7 @@ void libscratchcpp::Engine::addBroadcastScript(std::shared_ptr<Block> whenReceiv
375375}
376376
377377/* ! Returns the list of targets. */
378- std::vector<std::shared_ptr<Target>> Engine::targets () const
378+ const std::vector<std::shared_ptr<Target>> & Engine::targets () const
379379{
380380 return m_targets;
381381}
@@ -414,7 +414,7 @@ int Engine::findTarget(const std::string &targetName) const
414414}
415415
416416/* ! Returns the list of extension names. */
417- std::vector<std::string> Engine::extensions () const
417+ const std::vector<std::string> & Engine::extensions () const
418418{
419419 return m_extensions;
420420}
@@ -445,7 +445,7 @@ const std::unordered_map<std::shared_ptr<Block>, std::shared_ptr<Script>> &Engin
445445}
446446
447447/* ! Returns the block with the given ID. */
448- std::shared_ptr<Block> Engine::getBlock (std::string id)
448+ std::shared_ptr<Block> Engine::getBlock (const std::string & id)
449449{
450450 if (id.empty ())
451451 return nullptr ;
@@ -460,7 +460,7 @@ std::shared_ptr<Block> Engine::getBlock(std::string id)
460460}
461461
462462/* ! Returns the variable with the given ID. */
463- std::shared_ptr<Variable> Engine::getVariable (std::string id)
463+ std::shared_ptr<Variable> Engine::getVariable (const std::string & id)
464464{
465465 if (id.empty ())
466466 return nullptr ;
@@ -475,7 +475,7 @@ std::shared_ptr<Variable> Engine::getVariable(std::string id)
475475}
476476
477477/* ! Returns the Scratch list with the given ID. */
478- std::shared_ptr<List> Engine::getList (std::string id)
478+ std::shared_ptr<List> Engine::getList (const std::string & id)
479479{
480480 if (id.empty ())
481481 return nullptr ;
@@ -490,7 +490,7 @@ std::shared_ptr<List> Engine::getList(std::string id)
490490}
491491
492492/* ! Returns the broadcast with the given ID. */
493- std::shared_ptr<Broadcast> Engine::getBroadcast (std::string id)
493+ std::shared_ptr<Broadcast> Engine::getBroadcast (const std::string & id)
494494{
495495 if (id.empty ())
496496 return nullptr ;
@@ -503,7 +503,7 @@ std::shared_ptr<Broadcast> Engine::getBroadcast(std::string id)
503503}
504504
505505/* ! Returns the entity with the given ID. \see IEntity */
506- std::shared_ptr<IEntity> Engine::getEntity (std::string id)
506+ std::shared_ptr<IEntity> Engine::getEntity (const std::string & id)
507507{
508508 // Blocks
509509 auto block = getBlock (id);
0 commit comments