ArchiveReaderFactory.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include "ArchiveReaderFactory.h"
  9. #include <Clients/ArchiveReader.h>
  10. #include <AzCore/Memory/SystemAllocator.h>
  11. #include <Archive/ArchiveTypeIds.h>
  12. namespace Archive
  13. {
  14. // Implement TypeInfo, Rtti and Allocator support
  15. AZ_TYPE_INFO_WITH_NAME_IMPL(ArchiveReaderFactory, "ArchiveReaderFactory", ArchiveReaderFactoryTypeId);
  16. AZ_RTTI_NO_TYPE_INFO_IMPL(ArchiveReaderFactory, IArchiveReaderFactory);
  17. AZ_CLASS_ALLOCATOR_IMPL(ArchiveReaderFactory, AZ::SystemAllocator);
  18. // ArchiveReader forwarding functions
  19. // This is used to create an ArchiveReader instance that is pointed
  20. // to from an IArchiveReader* to allow use of the ArchiveReader in modules outside of the Archive Gem
  21. AZStd::unique_ptr<IArchiveReader> ArchiveReaderFactory::Create() const
  22. {
  23. return AZStd::make_unique<ArchiveReader>();
  24. }
  25. AZStd::unique_ptr<IArchiveReader> ArchiveReaderFactory::Create(const ArchiveReaderSettings& readerSettings) const
  26. {
  27. return AZStd::make_unique<ArchiveReader>(readerSettings);
  28. }
  29. AZStd::unique_ptr<IArchiveReader> ArchiveReaderFactory::Create(AZ::IO::PathView archivePath,
  30. const ArchiveReaderSettings& readerSettings) const
  31. {
  32. return AZStd::make_unique<ArchiveReader>(archivePath, readerSettings);
  33. }
  34. AZStd::unique_ptr<IArchiveReader> ArchiveReaderFactory::Create(IArchiveReader::ArchiveStreamPtr archiveStream,
  35. const ArchiveReaderSettings& readerSettings) const
  36. {
  37. return AZStd::make_unique<ArchiveReader>(AZStd::move(archiveStream), readerSettings);
  38. }
  39. } // namespace Archive