xref: /llvm-project/lldb/source/Commands/CommandObjectPlatform.h (revision f6b8b581846b3d7a0853d89f54b4ac9f94ff5a0e)
1 //===-- CommandObjectPlatform.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_CommandObjectPlatform_h_
11 #define liblldb_CommandObjectPlatform_h_
12 
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Interpreter/CommandObjectMultiword.h"
18 #include "lldb/Interpreter/Options.h"
19 
20 namespace lldb_private {
21 
22 //-------------------------------------------------------------------------
23 // CommandObjectPlatform
24 //-------------------------------------------------------------------------
25 
26 class CommandObjectPlatform : public CommandObjectMultiword
27 {
28 public:
29     CommandObjectPlatform(CommandInterpreter &interpreter);
30 
31     virtual
32     ~CommandObjectPlatform();
33 
34     private:
35     DISALLOW_COPY_AND_ASSIGN (CommandObjectPlatform);
36 };
37 
38 
39 //-------------------------------------------------------------------------
40 // PlatformOptionGroup
41 //
42 // Make platform options available to to any other command in case they
43 // need them. The "file" command needs them, and by exposing them we can
44 // reuse the platform command options for any command, we can keep things
45 // consistent.
46 //-------------------------------------------------------------------------
47 class PlatformOptionGroup : public OptionGroup
48 {
49 public:
50 
51     PlatformOptionGroup (bool include_platform_option) :
52         m_include_platform_option (include_platform_option),
53         platform_sp (),
54         os_version_major (UINT32_MAX),
55         os_version_minor (UINT32_MAX),
56         os_version_update (UINT32_MAX)
57     {
58     }
59 
60     virtual
61     ~PlatformOptionGroup ()
62     {
63     }
64 
65     virtual uint32_t
66     GetNumDefinitions ();
67 
68     virtual const OptionDefinition*
69     GetDefinitions ();
70 
71     virtual Error
72     SetOptionValue (CommandInterpreter &interpreter,
73                     uint32_t option_idx,
74                     const char *option_value);
75 
76     lldb::PlatformSP
77     CreatePlatformWithOptions (CommandInterpreter &interpreter,
78                                const char *platform_name,
79                                bool select,
80                                Error& error);
81 
82     virtual void
83     OptionParsingStarting (CommandInterpreter &interpreter);
84 
85     // Instance variables to hold the values for command options.
86 
87     lldb::PlatformSP platform_sp;
88     uint32_t os_version_major;
89     uint32_t os_version_minor;
90     uint32_t os_version_update;
91 protected:
92     bool m_include_platform_option;
93 };
94 
95 
96 
97 } // namespace lldb_private
98 
99 #endif  // liblldb_CommandObjectPlatform_h_
100