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