• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- OptionValueLanguage.h -------------------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_INTERPRETER_OPTIONVALUELANGUAGE_H
11 #define LLDB_INTERPRETER_OPTIONVALUELANGUAGE_H
12 
13 #include "lldb/Interpreter/OptionValue.h"
14 #include "lldb/lldb-enumerations.h"
15 
16 namespace lldb_private {
17 
18 class OptionValueLanguage : public OptionValue {
19 public:
OptionValueLanguage(lldb::LanguageType value)20   OptionValueLanguage(lldb::LanguageType value)
21       : OptionValue(), m_current_value(value), m_default_value(value) {}
22 
OptionValueLanguage(lldb::LanguageType current_value,lldb::LanguageType default_value)23   OptionValueLanguage(lldb::LanguageType current_value,
24                       lldb::LanguageType default_value)
25       : OptionValue(), m_current_value(current_value),
26         m_default_value(default_value) {}
27 
~OptionValueLanguage()28   ~OptionValueLanguage() override {}
29 
30   // Virtual subclass pure virtual overrides
31 
GetType()32   OptionValue::Type GetType() const override { return eTypeLanguage; }
33 
34   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
35                  uint32_t dump_mask) override;
36 
37   Status
38   SetValueFromString(llvm::StringRef value,
39                      VarSetOperationType op = eVarSetOperationAssign) override;
40   Status
41   SetValueFromString(const char *,
42                      VarSetOperationType = eVarSetOperationAssign) = delete;
43 
Clear()44   void Clear() override {
45     m_current_value = m_default_value;
46     m_value_was_set = false;
47   }
48 
49   lldb::OptionValueSP DeepCopy() const override;
50 
51   // Subclass specific functions
52 
GetCurrentValue()53   lldb::LanguageType GetCurrentValue() const { return m_current_value; }
54 
GetDefaultValue()55   lldb::LanguageType GetDefaultValue() const { return m_default_value; }
56 
SetCurrentValue(lldb::LanguageType value)57   void SetCurrentValue(lldb::LanguageType value) { m_current_value = value; }
58 
SetDefaultValue(lldb::LanguageType value)59   void SetDefaultValue(lldb::LanguageType value) { m_default_value = value; }
60 
61 protected:
62   lldb::LanguageType m_current_value;
63   lldb::LanguageType m_default_value;
64 };
65 
66 } // namespace lldb_private
67 
68 #endif // LLDB_INTERPRETER_OPTIONVALUELANGUAGE_H
69