]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MIUtilMapIdToVariant.cpp
Update LLDB snapshot to upstream r225923 (git 2b588ecd)
[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
55 CMIUtilMapIdToVariant::Clear(void)
56 {
57     m_mapKeyToVariantValue.clear();
58 }
59
60 //++ ------------------------------------------------------------------------------------
61 // Details: Check an ID is present already in *this container.
62 // Type:    Method.
63 // Args:    vId - (R) Unique ID i.e. GUID.
64 // Return:  True - registered.
65 //          False - not found.
66 // Throws:  None.
67 //--
68 bool
69 CMIUtilMapIdToVariant::HaveAlready(const CMIUtilString &vId) const
70 {
71     const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find(vId);
72     if (it != m_mapKeyToVariantValue.end())
73         return true;
74
75     return false;
76 }
77
78 //++ ------------------------------------------------------------------------------------
79 // Details: Determine if *this container is currently holding any data.
80 // Type:    Method.
81 // Args:    None.
82 // Return:  bool    - True - Yes empty, false - one or more data object present.
83 // Throws:  None.
84 //--
85 bool
86 CMIUtilMapIdToVariant::IsEmpty(void) const
87 {
88     return m_mapKeyToVariantValue.empty();
89 }
90
91 //++ ------------------------------------------------------------------------------------
92 // Details: Check the ID is valid to be registered.
93 // Type:    Method.
94 // Args:    vId - (R) Unique ID i.e. GUID.
95 // Return:  True - valid.
96 //          False - not valid.
97 // Throws:  None.
98 //--
99 bool
100 CMIUtilMapIdToVariant::IsValid(const CMIUtilString &vId) const
101 {
102     bool bValid = true;
103
104     if (vId.empty())
105         bValid = false;
106
107     return bValid;
108 }
109
110 //++ ------------------------------------------------------------------------------------
111 // Details: Remove from *this contain a data object specified by ID. The data object
112 //          when removed also calls its destructor should it have one.
113 // Type:    Method.
114 // Args:    vId - (R) Unique ID i.e. GUID.
115 // Return:  MIstatus::success - Functional succeeded.
116 //          MIstatus::failure - Functional failed.
117 // Throws:  None.
118 //--
119 bool
120 CMIUtilMapIdToVariant::Remove(const CMIUtilString &vId)
121 {
122     const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find(vId);
123     if (it != m_mapKeyToVariantValue.end())
124     {
125         m_mapKeyToVariantValue.erase(it);
126     }
127
128     return MIstatus::success;
129 }