]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueArch.h
MFV r325013,r325034: 640 number_to_scaled_string is duplicated in several commands
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Interpreter / OptionValueArch.h
1 //===-- OptionValueArch.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_OptionValueArch_h_
11 #define liblldb_OptionValueArch_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Core/ArchSpec.h"
18 #include "lldb/Interpreter/OptionValue.h"
19
20 namespace lldb_private {
21
22 class OptionValueArch : public OptionValue {
23 public:
24   OptionValueArch() : OptionValue(), m_current_value(), m_default_value() {}
25
26   OptionValueArch(const char *triple)
27       : OptionValue(), m_current_value(triple), m_default_value() {
28     m_default_value = m_current_value;
29   }
30
31   OptionValueArch(const ArchSpec &value)
32       : OptionValue(), m_current_value(value), m_default_value(value) {}
33
34   OptionValueArch(const ArchSpec &current_value, const ArchSpec &default_value)
35       : OptionValue(), m_current_value(current_value),
36         m_default_value(default_value) {}
37
38   ~OptionValueArch() override {}
39
40   //---------------------------------------------------------------------
41   // Virtual subclass pure virtual overrides
42   //---------------------------------------------------------------------
43
44   OptionValue::Type GetType() const override { return eTypeArch; }
45
46   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
47                  uint32_t dump_mask) override;
48
49   Status
50   SetValueFromString(llvm::StringRef value,
51                      VarSetOperationType op = eVarSetOperationAssign) override;
52   Status
53   SetValueFromString(const char *,
54                      VarSetOperationType = eVarSetOperationAssign) = delete;
55
56   bool Clear() override {
57     m_current_value = m_default_value;
58     m_value_was_set = false;
59     return true;
60   }
61
62   lldb::OptionValueSP DeepCopy() const override;
63
64   size_t AutoComplete(CommandInterpreter &interpreter, llvm::StringRef s,
65                       int match_start_point, int max_return_elements,
66                       bool &word_complete, StringList &matches) override;
67
68   //---------------------------------------------------------------------
69   // Subclass specific functions
70   //---------------------------------------------------------------------
71
72   ArchSpec &GetCurrentValue() { return m_current_value; }
73
74   const ArchSpec &GetCurrentValue() const { return m_current_value; }
75
76   const ArchSpec &GetDefaultValue() const { return m_default_value; }
77
78   void SetCurrentValue(const ArchSpec &value, bool set_value_was_set) {
79     m_current_value = value;
80     if (set_value_was_set)
81       m_value_was_set = true;
82   }
83
84   void SetDefaultValue(const ArchSpec &value) { m_default_value = value; }
85
86 protected:
87   ArchSpec m_current_value;
88   ArchSpec m_default_value;
89 };
90
91 } // namespace lldb_private
92
93 #endif // liblldb_OptionValueArch_h_