QGearsLGPArchiveFactory.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 <OgreArchiveFactory.h>
  17. #include "QGearsLGPArchive.h"
  18. namespace QGears{
  19. /**
  20. * A factory for LGP archives.
  21. */
  22. class LGPArchiveFactory : public Ogre::ArchiveFactory{
  23. // TODO: Move implemented methods to cpp file.
  24. public:
  25. /**
  26. * Constructor.
  27. */
  28. LGPArchiveFactory();
  29. /**
  30. * Destructor.
  31. */
  32. virtual ~LGPArchiveFactory();
  33. /**
  34. * Retrieves the factory type.
  35. *
  36. * @return The factory type.
  37. */
  38. const String& getType(void) const{return ARCHIVE_TYPE;}
  39. /**
  40. * Creates a new LGP archive.
  41. *
  42. * @param name[in] Name of the archive to create.
  43. * @param readOnly[in] True to make the archive read-only, false to
  44. * enable writting.
  45. * @return A new LGP archive.
  46. */
  47. Ogre::Archive* createInstance(
  48. const String& name, bool readOnly
  49. ) override final{
  50. return OGRE_NEW LGPArchive(name, ARCHIVE_TYPE);
  51. }
  52. /**
  53. * Destroys a LGP archive created by this factory.
  54. *
  55. * @param arch[in] The archive to destroy.
  56. */
  57. void destroyInstance( Ogre::Archive* arch ) override final{
  58. OGRE_DELETE arch;
  59. }
  60. /**
  61. * The archive type.
  62. */
  63. static const String ARCHIVE_TYPE;
  64. };
  65. }