2009-08-24 04:02:06 +00:00
|
|
|
//===- raw_os_ostream.h - std::ostream adaptor for raw_ostream --*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the raw_os_ostream class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_SUPPORT_RAW_OS_OSTREAM_H
|
|
|
|
#define LLVM_SUPPORT_RAW_OS_OSTREAM_H
|
|
|
|
|
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
#include <iosfwd>
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
/// raw_os_ostream - A raw_ostream that writes to an std::ostream. This is a
|
|
|
|
/// simple adaptor class. It does not check for output errors; clients should
|
|
|
|
/// use the underlying stream to detect errors.
|
|
|
|
class raw_os_ostream : public raw_ostream {
|
|
|
|
std::ostream &OS;
|
2012-09-23 02:12:10 +00:00
|
|
|
|
2009-08-24 04:02:06 +00:00
|
|
|
/// write_impl - See raw_ostream::write_impl.
|
2014-03-10 03:53:12 +00:00
|
|
|
void write_impl(const char *Ptr, size_t Size) override;
|
2012-09-23 02:12:10 +00:00
|
|
|
|
2009-08-24 04:02:06 +00:00
|
|
|
/// current_pos - Return the current position within the stream, not
|
|
|
|
/// counting the bytes currently in the buffer.
|
2014-03-10 03:53:12 +00:00
|
|
|
uint64_t current_pos() const override;
|
2012-09-23 02:12:10 +00:00
|
|
|
|
2009-08-24 04:02:06 +00:00
|
|
|
public:
|
2015-04-09 02:10:28 +00:00
|
|
|
raw_os_ostream(std::ostream &O) : raw_ostream(SK_STD_OS), OS(O) {}
|
2009-08-24 04:02:06 +00:00
|
|
|
~raw_os_ostream();
|
2015-04-09 02:10:28 +00:00
|
|
|
static bool classof(const raw_ostream *OS) {
|
|
|
|
return OS->getKind() == SK_STD_OS;
|
|
|
|
}
|
2009-08-24 04:02:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end llvm namespace
|
|
|
|
|
|
|
|
#endif
|