]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmnStreamStderr.h
MFV r288408:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmnStreamStderr.h
1 //===-- MICmnStreamStderr.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 //++
11 // File:        MICmnStreamStderr.h
12 //
13 // Overview:    CMICmnStreamStderr interface.
14 //
15 // Environment: Compilers:  Visual C++ 12.
16 //                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
17 //              Libraries:  See MIReadmetxt.
18 //
19 // Copyright:   None.
20 //--
21
22 #pragma once
23
24 // In-house headers:
25 #include "MIUtilString.h"
26 #include "MICmnBase.h"
27 #include "MIUtilSingletonBase.h"
28 #include "MIUtilThreadBaseStd.h"
29
30 //++ ============================================================================
31 // Details: MI common code class. The MI driver requires this object.
32 //          CMICmnStreamStderr sets up and tears downs stderr for the driver.
33 //
34 //          Singleton class.
35 // Gotchas: None.
36 // Authors: Illya Rudkin 19/03/2014.
37 // Changes: None.
38 //--
39 class CMICmnStreamStderr : public CMICmnBase, public MI::ISingleton<CMICmnStreamStderr>
40 {
41     friend class MI::ISingleton<CMICmnStreamStderr>;
42
43     // Statics:
44   public:
45     static bool TextToStderr(const CMIUtilString &vrTxt);
46     static bool LLDBMsgToConsole(const CMIUtilString &vrTxt);
47
48     // Methods:
49   public:
50     bool Initialize(void);
51     bool Shutdown(void);
52     //
53     bool Lock(void);
54     bool Unlock(void);
55     bool Write(const CMIUtilString &vText, const bool vbSendToLog = true);
56     bool WriteLLDBMsg(const CMIUtilString &vText, const bool vbSendToLog = true);
57
58     // Methods:
59   private:
60     /* ctor */ CMICmnStreamStderr(void);
61     /* ctor */ CMICmnStreamStderr(const CMICmnStreamStderr &);
62     void operator=(const CMICmnStreamStderr &);
63     //
64     bool WritePriv(const CMIUtilString &vText, const CMIUtilString &vTxtForLogFile, const bool vbSendToLog = true);
65
66     // Overridden:
67   private:
68     // From CMICmnBase
69     /* dtor */ virtual ~CMICmnStreamStderr(void);
70
71     // Attributes:
72   private:
73     CMIUtilThreadMutex m_mutex; // Mutex object for sync during Write()
74 };