1198090Srdivacky//===- raw_os_ostream.h - std::ostream adaptor for raw_ostream --*- C++ -*-===// 2198090Srdivacky// 3198090Srdivacky// The LLVM Compiler Infrastructure 4198090Srdivacky// 5198090Srdivacky// This file is distributed under the University of Illinois Open Source 6198090Srdivacky// License. See LICENSE.TXT for details. 7198090Srdivacky// 8198090Srdivacky//===----------------------------------------------------------------------===// 9198090Srdivacky// 10198090Srdivacky// This file defines the raw_os_ostream class. 11198090Srdivacky// 12198090Srdivacky//===----------------------------------------------------------------------===// 13198090Srdivacky 14198090Srdivacky#ifndef LLVM_SUPPORT_RAW_OS_OSTREAM_H 15198090Srdivacky#define LLVM_SUPPORT_RAW_OS_OSTREAM_H 16198090Srdivacky 17198090Srdivacky#include "llvm/Support/raw_ostream.h" 18198090Srdivacky#include <iosfwd> 19198090Srdivacky 20198090Srdivackynamespace llvm { 21198090Srdivacky 22198090Srdivacky/// raw_os_ostream - A raw_ostream that writes to an std::ostream. This is a 23198090Srdivacky/// simple adaptor class. It does not check for output errors; clients should 24198090Srdivacky/// use the underlying stream to detect errors. 25198090Srdivackyclass raw_os_ostream : public raw_ostream { 26198090Srdivacky std::ostream &OS; 27245431Sdim 28198090Srdivacky /// write_impl - See raw_ostream::write_impl. 29245431Sdim virtual void write_impl(const char *Ptr, size_t Size) LLVM_OVERRIDE; 30245431Sdim 31198090Srdivacky /// current_pos - Return the current position within the stream, not 32198090Srdivacky /// counting the bytes currently in the buffer. 33245431Sdim virtual uint64_t current_pos() const LLVM_OVERRIDE; 34245431Sdim 35198090Srdivackypublic: 36198090Srdivacky raw_os_ostream(std::ostream &O) : OS(O) {} 37198090Srdivacky ~raw_os_ostream(); 38198090Srdivacky}; 39198090Srdivacky 40198090Srdivacky} // end llvm namespace 41198090Srdivacky 42198090Srdivacky#endif 43