diff options
Diffstat (limited to 'source/Core/StringList.cpp')
-rw-r--r-- | source/Core/StringList.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
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 <string> @@ -305,12 +307,29 @@ StringList::operator << (const char* str) } StringList& +StringList::operator << (const std::string& str) +{ + AppendString(str); + return *this; +} + +StringList& StringList::operator << (StringList strings) { AppendList(strings); return *this; } +StringList& +StringList::operator = (const std::vector<std::string> &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()); +} |