aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lldb-mi/MIUtilMapIdToVariant.h
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2015-02-06 21:38:51 +0000
committerEd Maste <emaste@FreeBSD.org>2015-02-06 21:38:51 +0000
commit205afe679855a4ce8149cdaa94d3f0868ce796dc (patch)
tree09bc83f73246ee3c7a779605cd0122093d2a8a19 /tools/lldb-mi/MIUtilMapIdToVariant.h
parent0cac4ca3916ac24ab6139d03cbfd18db9e715bfe (diff)
downloadsrc-205afe679855a4ce8149cdaa94d3f0868ce796dc.tar.gz
src-205afe679855a4ce8149cdaa94d3f0868ce796dc.zip
Import LLDB as of upstream SVN r225923 (git 2b588ecd)vendor/lldb/lldb-r225923
This corresponds with the branchpoint for the 3.6 release. A number of files not required for the FreeBSD build have been removed. Sponsored by: DARPA, AFRL
Notes
Notes: svn path=/vendor/lldb/dist/; revision=278332 svn path=/vendor/lldb/lldb-r225923/; revision=278333; tag=vendor/lldb/lldb-r225923
Diffstat (limited to 'tools/lldb-mi/MIUtilMapIdToVariant.h')
-rw-r--r--tools/lldb-mi/MIUtilMapIdToVariant.h216
1 files changed, 108 insertions, 108 deletions
diff --git a/tools/lldb-mi/MIUtilMapIdToVariant.h b/tools/lldb-mi/MIUtilMapIdToVariant.h
index 9570bfa0306f..6a7765d6022c 100644
--- a/tools/lldb-mi/MIUtilMapIdToVariant.h
+++ b/tools/lldb-mi/MIUtilMapIdToVariant.h
@@ -8,15 +8,15 @@
//===----------------------------------------------------------------------===//
//++
-// File: MIUtilMapIdToVariant.h
+// File: MIUtilMapIdToVariant.h
//
-// Overview: CMIUtilMapIdToVariant interface.
+// Overview: CMIUtilMapIdToVariant interface.
//
-// Environment: Compilers: Visual C++ 12.
-// gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-// Libraries: See MIReadmetxt.
+// Environment: Compilers: Visual C++ 12.
+// gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+// Libraries: See MIReadmetxt.
//
-// Copyright: None.
+// Copyright: None.
//--
#pragma once
@@ -27,122 +27,122 @@
// In-house headers:
#include "MICmnBase.h"
#include "MICmnResources.h"
-#include "MIUtilString.h"
+#include "MIUtilString.h"
#include "MIUtilVariant.h"
//++ ============================================================================
-// Details: MI common code utility class. Map type container that hold general
-// object types (by being wrappin an variant wrapper)
-// objects by ID.
-// Gotchas: None.
-// Authors: Illya Rudkin 19/06/2014.
-// Changes: None.
+// Details: MI common code utility class. Map type container that hold general
+// object types (by being wrappin an variant wrapper)
+// objects by ID.
+// Gotchas: None.
+// Authors: Illya Rudkin 19/06/2014.
+// Changes: None.
//--
class CMIUtilMapIdToVariant : public CMICmnBase
{
-// Methods:
-public:
- /* ctor */ CMIUtilMapIdToVariant( void );
-
- template< typename T >
- bool Add( const CMIUtilString & vId, const T & vData );
- void Clear( void );
- template< typename T >
- bool Get( const CMIUtilString & vId, T & vrwData, bool & vrwbFound ) const;
- bool HaveAlready( const CMIUtilString & vId ) const;
- bool IsEmpty( void ) const;
- bool Remove( const CMIUtilString & vId );
-
-// Overridden:
-public:
- // From CMICmnBase
- /* dtor */ virtual ~CMIUtilMapIdToVariant( void );
-
-// Typdefs:
-private:
- typedef std::map< CMIUtilString, CMIUtilVariant > MapKeyToVariantValue_t;
- typedef std::pair< CMIUtilString, CMIUtilVariant > MapPairKeyToVariantValue_t;
-
-// Methods:
-private:
- bool IsValid( const CMIUtilString & vId ) const;
-
-// Attributes:
- MapKeyToVariantValue_t m_mapKeyToVariantValue;
+ // Methods:
+ public:
+ /* ctor */ CMIUtilMapIdToVariant(void);
+
+ template <typename T> bool Add(const CMIUtilString &vId, const T &vData);
+ void Clear(void);
+ template <typename T> bool Get(const CMIUtilString &vId, T &vrwData, bool &vrwbFound) const;
+ bool HaveAlready(const CMIUtilString &vId) const;
+ bool IsEmpty(void) const;
+ bool Remove(const CMIUtilString &vId);
+
+ // Overridden:
+ public:
+ // From CMICmnBase
+ /* dtor */ virtual ~CMIUtilMapIdToVariant(void);
+
+ // Typdefs:
+ private:
+ typedef std::map<CMIUtilString, CMIUtilVariant> MapKeyToVariantValue_t;
+ typedef std::pair<CMIUtilString, CMIUtilVariant> MapPairKeyToVariantValue_t;
+
+ // Methods:
+ private:
+ bool IsValid(const CMIUtilString &vId) const;
+
+ // Attributes:
+ MapKeyToVariantValue_t m_mapKeyToVariantValue;
};
//++ ------------------------------------------------------------------------------------
-// Details: Add to *this container a data object of general type identified by an ID.
-// If the data with that ID already exists in the container it is replace with
-// the new data specified.
-// Type: Method.
-// Args: T - The data object's variable type.
-// vId - (R) Unique ID i.e. GUID.
-// vData - (R) The general data object to be stored of some type.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
+// Details: Add to *this container a data object of general type identified by an ID.
+// If the data with that ID already exists in the container it is replace with
+// the new data specified.
+// Type: Method.
+// Args: T - The data object's variable type.
+// vId - (R) Unique ID i.e. GUID.
+// vData - (R) The general data object to be stored of some type.
+// Return: MIstatus::success - Functional succeeded.
+// MIstatus::failure - Functional failed.
+// Throws: None.
//--
-template< typename T >
-bool CMIUtilMapIdToVariant::Add( const CMIUtilString & vId, const T & vData )
+template <typename T>
+bool
+CMIUtilMapIdToVariant::Add(const CMIUtilString &vId, const T &vData)
{
- if( !IsValid( vId ) )
- {
- SetErrorDescription( CMIUtilString::Format( MIRSRC( IDS_VARIANT_ERR_MAP_KEY_INVALID ), vId.c_str() ) );
- return MIstatus::failure;
- }
-
- const bool bOk = HaveAlready( vId ) ? Remove( vId ) : MIstatus::success;
- if( bOk )
- {
- CMIUtilVariant data;
- data.Set< T >( vData );
- MapPairKeyToVariantValue_t pr( vId, data );
- m_mapKeyToVariantValue.insert( pr );
- }
-
- return bOk;
+ if (!IsValid(vId))
+ {
+ SetErrorDescription(CMIUtilString::Format(MIRSRC(IDS_VARIANT_ERR_MAP_KEY_INVALID), vId.c_str()));
+ return MIstatus::failure;
+ }
+
+ const bool bOk = HaveAlready(vId) ? Remove(vId) : MIstatus::success;
+ if (bOk)
+ {
+ CMIUtilVariant data;
+ data.Set<T>(vData);
+ MapPairKeyToVariantValue_t pr(vId, data);
+ m_mapKeyToVariantValue.insert(pr);
+ }
+
+ return bOk;
}
//++ ------------------------------------------------------------------------------------
-// Details: Retrieve a data object from *this container identified by the specified ID.
-// Type: Method.
-// Args: T - The data object's variable type.
-// vId - (R) Unique ID i.e. GUID.
-// vrwData - (W) Copy of the data object held.
-// vrwbFound - (W) True = data found, false = data not found.
-// Return: MIstatus::success - Functional succeeded.
-// MIstatus::failure - Functional failed.
-// Throws: None.
+// Details: Retrieve a data object from *this container identified by the specified ID.
+// Type: Method.
+// Args: T - The data object's variable type.
+// vId - (R) Unique ID i.e. GUID.
+// vrwData - (W) Copy of the data object held.
+// vrwbFound - (W) True = data found, false = data not found.
+// Return: MIstatus::success - Functional succeeded.
+// MIstatus::failure - Functional failed.
+// Throws: None.
//--
-template< typename T >
-bool CMIUtilMapIdToVariant::Get( const CMIUtilString & vId, T & vrwData, bool & vrwbFound ) const
+template <typename T>
+bool
+CMIUtilMapIdToVariant::Get(const CMIUtilString &vId, T &vrwData, bool &vrwbFound) const
{
- vrwbFound = false;
-
- if( !IsValid( vId ) )
- {
- SetErrorDescription( CMIUtilString::Format( MIRSRC( IDS_VARIANT_ERR_MAP_KEY_INVALID ), vId.c_str() ) );
- return MIstatus::failure;
- }
-
- const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find( vId );
- if( it != m_mapKeyToVariantValue.end() )
- {
- const CMIUtilVariant & rData = (*it).second;
- const T * pDataObj = rData.Get< T >();
- if( pDataObj != nullptr )
- {
- vrwbFound = true;
- vrwData = *pDataObj;
- return MIstatus::success;
- }
- else
- {
- SetErrorDescription( MIRSRC( IDS_VARIANT_ERR_USED_BASECLASS ) );
- return MIstatus::failure;
- }
- }
-
- return MIstatus::success;
+ vrwbFound = false;
+
+ if (!IsValid(vId))
+ {
+ SetErrorDescription(CMIUtilString::Format(MIRSRC(IDS_VARIANT_ERR_MAP_KEY_INVALID), vId.c_str()));
+ return MIstatus::failure;
+ }
+
+ const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find(vId);
+ if (it != m_mapKeyToVariantValue.end())
+ {
+ const CMIUtilVariant &rData = (*it).second;
+ const T *pDataObj = rData.Get<T>();
+ if (pDataObj != nullptr)
+ {
+ vrwbFound = true;
+ vrwData = *pDataObj;
+ return MIstatus::success;
+ }
+ else
+ {
+ SetErrorDescription(MIRSRC(IDS_VARIANT_ERR_USED_BASECLASS));
+ return MIstatus::failure;
+ }
+ }
+
+ return MIstatus::success;
}