TarWriter.h 1.1 KB

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