]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MIUtilMapIdToVariant.cpp
Merge OpenSSL 1.0.1k.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MIUtilMapIdToVariant.cpp
1 //===-- MIUtilMapIdToVariant.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:                MIUtilMapIdToVariant.cpp
12 //
13 // Overview:    CMIUtilMapIdToVariant 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 "MIUtilMapIdToVariant.h"
24
25 //++ ------------------------------------------------------------------------------------
26 // Details:     CMIUtilMapIdToVariant constructor.
27 // Type:        Method.
28 // Args:        None.
29 // Return:      None.
30 // Throws:      None.
31 //--
32 CMIUtilMapIdToVariant::CMIUtilMapIdToVariant( void )
33 {
34 }
35
36 //++ ------------------------------------------------------------------------------------
37 // Details:     CMIUtilMapIdToVariant destructor.
38 // Type:        Method.
39 // Args:        None.
40 // Return:      None.
41 // Throws:      None.
42 //--
43 CMIUtilMapIdToVariant::~CMIUtilMapIdToVariant( void )
44 {
45 }
46
47 //++ ------------------------------------------------------------------------------------
48 // Details:     Remove at the data from *this container.
49 // Type:        Method.
50 // Args:        None.
51 // Return:      None.
52 // Throws:      None.
53 //--
54 void CMIUtilMapIdToVariant::Clear( void )
55 {
56         m_mapKeyToVariantValue.clear();
57 }
58
59 //++ ------------------------------------------------------------------------------------
60 // Details:     Check an ID is present already in *this container.
61 // Type:        Method.
62 // Args:        vId     - (R) Unique ID i.e. GUID.
63 // Return:      True - registered.
64 //                      False - not found.
65 // Throws:      None.
66 //--
67 bool CMIUtilMapIdToVariant::HaveAlready( const CMIUtilString & vId ) const
68 {
69         const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find( vId );
70         if( it != m_mapKeyToVariantValue.end() )
71                 return true;
72         
73         return false;
74 }
75
76 //++ ------------------------------------------------------------------------------------
77 // Details:     Determine if *this container is currently holding any data.
78 // Type:        Method.
79 // Args:        None.
80 // Return:      bool    - True - Yes empty, false - one or more data object present.
81 // Throws:      None.
82 //--
83 bool CMIUtilMapIdToVariant::IsEmpty( void ) const
84 {
85         return m_mapKeyToVariantValue.empty();
86 }
87
88 //++ ------------------------------------------------------------------------------------
89 // Details:     Check the ID is valid to be registered.
90 // Type:        Method.
91 // Args:        vId     - (R) Unique ID i.e. GUID.
92 // Return:      True - valid.
93 //                      False - not valid.
94 // Throws:      None.
95 //--
96 bool CMIUtilMapIdToVariant::IsValid( const CMIUtilString & vId ) const
97 {
98         bool bValid = true;
99
100         if( vId.empty() )
101                 bValid = false;
102         
103         return bValid;
104 }
105
106 //++ ------------------------------------------------------------------------------------
107 // Details:     Remove from *this contain a data object specified by ID. The data object
108 //                      when removed also calls its destructor should it have one.
109 // Type:        Method.
110 // Args:        vId     - (R) Unique ID i.e. GUID.
111 // Return:      MIstatus::success - Functional succeeded.
112 //                      MIstatus::failure - Functional failed.
113 // Throws:      None.
114 //--
115 bool CMIUtilMapIdToVariant::Remove( const CMIUtilString & vId )
116 {
117         const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find( vId );
118         if( it != m_mapKeyToVariantValue.end() )
119         {
120                 m_mapKeyToVariantValue.erase( it );
121         }
122
123         return MIstatus::success;
124 }