ArchiveWriterFactory.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 "ArchiveWriterFactory.h"
  9. #include <Tools/ArchiveWriter.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(ArchiveWriterFactory, "ArchiveWriterFactory", ArchiveWriterFactoryTypeId);
  16. AZ_RTTI_NO_TYPE_INFO_IMPL(ArchiveWriterFactory, IArchiveWriterFactory);
  17. AZ_CLASS_ALLOCATOR_IMPL(ArchiveWriterFactory, AZ::SystemAllocator);
  18. // ArchiveWriter forwarding functions
  19. // This is used to create an ArchiveWriter instance that is pointed
  20. // to from an IArchiveWriter* to allow use of the ArchiveWriter in modules outside of the Archive Gem
  21. AZStd::unique_ptr<IArchiveWriter> ArchiveWriterFactory::Create() const
  22. {
  23. return AZStd::make_unique<ArchiveWriter>();
  24. }
  25. AZStd::unique_ptr<IArchiveWriter> ArchiveWriterFactory::Create(const ArchiveWriterSettings& writerSettings) const
  26. {
  27. return AZStd::make_unique<ArchiveWriter>(writerSettings);
  28. }
  29. AZStd::unique_ptr<IArchiveWriter> ArchiveWriterFactory::Create(AZ::IO::PathView archivePath,
  30. const ArchiveWriterSettings& writerSettings) const
  31. {
  32. return AZStd::make_unique<ArchiveWriter>(archivePath, writerSettings);
  33. }
  34. AZStd::unique_ptr<IArchiveWriter> ArchiveWriterFactory::Create(IArchiveWriter::ArchiveStreamPtr archiveStream,
  35. const ArchiveWriterSettings& writerSettings) const
  36. {
  37. return AZStd::make_unique<ArchiveWriter>(AZStd::move(archiveStream), writerSettings);
  38. }
  39. } // namespace Archive