]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmnMIValueConst.cpp
Merge ^/head r275118 through r275209.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmnMIValueConst.cpp
1 //===-- Platform.cpp --------------------------------------------*- 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:                MICmnMIValueConst.h
12 //
13 // Overview:    CMICmnMIValueConst implementation.
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 // In-house headers:
23 #include "MICmnMIValueConst.h"
24
25 // Instantiations:
26 const CMIUtilString CMICmnMIValueConst::ms_constStrDblQuote( "\"" );
27
28 //++ ------------------------------------------------------------------------------------
29 // Details:     CMICmnMIValueConst constructor.
30 // Type:        Method.
31 // Args:        vString - (R) MI Const c-string value.
32 // Return:      None.
33 // Throws:      None.
34 //--
35 CMICmnMIValueConst::CMICmnMIValueConst( const CMIUtilString & vString )
36 :       m_strPartConst( vString )
37 ,       m_bNoQuotes( false )
38 {
39         BuildConst();
40 }
41
42 //++ ------------------------------------------------------------------------------------
43 // Details:     CMICmnMIValueConst constructor.
44 // Type:        Method.
45 // Args:        vString         - (R) MI Const c-string value.
46 //                      vbNoQuotes      - (R) True = return string not surrounded with quotes, false = use quotes.
47 // Return:      None.
48 // Throws:      None.
49 //--
50 CMICmnMIValueConst::CMICmnMIValueConst( const CMIUtilString & vString, const bool vbNoQuotes )
51 :       m_strPartConst( vString )
52 ,       m_bNoQuotes( vbNoQuotes )
53 {
54         BuildConst();
55 }
56
57 //++ ------------------------------------------------------------------------------------
58 // Details:     CMICmnMIValueConst destructor.
59 // Type:        Overrideable.
60 // Args:        None.
61 // Return:      None.
62 // Throws:      None.
63 //--
64 CMICmnMIValueConst::~CMICmnMIValueConst( void )
65 {
66 }
67
68 //++ ------------------------------------------------------------------------------------
69 // Details:     Build the Value Const data. 
70 // Type:        Method.
71 // Args:        None.
72 // Return:      MIstatus::success - Functional succeeded.
73 //                      MIstatus::failure - Functional failed.
74 // Throws:      None.
75 //--
76 bool CMICmnMIValueConst::BuildConst( void )
77 {
78         if( m_strPartConst.length() != 0 )
79         {
80                 const CMIUtilString strValue( m_strPartConst.StripCREndOfLine() );
81                 if( m_bNoQuotes )
82                 {
83                         m_strValue = strValue;
84                 }
85                 else
86                 {
87                         const MIchar * pFormat = "%s%s%s";
88                         m_strValue = CMIUtilString::Format( pFormat, ms_constStrDblQuote.c_str(), strValue.c_str(), ms_constStrDblQuote.c_str() );
89                 }
90         }
91         else
92         {
93                 const MIchar * pFormat = "%s%s";
94                 m_strValue = CMIUtilString::Format( pFormat, ms_constStrDblQuote.c_str(), ms_constStrDblQuote.c_str() );
95         }
96
97         return MIstatus::success;
98 }