TarWriter.h 939 B

123456789101112131415161718192021222324252627282930313233
  1. //===-- llvm/Support/TarWriter.h - Tar archive file creator -----*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLVM_SUPPORT_TARWRITER_H
  9. #define LLVM_SUPPORT_TARWRITER_H
  10. #include "llvm/ADT/StringRef.h"
  11. #include "llvm/ADT/StringSet.h"
  12. #include "llvm/Support/Error.h"
  13. #include "llvm/Support/raw_ostream.h"
  14. namespace llvm {
  15. class TarWriter {
  16. public:
  17. static Expected<std::unique_ptr<TarWriter>> create(StringRef OutputPath,
  18. StringRef BaseDir);
  19. void append(StringRef Path, StringRef Data);
  20. private:
  21. TarWriter(int FD, StringRef BaseDir);
  22. raw_fd_ostream OS;
  23. std::string BaseDir;
  24. StringSet<> Files;
  25. };
  26. }
  27. #endif