]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupFormat.h
Import bhyve_graphics into CURRENT. Thanks to all who tested
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Interpreter / OptionGroupFormat.h
1 //===-- OptionGroupFormat.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_OptionGroupFormat_h_
11 #define liblldb_OptionGroupFormat_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Interpreter/Options.h"
18 #include "lldb/Interpreter/OptionValueFormat.h"
19 #include "lldb/Interpreter/OptionValueSInt64.h"
20 #include "lldb/Interpreter/OptionValueUInt64.h"
21
22 namespace lldb_private {
23
24 //-------------------------------------------------------------------------
25 // OptionGroupFormat
26 //-------------------------------------------------------------------------
27
28 class OptionGroupFormat : public OptionGroup
29 {
30 public:
31     static const uint32_t OPTION_GROUP_FORMAT   = LLDB_OPT_SET_1;
32     static const uint32_t OPTION_GROUP_GDB_FMT  = LLDB_OPT_SET_2;
33     static const uint32_t OPTION_GROUP_SIZE     = LLDB_OPT_SET_3;
34     static const uint32_t OPTION_GROUP_COUNT    = LLDB_OPT_SET_4;
35     
36     OptionGroupFormat (lldb::Format default_format, 
37                        uint64_t default_byte_size = UINT64_MAX,  // Pass UINT64_MAX to disable the "--size" option
38                        uint64_t default_count = UINT64_MAX);     // Pass UINT64_MAX to disable the "--count" option
39     
40     ~OptionGroupFormat() override;
41
42     uint32_t
43     GetNumDefinitions() override;
44     
45     const OptionDefinition*
46     GetDefinitions() override;
47     
48     Error
49     SetOptionValue(CommandInterpreter &interpreter,
50                    uint32_t option_idx,
51                    const char *option_value) override;
52     
53     void
54     OptionParsingStarting(CommandInterpreter &interpreter) override;
55     
56     lldb::Format
57     GetFormat () const
58     {
59         return m_format.GetCurrentValue();
60     }
61
62     OptionValueFormat &
63     GetFormatValue()
64     {
65         return m_format;
66     }
67     
68     const OptionValueFormat &
69     GetFormatValue() const
70     {
71         return m_format;
72     }
73     
74     OptionValueUInt64  &
75     GetByteSizeValue()
76     {
77         return m_byte_size;
78     }
79
80     const OptionValueUInt64  &
81     GetByteSizeValue() const 
82     {
83         return m_byte_size;
84     }
85
86     OptionValueUInt64  &
87     GetCountValue()
88     {
89         return m_count;
90     }
91
92     const OptionValueUInt64  &
93     GetCountValue() const
94     {
95         return m_count;
96     }
97     
98     bool
99     HasGDBFormat () const
100     {
101         return m_has_gdb_format;
102     }
103     
104     bool
105     AnyOptionWasSet () const
106     {
107         return m_format.OptionWasSet() ||
108                m_byte_size.OptionWasSet() ||
109                m_count.OptionWasSet();
110     }
111
112 protected:
113     bool
114     ParserGDBFormatLetter (CommandInterpreter &interpreter,
115                            char format_letter,
116                            lldb::Format &format,
117                            uint32_t &byte_size);
118
119     OptionValueFormat m_format;
120     OptionValueUInt64 m_byte_size;
121     OptionValueUInt64 m_count;
122     char m_prev_gdb_format;
123     char m_prev_gdb_size;
124     bool m_has_gdb_format;
125 };
126
127 } // namespace lldb_private
128
129 #endif // liblldb_OptionGroupFormat_h_