SBFile.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //===-- SBFile.h --------------------------------------------*- 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 LLDB_API_SBFILE_H
  9. #define LLDB_API_SBFILE_H
  10. #include "lldb/API/SBDefines.h"
  11. namespace lldb {
  12. class LLDB_API SBFile {
  13. friend class SBInstruction;
  14. friend class SBInstructionList;
  15. friend class SBDebugger;
  16. friend class SBCommandReturnObject;
  17. friend class SBProcess;
  18. public:
  19. SBFile();
  20. SBFile(FileSP file_sp);
  21. SBFile(const SBFile &rhs);
  22. SBFile(FILE *file, bool transfer_ownership);
  23. SBFile(int fd, const char *mode, bool transfer_ownership);
  24. ~SBFile();
  25. SBFile &operator=(const SBFile &rhs);
  26. SBError Read(uint8_t *buf, size_t num_bytes, size_t *bytes_read);
  27. SBError Write(const uint8_t *buf, size_t num_bytes, size_t *bytes_written);
  28. SBError Flush();
  29. bool IsValid() const;
  30. SBError Close();
  31. operator bool() const;
  32. bool operator!() const;
  33. FileSP GetFile() const;
  34. private:
  35. FileSP m_opaque_sp;
  36. };
  37. } // namespace lldb
  38. #endif // LLDB_API_SBFILE_H