Skip to content

Commit 7283b45

Browse files
committed
Add clear() method to project reader
1 parent af0c369 commit 7283b45

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/internal/iprojectreader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class LIBSCRATCHCPP_EXPORT IProjectReader
1919

2020
virtual bool load() = 0;
2121
virtual bool isValid() = 0;
22+
virtual void clear() = 0;
2223
virtual std::vector<std::shared_ptr<Target>> targets() = 0;
2324
virtual std::vector<std::shared_ptr<Broadcast>> broadcasts() = 0;
2425
virtual std::vector<std::string> extensions() = 0;

src/internal/scratch3reader.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,14 @@ bool Scratch3Reader::isValid()
257257
return (semver.substr(0, semver.find(".")) == "3");
258258
}
259259

260+
void Scratch3Reader::clear()
261+
{
262+
m_json = "";
263+
m_targets.clear();
264+
m_broadcasts.clear();
265+
m_extensions.clear();
266+
}
267+
260268
std::vector<std::shared_ptr<Target>> Scratch3Reader::targets()
261269
{
262270
return m_targets;

src/internal/scratch3reader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class LIBSCRATCHCPP_EXPORT Scratch3Reader : public IProjectReader
1414
public:
1515
bool load() override;
1616
bool isValid() override;
17+
void clear() override;
1718
std::vector<std::shared_ptr<Target>> targets() override;
1819
std::vector<std::shared_ptr<Broadcast>> broadcasts() override;
1920
std::vector<std::string> extensions() override;

0 commit comments

Comments
 (0)