ApplicationBase.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include "application/api_application.h"
  3. #include <set>
  4. #include "syscb/api_syscb.h"
  5. /* implements non-platform-specific methods of api_application.
  6. You can derive your Application implementation from this to ease your life */
  7. class ApplicationBase : public api_application
  8. {
  9. public:
  10. ApplicationBase();
  11. ~ApplicationBase();
  12. /* call this (and check the return value) before doing your own initialization */
  13. int Initialize();
  14. /* and call this after doing your own shutdown */
  15. void Shutdown();
  16. void SetDataPath(nx_uri_t data_path);
  17. void SetPermission(GUID feature);
  18. void RemovePermission(GUID permission);
  19. void SetDeviceID(nx_string_t device_id);
  20. void EnableAllPermissions();
  21. void ClearPermissions();
  22. void NotifyPermissions(api_syscb *system_callbacks); /* pass in the syscb API to avoid a dependency */
  23. void DumpPermissions(); /* dumps permissions list to the log file */
  24. protected:
  25. /* api_application implementation */
  26. int Application_GetDataPath(nx_uri_t *path);
  27. int Application_GetPermission(GUID feature);
  28. int Application_GetFeature(GUID feature);
  29. void Application_SetFeature(GUID feature);
  30. int Application_GetDeviceID(nx_string_t *value);
  31. private:
  32. typedef std::set<GUID> FeatureList;
  33. FeatureList features;
  34. FeatureList permissions;
  35. bool all_permissions_enabled; /* bypass for developer/QA testing */
  36. nx_uri_t data_path;
  37. nx_string_t device_id;
  38. };