aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Utility/PriorityPointerPair.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Utility/PriorityPointerPair.h')
-rw-r--r--include/lldb/Utility/PriorityPointerPair.h176
1 files changed, 56 insertions, 120 deletions
diff --git a/include/lldb/Utility/PriorityPointerPair.h b/include/lldb/Utility/PriorityPointerPair.h
index 49f0765d0f96..2bd369e78a9a 100644
--- a/include/lldb/Utility/PriorityPointerPair.h
+++ b/include/lldb/Utility/PriorityPointerPair.h
@@ -1,4 +1,5 @@
-//===-- PriorityPointerPair.h ----------------------------------------*- C++ -*-===//
+//===-- PriorityPointerPair.h ----------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,8 +11,8 @@
#ifndef liblldb_PriorityPointerPair_h_
#define liblldb_PriorityPointerPair_h_
-#include "lldb/lldb-public.h"
#include "lldb/Utility/SharingPtr.h"
+#include "lldb/lldb-public.h"
namespace lldb_utility {
@@ -22,127 +23,62 @@ namespace lldb_utility {
// otherwise, low is returned (even if *low == NULL)
//----------------------------------------------------------------------
-template<typename T>
-class PriorityPointerPair
-{
+template <typename T> class PriorityPointerPair {
public:
-
- typedef T& reference_type;
- typedef T* pointer_type;
-
- typedef typename std::shared_ptr<T> T_SP;
-
- PriorityPointerPair() :
- m_high(),
- m_low()
- {}
-
- PriorityPointerPair(pointer_type high,
- pointer_type low) :
- m_high(high),
- m_low(low)
- {}
-
- PriorityPointerPair(pointer_type low) :
- m_high(),
- m_low(low)
- {}
-
- PriorityPointerPair(T_SP& high,
- T_SP& low) :
- m_high(high),
- m_low(low)
- {}
-
- PriorityPointerPair(T_SP& low) :
- m_high(),
- m_low(low)
- {}
-
- void
- SwapLow(pointer_type l)
- {
- m_low.swap(l);
- }
-
- void
- SwapHigh(pointer_type h)
- {
- m_high.swap(h);
- }
-
- void
- SwapLow(T_SP l)
- {
- m_low.swap(l);
- }
-
- void
- SwapHigh(T_SP h)
- {
- m_high.swap(h);
- }
-
- T_SP
- GetLow()
- {
- return m_low;
- }
-
- T_SP
- GetHigh()
- {
- return m_high;
- }
-
- T_SP
- Get()
- {
- if (m_high.get())
- return m_high;
- return m_low;
- }
-
- void
- ResetHigh()
- {
- m_high.reset();
- }
-
- void
- ResetLow()
- {
- m_low.reset();
- }
-
- void
- Reset()
- {
- ResetLow();
- ResetHigh();
- }
-
- reference_type
- operator*() const
- {
- return Get().operator*();
- }
-
- pointer_type
- operator->() const
- {
- return Get().operator->();
- }
-
- ~PriorityPointerPair();
-
+ typedef T &reference_type;
+ typedef T *pointer_type;
+
+ typedef typename std::shared_ptr<T> T_SP;
+
+ PriorityPointerPair() : m_high(), m_low() {}
+
+ PriorityPointerPair(pointer_type high, pointer_type low)
+ : m_high(high), m_low(low) {}
+
+ PriorityPointerPair(pointer_type low) : m_high(), m_low(low) {}
+
+ PriorityPointerPair(T_SP &high, T_SP &low) : m_high(high), m_low(low) {}
+
+ PriorityPointerPair(T_SP &low) : m_high(), m_low(low) {}
+
+ void SwapLow(pointer_type l) { m_low.swap(l); }
+
+ void SwapHigh(pointer_type h) { m_high.swap(h); }
+
+ void SwapLow(T_SP l) { m_low.swap(l); }
+
+ void SwapHigh(T_SP h) { m_high.swap(h); }
+
+ T_SP GetLow() { return m_low; }
+
+ T_SP GetHigh() { return m_high; }
+
+ T_SP Get() {
+ if (m_high.get())
+ return m_high;
+ return m_low;
+ }
+
+ void ResetHigh() { m_high.reset(); }
+
+ void ResetLow() { m_low.reset(); }
+
+ void Reset() {
+ ResetLow();
+ ResetHigh();
+ }
+
+ reference_type operator*() const { return Get().operator*(); }
+
+ pointer_type operator->() const { return Get().operator->(); }
+
+ ~PriorityPointerPair();
+
private:
+ T_SP m_high;
+ T_SP m_low;
- T_SP m_high;
- T_SP m_low;
-
- DISALLOW_COPY_AND_ASSIGN (PriorityPointerPair);
-
+ DISALLOW_COPY_AND_ASSIGN(PriorityPointerPair);
};
} // namespace lldb_utility