File tree Expand file tree Collapse file tree 4 files changed +29
-0
lines changed Expand file tree Collapse file tree 4 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ namespace libscratchcpp
1212{
1313
1414class Target ;
15+ class Monitor ;
1516class ListPrivate ;
1617
1718/* ! \brief The List class represents a Scratch list. */
@@ -29,6 +30,9 @@ class LIBSCRATCHCPP_EXPORT List
2930 Target *target () const ;
3031 void setTarget (Target *target);
3132
33+ Monitor *monitor () const ;
34+ void setMonitor (Monitor *monitor);
35+
3236 long indexOf (const Value &value) const ;
3337 bool contains (const Value &value) const ;
3438
Original file line number Diff line number Diff line change @@ -38,6 +38,18 @@ void List::setTarget(Target *target)
3838 impl->target = target;
3939}
4040
41+ /* ! Returns the monitor of this list. */
42+ Monitor *List::monitor () const
43+ {
44+ return impl->monitor ;
45+ }
46+
47+ /* ! Sets the monitor of this list. */
48+ void List::setMonitor (Monitor *monitor)
49+ {
50+ impl->monitor = monitor;
51+ }
52+
4153/* ! Returns the index of the given item. */
4254long List::indexOf (const Value &value) const
4355{
Original file line number Diff line number Diff line change @@ -8,13 +8,15 @@ namespace libscratchcpp
88{
99
1010class Target ;
11+ class Monitor ;
1112
1213struct ListPrivate
1314{
1415 ListPrivate (const std::string &name);
1516
1617 std::string name;
1718 Target *target = nullptr ;
19+ Monitor *monitor = nullptr ;
1820};
1921
2022} // namespace libscratchcpp
Original file line number Diff line number Diff line change 11#include < scratchcpp/list.h>
22#include < scratchcpp/target.h>
3+ #include < scratchcpp/monitor.h>
34
45#include " ../common.h"
56
@@ -29,6 +30,16 @@ TEST(ListTest, Target)
2930 ASSERT_EQ (list.target (), &target);
3031}
3132
33+ TEST (ListTest, Monitor)
34+ {
35+ List list (" " , " " );
36+ ASSERT_EQ (list.monitor (), nullptr );
37+
38+ Monitor monitor (" " , " " );
39+ list.setMonitor (&monitor);
40+ ASSERT_EQ (list.monitor (), &monitor);
41+ }
42+
3243TEST (ListTest, IndexOf)
3344{
3445 List list (" " , " test list" );
You can’t perform that action at this time.
0 commit comments