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