OptionGroupPlatform.h revision b170aee2daacc83e3d71c3e3acc9d56c89893a7b
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                               const ArchSpec &arch,
64                               bool make_selected,
65                               Error& error,
66                               ArchSpec &platform_arch) const;
67
68    bool
69    PlatformWasSpecified () const
70    {
71        return !m_platform_name.empty();
72    }
73
74    void
75    SetPlatformName (const char *platform_name)
76    {
77        if (platform_name && platform_name[0])
78            m_platform_name.assign (platform_name);
79        else
80            m_platform_name.clear();
81    }
82
83    const ConstString &
84    GetSDKRootDirectory () const
85    {
86        return m_sdk_sysroot;
87    }
88
89    void
90    SetSDKRootDirectory (const ConstString &sdk_root_directory)
91    {
92        m_sdk_sysroot = sdk_root_directory;
93    }
94
95    const ConstString &
96    GetSDKBuild () const
97    {
98        return m_sdk_build;
99    }
100
101    void
102    SetSDKBuild (const ConstString &sdk_build)
103    {
104        m_sdk_build = sdk_build;
105    }
106
107
108protected:
109    std::string m_platform_name;
110    ConstString m_sdk_sysroot;
111    ConstString m_sdk_build;
112    uint32_t m_os_version_major;
113    uint32_t m_os_version_minor;
114    uint32_t m_os_version_update;
115    bool m_include_platform_option;
116};
117
118} // namespace lldb_private
119
120#endif  // liblldb_OptionGroupPlatform_h_
121