This class encapsulates a pointer to an object which can be called by a timer, hotkey, etc. It provides common functionality that wouldn't be suitable for the base IObject interface, but is needed for detection of "Suspend" or "Critical" prior to calling the sub or function.
| 1422 | // base IObject interface, but is needed for detection of "Suspend" or "Critical" |
| 1423 | // prior to calling the sub or function. |
| 1424 | class IObjectPtr |
| 1425 | { |
| 1426 | protected: |
| 1427 | IObject *mObject; |
| 1428 | |
| 1429 | public: |
| 1430 | IObjectPtr() : mObject(NULL) {} |
| 1431 | IObjectPtr(IObject *object) : mObject(object) {} |
| 1432 | ResultType ExecuteInNewThread(TCHAR *aNewThreadDesc |
| 1433 | , ExprTokenType *aParamValue = NULL, int aParamCount = 0, __int64 *aRetVal = NULL) const; |
| 1434 | const IObjectPtr* operator-> () { return this; } // Act like a pointer. |
| 1435 | operator void *() const { return mObject; } // For comparisons and boolean eval. |
| 1436 | |
| 1437 | // Caller beware: does not check for NULL. |
| 1438 | Func *ToFunc() const; |
| 1439 | IObject *ToObject() const { return mObject; } |
| 1440 | |
| 1441 | // Currently only used by ListLines, listing active timers. |
| 1442 | LPCTSTR Name() const; |
| 1443 | }; |
| 1444 | |
| 1445 | // IObjectPtr with automatic reference-counting, for storing an object safely, |
| 1446 | // such as in a HotkeyVariant, UserMenuItem, etc. Its specific purpose is to |