1 //===-- SBTypeFormat.cpp ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/lldb-python.h"
12 #include "lldb/API/SBTypeFormat.h"
14 #include "lldb/API/SBStream.h"
16 #include "lldb/DataFormatters/DataVisualization.h"
19 using namespace lldb_private;
21 SBTypeFormat::SBTypeFormat() :
26 SBTypeFormat::SBTypeFormat (lldb::Format format,
28 : m_opaque_sp(TypeFormatImplSP(new TypeFormatImpl(format,options)))
32 SBTypeFormat::SBTypeFormat (const lldb::SBTypeFormat &rhs) :
33 m_opaque_sp(rhs.m_opaque_sp)
37 SBTypeFormat::~SBTypeFormat ()
42 SBTypeFormat::IsValid() const
44 return m_opaque_sp.get() != NULL;
48 SBTypeFormat::GetFormat ()
51 return m_opaque_sp->GetFormat();
52 return lldb::eFormatInvalid;
56 SBTypeFormat::GetOptions()
59 return m_opaque_sp->GetOptions();
64 SBTypeFormat::SetFormat (lldb::Format fmt)
66 if (CopyOnWrite_Impl())
67 m_opaque_sp->SetFormat(fmt);
71 SBTypeFormat::SetOptions (uint32_t value)
73 if (CopyOnWrite_Impl())
74 m_opaque_sp->SetOptions(value);
78 SBTypeFormat::GetDescription (lldb::SBStream &description,
79 lldb::DescriptionLevel description_level)
84 description.Printf("%s\n",
85 m_opaque_sp->GetDescription().c_str());
91 SBTypeFormat::operator = (const lldb::SBTypeFormat &rhs)
95 m_opaque_sp = rhs.m_opaque_sp;
101 SBTypeFormat::operator == (lldb::SBTypeFormat &rhs)
103 if (IsValid() == false)
104 return !rhs.IsValid();
105 return m_opaque_sp == rhs.m_opaque_sp;
109 SBTypeFormat::IsEqualTo (lldb::SBTypeFormat &rhs)
111 if (IsValid() == false)
112 return !rhs.IsValid();
114 if (GetFormat() == rhs.GetFormat())
115 return GetOptions() == rhs.GetOptions();
121 SBTypeFormat::operator != (lldb::SBTypeFormat &rhs)
123 if (IsValid() == false)
124 return !rhs.IsValid();
125 return m_opaque_sp != rhs.m_opaque_sp;
128 lldb::TypeFormatImplSP
129 SBTypeFormat::GetSP ()
135 SBTypeFormat::SetSP (const lldb::TypeFormatImplSP &typeformat_impl_sp)
137 m_opaque_sp = typeformat_impl_sp;
140 SBTypeFormat::SBTypeFormat (const lldb::TypeFormatImplSP &typeformat_impl_sp) :
141 m_opaque_sp(typeformat_impl_sp)
146 SBTypeFormat::CopyOnWrite_Impl()
150 if (m_opaque_sp.unique())
153 SetSP(TypeFormatImplSP(new TypeFormatImpl(GetFormat(),GetOptions())));