QGearsAFileManager.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 "QGearsAFile.h"
  19. namespace QGears{
  20. /**
  21. * A manager for A files.
  22. */
  23. class _QGearsExport AFileManager :
  24. public Ogre::ResourceManager, public Ogre::Singleton<AFileManager>
  25. {
  26. public:
  27. /**
  28. * Constructor.
  29. */
  30. AFileManager();
  31. /**
  32. * Destructor.
  33. */
  34. virtual ~AFileManager();
  35. /**
  36. * Retrieves a singleton to the manager.
  37. */
  38. static AFileManager& GetSingleton();
  39. /**
  40. * Retrieves a pointer to the manager singleton.
  41. */
  42. static AFileManager* GetSingletonPtr();
  43. protected:
  44. /**
  45. * Loads the manager.
  46. *
  47. * @param name[in] The unique name of the manager.
  48. * @param handle[in] @todo Understand and document.
  49. * @param group[in] The name of the resource group to which this
  50. * resource belong.
  51. * @param is_manual[in] True if the resource is manually loaded,
  52. * false otherwise.
  53. * @param loader[in] Pointer to a ManualResourceLoader
  54. * implementation which will be called when the Resource wishes to
  55. * load (should be supplied if is_manual is set to true). It can be
  56. * null, but the Resource will never be able to reload if anything
  57. * ever causes it to unload. Therefore provision of a proper
  58. * ManualResourceLoader instance is strongly recommended.
  59. * @param create_params[in] Unused.
  60. */
  61. virtual Ogre::Resource *createImpl(
  62. const Ogre::String &name, Ogre::ResourceHandle handle,
  63. const Ogre::String &group, bool is_manual,
  64. Ogre::ManualResourceLoader *loader,
  65. const Ogre::NameValuePairList *create_params
  66. ) override final;
  67. };
  68. }