1 //===-- SBStringList.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/SBStringList.h"
12 #include "lldb/Utility/StringList.h"
15 using namespace lldb_private;
17 SBStringList::SBStringList() : m_opaque_ap() {}
19 SBStringList::SBStringList(const lldb_private::StringList *lldb_strings_ptr)
22 m_opaque_ap.reset(new lldb_private::StringList(*lldb_strings_ptr));
25 SBStringList::SBStringList(const SBStringList &rhs) : m_opaque_ap() {
27 m_opaque_ap.reset(new lldb_private::StringList(*rhs));
30 const SBStringList &SBStringList::operator=(const SBStringList &rhs) {
33 m_opaque_ap.reset(new lldb_private::StringList(*rhs));
40 SBStringList::~SBStringList() {}
42 const lldb_private::StringList *SBStringList::operator->() const {
43 return m_opaque_ap.get();
46 const lldb_private::StringList &SBStringList::operator*() const {
50 bool SBStringList::IsValid() const { return (m_opaque_ap != NULL); }
52 void SBStringList::AppendString(const char *str) {
55 m_opaque_ap->AppendString(str);
57 m_opaque_ap.reset(new lldb_private::StringList(str));
61 void SBStringList::AppendList(const char **strv, int strc) {
62 if ((strv != NULL) && (strc > 0)) {
64 m_opaque_ap->AppendList(strv, strc);
66 m_opaque_ap.reset(new lldb_private::StringList(strv, strc));
70 void SBStringList::AppendList(const SBStringList &strings) {
71 if (strings.IsValid()) {
73 m_opaque_ap.reset(new lldb_private::StringList());
74 m_opaque_ap->AppendList(*(strings.m_opaque_ap));
78 void SBStringList::AppendList(const StringList &strings) {
80 m_opaque_ap.reset(new lldb_private::StringList());
81 m_opaque_ap->AppendList(strings);
84 uint32_t SBStringList::GetSize() const {
86 return m_opaque_ap->GetSize();
91 const char *SBStringList::GetStringAtIndex(size_t idx) {
93 return m_opaque_ap->GetStringAtIndex(idx);
98 const char *SBStringList::GetStringAtIndex(size_t idx) const {
100 return m_opaque_ap->GetStringAtIndex(idx);
105 void SBStringList::Clear() {
107 m_opaque_ap->Clear();