1 //===-- StreamCallback.h -----------------------------------*- 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 #ifndef liblldb_StreamCallback_h_ 11 #define liblldb_StreamCallback_h_ 12 13 #include "lldb/lldb-types.h" 14 #include "llvm/Support/raw_ostream.h" 15 16 #include <stddef.h> 17 #include <stdint.h> 18 19 namespace lldb_private { 20 21 class StreamCallback : public llvm::raw_ostream { 22 public: 23 StreamCallback(lldb::LogOutputCallback callback, void *baton); 24 ~StreamCallback() override = default; 25 26 private: 27 lldb::LogOutputCallback m_callback; 28 void *m_baton; 29 30 void write_impl(const char *Ptr, size_t Size) override; 31 uint64_t current_pos() const override; 32 }; 33 34 } // namespace lldb_private 35 36 #endif // liblldb_StreamCallback_h 37