Skip to content

Commit 85529ea

Browse files
Atsumu Onominggo
Atsumu Ono
authored and
minggo
committed
Add const keyword to Node::isScheduled (#17841)
1 parent 5a52189 commit 85529ea

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Diff for: cocos/2d/CCNode.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1500,12 +1500,12 @@ void Node::setScheduler(Scheduler* scheduler)
15001500
}
15011501
}
15021502

1503-
bool Node::isScheduled(SEL_SCHEDULE selector)
1503+
bool Node::isScheduled(SEL_SCHEDULE selector) const
15041504
{
15051505
return _scheduler->isScheduled(selector, this);
15061506
}
15071507

1508-
bool Node::isScheduled(const std::string &key)
1508+
bool Node::isScheduled(const std::string &key) const
15091509
{
15101510
return _scheduler->isScheduled(key, this);
15111511
}

Diff for: cocos/2d/CCNode.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ class CC_DLL Node : public Ref
13361336
* @js NA
13371337
* @lua NA
13381338
*/
1339-
bool isScheduled(SEL_SCHEDULE selector);
1339+
bool isScheduled(SEL_SCHEDULE selector) const;
13401340

13411341
/**
13421342
* Checks whether a lambda function is scheduled.
@@ -1346,7 +1346,7 @@ class CC_DLL Node : public Ref
13461346
* @js NA
13471347
* @lua NA
13481348
*/
1349-
bool isScheduled(const std::string &key);
1349+
bool isScheduled(const std::string &key) const;
13501350

13511351
/**
13521352
* Schedules the "update" method.

Diff for: cocos/base/CCScheduler.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ void Scheduler::schedulePerFrame(const ccSchedulerFunc& callback, void *target,
500500
}
501501
}
502502

503-
bool Scheduler::isScheduled(const std::string& key, void *target) const
503+
bool Scheduler::isScheduled(const std::string& key, const void *target) const
504504
{
505505
CCASSERT(!key.empty(), "Argument key must not be empty");
506506
CCASSERT(target, "Argument target must be non-nullptr");
@@ -1003,7 +1003,7 @@ void Scheduler::schedule(SEL_SCHEDULE selector, Ref *target, float interval, boo
10031003
this->schedule(selector, target, interval, CC_REPEAT_FOREVER, 0.0f, paused);
10041004
}
10051005

1006-
bool Scheduler::isScheduled(SEL_SCHEDULE selector, Ref *target) const
1006+
bool Scheduler::isScheduled(SEL_SCHEDULE selector, const Ref *target) const
10071007
{
10081008
CCASSERT(selector, "Argument selector must be non-nullptr");
10091009
CCASSERT(target, "Argument target must be non-nullptr");

Diff for: cocos/base/CCScheduler.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -363,15 +363,15 @@ class CC_DLL Scheduler : public Ref
363363
@return True if the specified callback is invoked, false if not.
364364
@since v3.0.0
365365
*/
366-
bool isScheduled(const std::string& key, void *target) const;
366+
bool isScheduled(const std::string& key, const void *target) const;
367367

368368
/** Checks whether a selector for a given target is scheduled.
369369
@param selector The selector to be checked.
370370
@param target The target of the callback.
371371
@return True if the specified selector is invoked, false if not.
372372
@since v3.0
373373
*/
374-
bool isScheduled(SEL_SCHEDULE selector, Ref *target) const;
374+
bool isScheduled(SEL_SCHEDULE selector, const Ref *target) const;
375375

376376
/////////////////////////////////////
377377

0 commit comments

Comments
 (0)