1
0

feedwatcherso.cpp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. // ----------------------------------------------------------------------------
  2. // Generated by ScriptObjectFactory [Sat Sep 27 01:24:57 2003]
  3. //
  4. // File :
  5. // Class : FeedWatcherScriptObject
  6. // class layer : Automatic Object Scripting
  7. // ----------------------------------------------------------------------------
  8. #include "precomp.h"
  9. #include "feedwatch.h"
  10. #include "FeedWatcherSO.h"
  11. // ScriptController Instance
  12. static FeedWatcherScriptController _feedWatcherScriptController;FeedWatcherScriptController *feedWatcherScriptController = &_feedWatcherScriptController;
  13. // Function Descriptor Table
  14. function_descriptor_struct FeedWatcherScriptController::exportedFunctions[] = {
  15. { L"setFeed", 1, script_setFeed },
  16. { L"releaseFeed", 0, script_releaseFeed },
  17. { L"onFeedChange", 1, script_feedwatcher_onFeedChange },
  18. };
  19. // Script Object Methods
  20. FeedWatcherScriptObject::FeedWatcherScriptObject() {
  21. if (!getScriptObject()) return;
  22. feedWatcherScriptObject_init();
  23. }
  24. FeedWatcherScriptObject::~FeedWatcherScriptObject() {
  25. }
  26. void FeedWatcherScriptObject::feedWatcherScriptObject_init() {
  27. // Assign the script interface to this instance.
  28. getScriptObject()->vcpu_setInterface(FeedWatcherGuid, (void *)static_cast<FeedWatcher*>(this));
  29. // Assign the class name to this instance.
  30. getScriptObject()->vcpu_setClassName(L"FeedWatcher");
  31. // Assign the controller instance to this script object instance.
  32. getScriptObject()->vcpu_setController(feedWatcherScriptController);
  33. }
  34. // Script Object Methods
  35. void FeedWatcherScriptObject::feedwatcher_onFeedChange(const wchar_t *data) {
  36. FeedWatcherScriptController::script_feedwatcher_onFeedChange(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_STRING(data));
  37. }
  38. scriptVar /*int */ FeedWatcherScriptController::script_setFeed(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*const char **/ feedid) {
  39. // Begin all script methods with the init block.
  40. SCRIPT_FUNCTION_INIT;
  41. // Find the proper pointer for the "this" object, _pSO.
  42. FeedWatcher*_pObj = static_cast<FeedWatcher*>(_pSO->vcpu_getInterface(FeedWatcherGuid));
  43. if (_pObj) {
  44. return MAKE_SCRIPT_INT(_pObj->setFeed(GET_SCRIPT_STRING(feedid)));
  45. }
  46. RETURN_SCRIPT_ZERO;
  47. }
  48. scriptVar /*void */ FeedWatcherScriptController::script_releaseFeed(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  49. // Begin all script methods with the init block.
  50. SCRIPT_FUNCTION_INIT;
  51. // Find the proper pointer for the "this" object, _pSO.
  52. FeedWatcher*_pObj = static_cast<FeedWatcher*>(_pSO->vcpu_getInterface(FeedWatcherGuid));
  53. if (_pObj) {
  54. // Then properly call the hosted object;
  55. _pObj->releaseFeed();
  56. }
  57. RETURN_SCRIPT_VOID;
  58. }
  59. scriptVar /*void */ FeedWatcherScriptController::script_feedwatcher_onFeedChange(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*const char **/ data) {
  60. // Begin all script methods with the init block
  61. SCRIPT_FUNCTION_INIT;
  62. // Honnor C++ hooks
  63. PROCESS_HOOKS1(_pSO, feedWatcherScriptController, data);
  64. // If there are no script hooks to execute, we abort here.
  65. SCRIPT_FUNCTION_CHECKABORTEVENT;
  66. // Otherwise we execute the script methods by calling this.
  67. SCRIPT_EXEC_EVENT1(_pSO, data);
  68. }
  69. // Script Controller
  70. // This method returns the human readable name of the class in script files.
  71. const wchar_t *FeedWatcherScriptController::getClassName() {
  72. return L"FeedWatcher";
  73. }
  74. // This method returns the human readable name of the parent of this class.
  75. const wchar_t *FeedWatcherScriptController::getAncestorClassName() {
  76. return FEEDWATCHER_SCRIPTPARENTCLASS;
  77. }
  78. // This method returns the controller object for the parent class.
  79. ScriptObjectController *FeedWatcherScriptController::getAncestorController() {
  80. /* XML-Template-TODO : Support inheritance */
  81. return NULL;
  82. }
  83. // This method returns the number of methods this class publishes.
  84. int FeedWatcherScriptController::getNumFunctions() {
  85. return sizeof(exportedFunctions) / sizeof(function_descriptor_struct);
  86. }
  87. // This method returns the block of published function descriptors.
  88. const function_descriptor_struct *FeedWatcherScriptController::getExportedFunctions() {
  89. return exportedFunctions;
  90. }
  91. // This method returns the GUID assigned to this script class.
  92. GUID FeedWatcherScriptController::getClassGuid() {
  93. return FeedWatcherGuid;
  94. }
  95. // This method creates and returns a new script class instance.
  96. ScriptObject *FeedWatcherScriptController::instantiate() {
  97. FeedWatcher*_pObj = new FeedWatcher();
  98. ASSERT(_pObj != NULL);
  99. return _pObj->getScriptObject();
  100. }
  101. // This method deletes a given script class instance.
  102. void FeedWatcherScriptController::destroy(ScriptObject *o) {
  103. FeedWatcher*_pObj = static_cast<FeedWatcher*>(o->vcpu_getInterface(FeedWatcherGuid));
  104. ASSERT(_pObj != NULL);
  105. delete _pObj;
  106. }
  107. // This method returns an encapsulated interface for the given instance.
  108. void *FeedWatcherScriptController::encapsulate(ScriptObject *o) {
  109. // No automatic encapsulation
  110. return NULL;
  111. }
  112. // This method frees a previously encapsulated interface.
  113. void FeedWatcherScriptController::deencapsulate(void *o) {
  114. }