1 //===-- SBTypeNameSpecifier.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/API/SBTypeNameSpecifier.h"
12 #include "lldb/API/SBStream.h"
13 #include "lldb/API/SBType.h"
15 #include "lldb/DataFormatters/DataVisualization.h"
18 using namespace lldb_private;
20 SBTypeNameSpecifier::SBTypeNameSpecifier() :
25 SBTypeNameSpecifier::SBTypeNameSpecifier (const char* name,
27 m_opaque_sp(new TypeNameSpecifierImpl(name, is_regex))
29 if (name == NULL || (*name) == 0)
33 SBTypeNameSpecifier::SBTypeNameSpecifier (SBType type) :
37 m_opaque_sp = TypeNameSpecifierImplSP(new TypeNameSpecifierImpl(type.m_opaque_sp->GetCompilerType(true)));
40 SBTypeNameSpecifier::SBTypeNameSpecifier (const lldb::SBTypeNameSpecifier &rhs) :
41 m_opaque_sp(rhs.m_opaque_sp)
44 SBTypeNameSpecifier::~SBTypeNameSpecifier ()
49 SBTypeNameSpecifier::IsValid() const
51 return m_opaque_sp.get() != NULL;
55 SBTypeNameSpecifier::GetName ()
60 return m_opaque_sp->GetName();
64 SBTypeNameSpecifier::GetType ()
68 lldb_private::CompilerType c_type = m_opaque_sp->GetCompilerType();
70 return SBType(c_type);
75 SBTypeNameSpecifier::IsRegex ()
80 return m_opaque_sp->IsRegex();
84 SBTypeNameSpecifier::GetDescription (lldb::SBStream &description,
85 lldb::DescriptionLevel description_level)
89 description.Printf("SBTypeNameSpecifier(%s,%s)", GetName(), IsRegex() ? "regex" : "plain");
93 lldb::SBTypeNameSpecifier &
94 SBTypeNameSpecifier::operator = (const lldb::SBTypeNameSpecifier &rhs)
98 m_opaque_sp = rhs.m_opaque_sp;
104 SBTypeNameSpecifier::operator == (lldb::SBTypeNameSpecifier &rhs)
106 if (IsValid() == false)
107 return !rhs.IsValid();
108 return m_opaque_sp == rhs.m_opaque_sp;
112 SBTypeNameSpecifier::IsEqualTo (lldb::SBTypeNameSpecifier &rhs)
114 if (IsValid() == false)
115 return !rhs.IsValid();
117 if (IsRegex() != rhs.IsRegex())
119 if (GetName() == NULL || rhs.GetName() == NULL)
122 return (strcmp(GetName(), rhs.GetName()) == 0);
126 SBTypeNameSpecifier::operator != (lldb::SBTypeNameSpecifier &rhs)
128 if (IsValid() == false)
129 return !rhs.IsValid();
130 return m_opaque_sp != rhs.m_opaque_sp;
133 lldb::TypeNameSpecifierImplSP
134 SBTypeNameSpecifier::GetSP ()
140 SBTypeNameSpecifier::SetSP (const lldb::TypeNameSpecifierImplSP &type_namespec_sp)
142 m_opaque_sp = type_namespec_sp;
145 SBTypeNameSpecifier::SBTypeNameSpecifier (const lldb::TypeNameSpecifierImplSP &type_namespec_sp) :
146 m_opaque_sp(type_namespec_sp)