WinampConfigScriptObject.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef NULLSOFT_GEN_FF_WINAMPCONFIGSCRIPTOBJECT_H
  2. #define NULLSOFT_GEN_FF_WINAMPCONFIGSCRIPTOBJECT_H
  3. #include <api/script/objects/rootobj.h>
  4. #include <api/script/script.h>
  5. #include <api/script/objects/rootobject.h>
  6. #include <api/service/svcs/svc_scriptobji.h>
  7. namespace Agave
  8. {
  9. #include "../Agave/Config/api_config.h"
  10. }
  11. // -----------------------------------------------------------------------------------------------------
  12. // ScriptObject Service
  13. class WinampConfigScriptObjectSvc : public svc_scriptObjectI
  14. {
  15. public:
  16. WinampConfigScriptObjectSvc() {};
  17. virtual ~WinampConfigScriptObjectSvc() {};
  18. static const char *getServiceName() { return "Winamp Config script object"; }
  19. virtual ScriptObjectController *getController(int n);
  20. };
  21. class WinampConfigScriptController : public ScriptObjectControllerI
  22. {
  23. public:
  24. virtual const wchar_t *getClassName();
  25. virtual const wchar_t *getAncestorClassName();
  26. virtual ScriptObjectController *getAncestorController() { return rootScriptObjectController; }
  27. virtual int getNumFunctions();
  28. virtual const function_descriptor_struct *getExportedFunctions();
  29. virtual GUID getClassGuid();
  30. virtual ScriptObject *instantiate();
  31. virtual void destroy(ScriptObject *o);
  32. virtual void *encapsulate(ScriptObject *o);
  33. virtual void deencapsulate(void *o);
  34. private:
  35. static function_descriptor_struct exportedFunction[];
  36. };
  37. extern ScriptObjectController *winampConfigController;
  38. extern ScriptObjectController *winampConfigGroupController;
  39. #define WINAMPCONFIG_PARENT RootObjectInstance
  40. class WinampConfig : public WINAMPCONFIG_PARENT
  41. {
  42. public:
  43. WinampConfig();
  44. ~WinampConfig();
  45. public:
  46. virtual const wchar_t *vcpu_getClassName() { return L"WinampConfig"; }
  47. virtual ScriptObjectController *vcpu_getController() { return winampConfigController; }
  48. static scriptVar script_vcpu_getGroup(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar n);
  49. Agave::api_config *config;
  50. };
  51. class WinampConfigGroupScriptController : public ScriptObjectControllerI {
  52. public:
  53. virtual const wchar_t *getClassName();
  54. virtual const wchar_t *getAncestorClassName();
  55. virtual ScriptObjectController *getAncestorController() { return rootScriptObjectController; }
  56. virtual int getNumFunctions();
  57. virtual const function_descriptor_struct *getExportedFunctions();
  58. virtual GUID getClassGuid();
  59. virtual ScriptObject *instantiate();
  60. virtual void destroy(ScriptObject *o);
  61. virtual void *encapsulate(ScriptObject *o);
  62. virtual void deencapsulate(void *o);
  63. private:
  64. static function_descriptor_struct exportedFunction[];
  65. };
  66. #define WINAMPCONFIGGROUP_PARENT RootObjectInstance
  67. class WinampConfigGroup : public WINAMPCONFIGGROUP_PARENT
  68. {
  69. public:
  70. WinampConfigGroup();
  71. WinampConfigGroup(Agave::ifc_configgroup *_configGroup);
  72. public:
  73. virtual const wchar_t *vcpu_getClassName() { return L"WinampConfigGroup"; }
  74. virtual ScriptObjectController *vcpu_getController() { return winampConfigGroupController; }
  75. static Agave::ifc_configitem *GetItem(ScriptObject *o, scriptVar n); // helper function
  76. static scriptVar script_vcpu_getBool(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar n);
  77. static scriptVar script_vcpu_getString(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar n);
  78. static scriptVar script_vcpu_getInt(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar n);
  79. static scriptVar script_vcpu_setBool(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar itemname, scriptVar value);
  80. Agave::ifc_configgroup *configGroup;
  81. };
  82. #endif