LLVM API Documentation

raw_os_ostream.h
Go to the documentation of this file.
00001 //===- raw_os_ostream.h - std::ostream adaptor for raw_ostream --*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  This file defines the raw_os_ostream class.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_SUPPORT_RAW_OS_OSTREAM_H
00015 #define LLVM_SUPPORT_RAW_OS_OSTREAM_H
00016 
00017 #include "llvm/Support/raw_ostream.h"
00018 #include <iosfwd>
00019 
00020 namespace llvm {
00021 
00022 /// raw_os_ostream - A raw_ostream that writes to an std::ostream.  This is a
00023 /// simple adaptor class.  It does not check for output errors; clients should
00024 /// use the underlying stream to detect errors.
00025 class raw_os_ostream : public raw_ostream {
00026   std::ostream &OS;
00027 
00028   /// write_impl - See raw_ostream::write_impl.
00029   void write_impl(const char *Ptr, size_t Size) override;
00030 
00031   /// current_pos - Return the current position within the stream, not
00032   /// counting the bytes currently in the buffer.
00033   uint64_t current_pos() const override;
00034 
00035 public:
00036   raw_os_ostream(std::ostream &O) : OS(O) {}
00037   ~raw_os_ostream();
00038 };
00039 
00040 } // end llvm namespace
00041 
00042 #endif