Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:50

0001 //===-- OptionValueChar.h ---------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_INTERPRETER_OPTIONVALUECHAR_H
0010 #define LLDB_INTERPRETER_OPTIONVALUECHAR_H
0011 
0012 #include "lldb/Interpreter/OptionValue.h"
0013 
0014 namespace lldb_private {
0015 
0016 class OptionValueChar : public Cloneable<OptionValueChar, OptionValue> {
0017 public:
0018   OptionValueChar(char value)
0019       : m_current_value(value), m_default_value(value) {}
0020 
0021   OptionValueChar(char current_value, char default_value)
0022       : m_current_value(current_value), m_default_value(default_value) {}
0023 
0024   ~OptionValueChar() override = default;
0025 
0026   // Virtual subclass pure virtual overrides
0027 
0028   OptionValue::Type GetType() const override { return eTypeChar; }
0029 
0030   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
0031                  uint32_t dump_mask) override;
0032 
0033   llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override {
0034     return m_current_value;
0035   }
0036 
0037   Status
0038   SetValueFromString(llvm::StringRef value,
0039                      VarSetOperationType op = eVarSetOperationAssign) override;
0040 
0041   void Clear() override {
0042     m_current_value = m_default_value;
0043     m_value_was_set = false;
0044   }
0045 
0046   // Subclass specific functions
0047 
0048   const char &operator=(char c) {
0049     m_current_value = c;
0050     return m_current_value;
0051   }
0052 
0053   char GetCurrentValue() const { return m_current_value; }
0054 
0055   char GetDefaultValue() const { return m_default_value; }
0056 
0057   void SetCurrentValue(char value) { m_current_value = value; }
0058 
0059   void SetDefaultValue(char value) { m_default_value = value; }
0060 
0061 protected:
0062   char m_current_value;
0063   char m_default_value;
0064 };
0065 
0066 } // namespace lldb_private
0067 
0068 #endif // LLDB_INTERPRETER_OPTIONVALUECHAR_H