Home | History | Annotate | Download | only in Interpreter
      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 {
     24 public:
     25     OptionValueArch () :
     26         OptionValue(),
     27         m_current_value (),
     28         m_default_value ()
     29     {
     30     }
     31 
     32     OptionValueArch (const char *triple) :
     33         OptionValue(),
     34         m_current_value (triple),
     35         m_default_value ()
     36     {
     37         m_default_value = m_current_value;
     38     }
     39 
     40     OptionValueArch (const ArchSpec &value) :
     41         OptionValue(),
     42         m_current_value (value),
     43         m_default_value (value)
     44     {
     45     }
     46 
     47     OptionValueArch (const ArchSpec &current_value,
     48                      const ArchSpec &default_value) :
     49         OptionValue(),
     50         m_current_value (current_value),
     51         m_default_value (default_value)
     52     {
     53     }
     54 
     55     virtual
     56     ~OptionValueArch()
     57     {
     58     }
     59 
     60     //---------------------------------------------------------------------
     61     // Virtual subclass pure virtual overrides
     62     //---------------------------------------------------------------------
     63 
     64     virtual OptionValue::Type
     65     GetType () const
     66     {
     67         return eTypeArch;
     68     }
     69 
     70     virtual void
     71     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     72 
     73     virtual Error
     74     SetValueFromCString (const char *value,
     75                          VarSetOperationType op = eVarSetOperationAssign);
     76 
     77     virtual bool
     78     Clear ()
     79     {
     80         m_current_value = m_default_value;
     81         m_value_was_set = false;
     82         return true;
     83     }
     84 
     85     virtual lldb::OptionValueSP
     86     DeepCopy () const;
     87 
     88     virtual size_t
     89     AutoComplete (CommandInterpreter &interpreter,
     90                   const char *s,
     91                   int match_start_point,
     92                   int max_return_elements,
     93                   bool &word_complete,
     94                   StringList &matches);
     95 
     96     //---------------------------------------------------------------------
     97     // Subclass specific functions
     98     //---------------------------------------------------------------------
     99 
    100     ArchSpec &
    101     GetCurrentValue()
    102     {
    103         return m_current_value;
    104     }
    105 
    106     const ArchSpec &
    107     GetCurrentValue() const
    108     {
    109         return m_current_value;
    110     }
    111 
    112     const ArchSpec &
    113     GetDefaultValue() const
    114     {
    115         return m_default_value;
    116     }
    117 
    118     void
    119     SetCurrentValue (const ArchSpec &value, bool set_value_was_set)
    120     {
    121         m_current_value = value;
    122         if (set_value_was_set)
    123             m_value_was_set = true;
    124     }
    125 
    126     void
    127     SetDefaultValue (const ArchSpec &value)
    128     {
    129         m_default_value = value;
    130     }
    131 
    132 protected:
    133     ArchSpec m_current_value;
    134     ArchSpec m_default_value;
    135 };
    136 
    137 } // namespace lldb_private
    138 
    139 #endif  // liblldb_OptionValueArch_h_
    140