]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpec.h
Merge ^/head r285924 through r286421.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Interpreter / OptionValueFileSpec.h
1 //===-- OptionValueFileSpec.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_OptionValueFileSpec_h_
11 #define liblldb_OptionValueFileSpec_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Host/FileSpec.h"
18 #include "lldb/Interpreter/OptionValue.h"
19
20 namespace lldb_private {
21
22 class OptionValueFileSpec : public OptionValue
23 {
24 public:
25     OptionValueFileSpec (bool resolve = true);
26     
27     OptionValueFileSpec (const FileSpec &value,
28                          bool resolve = true);
29     
30     OptionValueFileSpec (const FileSpec &current_value, 
31                          const FileSpec &default_value,
32                          bool resolve = true);
33     
34     virtual 
35     ~OptionValueFileSpec()
36     {
37     }
38     
39     //---------------------------------------------------------------------
40     // Virtual subclass pure virtual overrides
41     //---------------------------------------------------------------------
42     
43     virtual OptionValue::Type
44     GetType () const
45     {
46         return eTypeFileSpec;
47     }
48     
49     virtual void
50     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
51     
52     virtual Error
53     SetValueFromString (llvm::StringRef value,
54                          VarSetOperationType op = eVarSetOperationAssign);
55     
56     virtual bool
57     Clear ()
58     {
59         m_current_value = m_default_value;
60         m_value_was_set = false;
61         m_data_sp.reset();
62         m_data_mod_time.Clear();
63         return true;
64     }
65     
66     virtual lldb::OptionValueSP
67     DeepCopy () const;
68
69     virtual size_t
70     AutoComplete (CommandInterpreter &interpreter,
71                   const char *s,
72                   int match_start_point,
73                   int max_return_elements,
74                   bool &word_complete,
75                   StringList &matches);
76     
77     //---------------------------------------------------------------------
78     // Subclass specific functions
79     //---------------------------------------------------------------------
80     
81     FileSpec &
82     GetCurrentValue()
83     {
84         return m_current_value;
85     }
86
87     const FileSpec &
88     GetCurrentValue() const
89     {
90         return m_current_value;
91     }
92
93     const FileSpec &
94     GetDefaultValue() const
95     {
96         return m_default_value;
97     }
98     
99     void
100     SetCurrentValue (const FileSpec &value, bool set_value_was_set)
101     {
102         m_current_value = value;
103         if (set_value_was_set)
104             m_value_was_set = true;
105         m_data_sp.reset();
106     }
107     
108     void
109     SetDefaultValue (const FileSpec &value)
110     {
111         m_default_value = value;
112     }
113     
114     const lldb::DataBufferSP &
115     GetFileContents(bool null_terminate);
116     
117     void
118     SetCompletionMask (uint32_t mask)
119     {
120         m_completion_mask = mask;
121     }
122
123 protected:
124     FileSpec m_current_value;
125     FileSpec m_default_value;
126     lldb::DataBufferSP m_data_sp;
127     TimeValue m_data_mod_time;
128     uint32_t m_completion_mask;
129     bool m_resolve;
130 };
131
132 } // namespace lldb_private
133
134 #endif  // liblldb_OptionValueFileSpec_h_