raw_os_ostream.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //===- raw_os_ostream.h - std::ostream adaptor for raw_ostream --*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file defines the raw_os_ostream class.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_SUPPORT_RAW_OS_OSTREAM_H
  14. #define LLVM_SUPPORT_RAW_OS_OSTREAM_H
  15. #include "llvm/Support/raw_ostream.h"
  16. #include <iosfwd>
  17. namespace llvm {
  18. /// raw_os_ostream - A raw_ostream that writes to an std::ostream. This is a
  19. /// simple adaptor class. It does not check for output errors; clients should
  20. /// use the underlying stream to detect errors.
  21. class raw_os_ostream : public raw_ostream {
  22. std::ostream &OS;
  23. /// write_impl - See raw_ostream::write_impl.
  24. void write_impl(const char *Ptr, size_t Size) override;
  25. /// current_pos - Return the current position within the stream, not
  26. /// counting the bytes currently in the buffer.
  27. uint64_t current_pos() const override;
  28. public:
  29. raw_os_ostream(std::ostream &O) : OS(O) {}
  30. ~raw_os_ostream() override;
  31. };
  32. } // end llvm namespace
  33. #endif