OptionGroupPlatform.h revision 3e8c25f62f92145b6fb699b379cbfe72b1245d4a
1//===-- OptionGroupPlatform.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_OptionGroupPlatform_h_
11#define liblldb_OptionGroupPlatform_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17#include "lldb/Core/ConstString.h"
18#include "lldb/Interpreter/Options.h"
19
20namespace lldb_private {
21
22//-------------------------------------------------------------------------
23// PlatformOptionGroup
24//
25// Make platform options available to any commands that need the settings.
26//-------------------------------------------------------------------------
27class OptionGroupPlatform : public OptionGroup
28{
29public:
30
31    OptionGroupPlatform (bool include_platform_option) :
32        OptionGroup(),
33        m_platform_name (),
34        m_sdk_sysroot (),
35        m_os_version_major (UINT32_MAX),
36        m_os_version_minor (UINT32_MAX),
37        m_os_version_update (UINT32_MAX),
38        m_include_platform_option (include_platform_option)
39    {
40    }
41
42    virtual
43    ~OptionGroupPlatform ()
44    {
45    }
46
47    virtual uint32_t
48    GetNumDefinitions ();
49
50    virtual const OptionDefinition*
51    GetDefinitions ();
52
53    virtual Error
54    SetOptionValue (CommandInterpreter &interpreter,
55                    uint32_t option_idx,
56                    const char *option_value);
57
58    virtual void
59    OptionParsingStarting (CommandInterpreter &interpreter);
60
61    lldb::PlatformSP
62    CreatePlatformWithOptions (CommandInterpreter &interpreter,
63                               bool make_selected,
64                               Error& error) const;
65
66    bool
67    PlatformWasSpecified () const
68    {
69        return !m_platform_name.empty();
70    }
71
72    void
73    SetPlatformName (const char *platform_name)
74    {
75        if (platform_name && platform_name[0])
76            m_platform_name.assign (platform_name);
77        else
78            m_platform_name.clear();
79    }
80
81    const ConstString &
82    GetSDKRootDirectory () const
83    {
84        return m_sdk_sysroot;
85    }
86
87    void
88    SetSDKRootDirectory (const ConstString &sdk_root_directory)
89    {
90        m_sdk_sysroot = sdk_root_directory;
91    }
92
93    const ConstString &
94    GetSDKBuild () const
95    {
96        return m_sdk_build;
97    }
98
99    void
100    SetSDKBuild (const ConstString &sdk_build)
101    {
102        m_sdk_build = sdk_build;
103    }
104
105
106protected:
107    std::string m_platform_name;
108    ConstString m_sdk_sysroot;
109    ConstString m_sdk_build;
110    uint32_t m_os_version_major;
111    uint32_t m_os_version_minor;
112    uint32_t m_os_version_update;
113    bool m_include_platform_option;
114};
115
116} // namespace lldb_private
117
118#endif  // liblldb_OptionGroupPlatform_h_
119