]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/llvm/tools/lldb/include/lldb/Core/StringList.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / llvm / tools / lldb / include / lldb / Core / StringList.h
1 //===-- StringList.h --------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_StringList_h_
11 #define liblldb_StringList_h_
12
13 #include <stdint.h>
14
15 #include "lldb/Core/STLUtils.h"
16 #include "lldb/lldb-forward.h"
17
18 namespace lldb_private {
19
20 class StringList
21 {
22 public:
23
24     StringList ();
25
26     StringList (const char *str);
27
28     StringList (const char **strv, int strc);
29     
30     virtual
31     ~StringList ();
32
33     void
34     AppendString (const std::string &s);
35     
36     void
37     AppendString (const char *str);
38
39     void
40     AppendString (const char *str, size_t str_len);
41
42     void
43     AppendList (const char ** strv, int strc);
44
45     void
46     AppendList (StringList strings);
47
48     bool
49     ReadFileLines (FileSpec &input_file);
50     
51     size_t
52     GetSize () const;
53
54     const char *
55     GetStringAtIndex (size_t idx) const;
56
57     void
58     Join (const char *separator, Stream &strm);
59
60     void
61     Clear ();
62
63     void
64     LongestCommonPrefix (std::string &common_prefix);
65
66     void
67     InsertStringAtIndex (size_t id, const char *str);
68
69     void
70     DeleteStringAtIndex (size_t id);
71
72     void
73     RemoveBlankLines ();
74
75     size_t
76     SplitIntoLines (const char *lines, size_t len);
77     
78     std::string
79     CopyList(const char* item_preamble = NULL,
80              const char* items_sep = "\n");
81     
82     StringList&
83     operator << (const char* str);
84
85     StringList&
86     operator << (StringList strings);
87     
88     // This string list contains a list of valid auto completion
89     // strings, and the "s" is passed in. "matches" is filled in
90     // with zero or more string values that start with "s", and
91     // the first string to exactly match one of the string
92     // values in this collection, will have "exact_matches_idx"
93     // filled in to match the index, or "exact_matches_idx" will
94     // have SIZE_MAX
95     size_t
96     AutoComplete (const char *s,
97                   StringList &matches,
98                   size_t &exact_matches_idx) const;
99
100 private:
101
102     STLStringArray m_strings;
103 };
104
105 } // namespace lldb_private
106
107 #endif // liblldb_StringList_h_