Skip to content

Commit 1db1e9b

Browse files
committed
Target: Add missing references to return values
1 parent 3367bcb commit 1db1e9b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/scratch/target.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Target::Target()
1010
}
1111

1212
/*! Returns the name of the target. */
13-
std::string Target::name() const
13+
const std::string &Target::name() const
1414
{
1515
return m_name;
1616
}
@@ -22,7 +22,7 @@ void Target::setName(const std::string &name)
2222
}
2323

2424
/*! Returns the list of variables. */
25-
std::vector<std::shared_ptr<Variable>> Target::variables() const
25+
const std::vector<std::shared_ptr<Variable>> &Target::variables() const
2626
{
2727
return m_variables;
2828
}
@@ -65,7 +65,7 @@ int Target::findVariableById(const std::string &id) const
6565
}
6666

6767
/*! Returns the list of Scratch lists. */
68-
std::vector<std::shared_ptr<List>> Target::lists() const
68+
const std::vector<std::shared_ptr<List>> &Target::lists() const
6969
{
7070
return m_lists;
7171
}
@@ -108,7 +108,7 @@ int Target::findListById(const std::string &id) const
108108
}
109109

110110
/*! Returns the list of blocks. */
111-
std::vector<std::shared_ptr<Block>> Target::blocks() const
111+
const std::vector<std::shared_ptr<Block>> &Target::blocks() const
112112
{
113113
return m_blocks;
114114
}
@@ -163,7 +163,7 @@ void Target::setCurrentCostume(int newCostume)
163163
}
164164

165165
/*! Returns the list of costumes. */
166-
std::vector<Costume> Target::costumes() const
166+
const std::vector<Costume> &Target::costumes() const
167167
{
168168
return m_costumes;
169169
}
@@ -194,7 +194,7 @@ int Target::findCostume(const std::string &costumeName) const
194194
}
195195

196196
/*! Returns the list of sounds. */
197-
std::vector<Sound> Target::sounds() const
197+
const std::vector<Sound> &Target::sounds() const
198198
{
199199
return m_sounds;
200200
}

src/scratch/target.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ class LIBSCRATCHCPP_EXPORT Target
3030
/*! Sets the target interface. */
3131
virtual void setInterface(IScratchTarget *newInterface) = 0;
3232

33-
std::string name() const;
33+
const std::string &name() const;
3434
void setName(const std::string &name);
3535

36-
std::vector<std::shared_ptr<Variable>> variables() const;
36+
const std::vector<std::shared_ptr<Variable>> &variables() const;
3737
int addVariable(std::shared_ptr<Variable> variable);
3838
std::shared_ptr<Variable> variableAt(int index) const;
3939
int findVariable(const std::string &variableName) const;
4040
int findVariableById(const std::string &id) const;
4141

42-
std::vector<std::shared_ptr<List>> lists() const;
42+
const std::vector<std::shared_ptr<List>> &lists() const;
4343
int addList(std::shared_ptr<List> list);
4444
std::shared_ptr<List> listAt(int index) const;
4545
int findList(const std::string &listName) const;
4646
int findListById(const std::string &id) const;
4747

48-
std::vector<std::shared_ptr<Block>> blocks() const;
48+
const std::vector<std::shared_ptr<Block>> &blocks() const;
4949
int addBlock(std::shared_ptr<Block> block);
5050
std::shared_ptr<Block> blockAt(int index) const;
5151
int findBlock(const std::string &id) const;
@@ -54,12 +54,12 @@ class LIBSCRATCHCPP_EXPORT Target
5454
int currentCostume() const;
5555
void setCurrentCostume(int newCostume);
5656

57-
std::vector<Costume> costumes() const;
57+
const std::vector<Costume> &costumes() const;
5858
int addCostume(const Costume &costume);
5959
Costume costumeAt(int index) const;
6060
int findCostume(const std::string &costumeName) const;
6161

62-
std::vector<Sound> sounds() const;
62+
const std::vector<Sound> &sounds() const;
6363
int addSound(const Sound &sound);
6464
Sound soundAt(int index) const;
6565
int findSound(const std::string &soundName) const;

0 commit comments

Comments
 (0)