1 //===-- MIDriverBase.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 #pragma once 11 12 // Third party headers: 13 #include "lldb/API/SBBroadcaster.h" 14 #include "lldb/API/SBDebugger.h" 15 16 // In-house headers: 17 #include "MIUtilString.h" 18 19 // Declarations: 20 namespace lldb { 21 class SBBroadcaster; 22 } 23 24 //++ 25 //============================================================================ 26 // Details: MI driver base implementation class. This class has been created so 27 // not have to edit the lldb::SBBroadcaster class code. Functionality 28 // and attributes need to be common to the LLDB Driver class and the 29 // MI Driver class (derived from lldb::SBBroadcaster) so they can call 30 // upon each other for functionality fall through and allow the 31 // CDriverMgr to manage either (any) driver to be operated on. 32 // Each driver instance (the CMIDriver, LLDB::Driver) has its own 33 // LLDB::SBDebugger object. 34 //-- 35 class CMIDriverBase { 36 // Methods: 37 public: 38 /* ctor */ CMIDriverBase(); 39 40 CMIDriverBase *GetDriverToFallThruTo() const; 41 CMIDriverBase *GetDriversParent() const; 42 43 // Overrideable: 44 public: 45 /* dtor */ virtual ~CMIDriverBase(); 46 47 virtual bool DoFallThruToAnotherDriver(const CMIUtilString &vCmd, 48 CMIUtilString &vwErrMsg); 49 virtual bool SetDriverToFallThruTo(const CMIDriverBase &vrOtherDriver); 50 virtual bool SetDriverParent(const CMIDriverBase &vrOtherDriver); 51 virtual const CMIUtilString &GetDriverName() const = 0; 52 virtual const CMIUtilString &GetDriverId() const = 0; 53 virtual void SetExitApplicationFlag(const bool vbForceExit); 54 55 // MI provide information for the pass through (child) assigned driver 56 virtual FILE *GetStdin() const; 57 virtual FILE *GetStdout() const; 58 virtual FILE *GetStderr() const; 59 60 // Attributes: 61 protected: 62 CMIDriverBase *m_pDriverFallThru; // Child driver to use should *this driver 63 // not be able to handle client input 64 CMIDriverBase *m_pDriverParent; // The parent driver who passes work to *this 65 // driver to do work 66 CMIUtilString m_strDriverId; 67 bool m_bExitApp; // True = Yes, exit application, false = continue execution 68 }; 69