From 9e6d35490a6542f9c97607f93c2ef8ca8e03cbcc Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 6 Jan 2016 20:12:03 +0000 Subject: Vendor import of lldb trunk r256945: https://llvm.org/svn/llvm-project/lldb/trunk@256945 --- source/Core/StringList.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'source/Core/StringList.cpp') diff --git a/source/Core/StringList.cpp b/source/Core/StringList.cpp index 4e07ba4a4579a..ce197ac7bd48e 100644 --- a/source/Core/StringList.cpp +++ b/source/Core/StringList.cpp @@ -11,6 +11,8 @@ #include "lldb/Core/StreamString.h" #include "lldb/Host/FileSpec.h" +#include "lldb/Core/Log.h" +#include "lldb/Core/StreamString.h" #include @@ -304,6 +306,13 @@ StringList::operator << (const char* str) return *this; } +StringList& +StringList::operator << (const std::string& str) +{ + AppendString(str); + return *this; +} + StringList& StringList::operator << (StringList strings) { @@ -311,6 +320,16 @@ StringList::operator << (StringList strings) return *this; } +StringList& +StringList::operator = (const std::vector &rhs) +{ + Clear(); + for (const auto &s : rhs) + m_strings.push_back(s); + + return *this; +} + size_t StringList::AutoComplete (const char *s, StringList &matches, size_t &exact_idx) const { @@ -339,3 +358,21 @@ StringList::AutoComplete (const char *s, StringList &matches, size_t &exact_idx) return matches.GetSize(); } +void +StringList::LogDump(Log *log, const char *name) +{ + if (!log) + return; + + StreamString strm; + if (name) + strm.Printf("Begin %s:\n", name); + for (const auto &s : m_strings) { + strm.Indent(); + strm.Printf("%s\n", s.c_str()); + } + if (name) + strm.Printf("End %s.\n", name); + + log->Debug("%s", strm.GetData()); +} -- cgit v1.2.3