]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Host/OptionParser.h
Update LLDB snapshot to upstream r216948 (git 50f7fe44)
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Host / OptionParser.h
1 //===-- OptionParser.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_OptionParser_h_
11 #define liblldb_OptionParser_h_
12
13 #include <string>
14
15 struct option;
16
17 namespace lldb_private {
18
19 struct OptionDefinition;
20
21 struct Option
22 {
23     // The definition of the option that this refers to.
24     const OptionDefinition *definition;
25     // if not NULL, set *flag to val when option found
26     int *flag;
27     // if flag not NULL, value to set *flag to; else return value
28     int val;
29 };
30
31 class OptionParser
32 {
33 public:
34     enum OptionArgument
35     {
36         eNoArgument = 0,
37         eRequiredArgument,
38         eOptionalArgument
39     };
40
41     static void Prepare();
42
43     static void EnableError(bool error);
44
45     static int Parse(int argc, char * const argv [],
46         const char *optstring,
47         const Option *longopts, int *longindex);
48
49     static char* GetOptionArgument();
50     static int GetOptionIndex();
51     static int GetOptionErrorCause();
52     static std::string GetShortOptionString(struct option *long_options);
53 };
54
55 }
56
57 #endif  // liblldb_OptionParser_h_