Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 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 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 10 | #ifndef LLDB_INTERPRETER_OPTIONVALUELANGUAGE_H |
| 11 | #define LLDB_INTERPRETER_OPTIONVALUELANGUAGE_H |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 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: |
| 20 | OptionValueLanguage(lldb::LanguageType value) |
| 21 | : OptionValue(), m_current_value(value), m_default_value(value) {} |
| 22 | |
| 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 | |
| 28 | ~OptionValueLanguage() override {} |
| 29 | |
| 30 | // Virtual subclass pure virtual overrides |
| 31 | |
| 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 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 44 | void Clear() override { |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 45 | m_current_value = m_default_value; |
| 46 | m_value_was_set = false; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | lldb::OptionValueSP DeepCopy() const override; |
| 50 | |
| 51 | // Subclass specific functions |
| 52 | |
| 53 | lldb::LanguageType GetCurrentValue() const { return m_current_value; } |
| 54 | |
| 55 | lldb::LanguageType GetDefaultValue() const { return m_default_value; } |
| 56 | |
| 57 | void SetCurrentValue(lldb::LanguageType value) { m_current_value = value; } |
| 58 | |
| 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 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 68 | #endif // LLDB_INTERPRETER_OPTIONVALUELANGUAGE_H |