QGearsRSDFileManager.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #pragma once
  16. #include <OgreResourceManager.h>
  17. #include "QGearsPrerequisites.h"
  18. #include "QGearsRSDFile.h"
  19. namespace QGears{
  20. /**
  21. * A manager for RDS files.
  22. */
  23. class _QGearsExport RSDFileManager :
  24. public Ogre::ResourceManager, public Ogre::Singleton<RSDFileManager>
  25. {
  26. public:
  27. /**
  28. * Constructor.
  29. */
  30. RSDFileManager();
  31. /**
  32. * Destructor.
  33. */
  34. virtual ~RSDFileManager();
  35. /**
  36. * Retrieves a singleton to the manager.
  37. */
  38. static RSDFileManager& GetSingleton();
  39. /**
  40. * Retrieves a pointer to the manager singleton.
  41. */
  42. static RSDFileManager* GetSingletonPtr();
  43. /**
  44. * Parses the file script and adds the resource.
  45. *
  46. * @param stream[in] The contents of the file.
  47. * @param group_name[in] Name of the group to add the resource to.
  48. */
  49. virtual void ParseScript(
  50. Ogre::DataStreamPtr &stream, const String &group_name
  51. );
  52. protected:
  53. /**
  54. * Loads the manager.
  55. *
  56. * @param name[in] The unique name of the manager.
  57. * @param handle[in] @todo Understand and document.
  58. * @param group[in] The name of the resource group to which this
  59. * resource belong.
  60. * @param is_manual[in] True if the resource is manually loaded,
  61. * false otherwise.
  62. * @param loader[in] Pointer to a ManualResourceLoader
  63. * implementation which will be called when the Resource wishes to
  64. * load (should be supplied if is_manual is set to true). It can be
  65. * null, but the Resource will never be able to reload if anything
  66. * ever causes it to unload. Therefore provision of a proper
  67. * ManualResourceLoader instance is strongly recommended.
  68. * @param create_params[in] Unused.
  69. */
  70. Ogre::Resource *createImpl(
  71. const Ogre::String &name, Ogre::ResourceHandle handle,
  72. const Ogre::String &group, bool is_manual,
  73. Ogre::ManualResourceLoader *loader,
  74. const Ogre::NameValuePairList *create_params
  75. );
  76. };
  77. }