]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdArgValBase.cpp
MFV r316693:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdArgValBase.cpp
1 //===-- MICmdArgValBase.cpp -------------------------------------*- 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 // C Includes
11 // C++ Includes
12 // Other libraries and framework includes
13 // Project includes
14 #include "MICmdArgValBase.h"
15 #include "MICmdArgContext.h"
16 #include "MIUtilString.h"
17
18 //++
19 //------------------------------------------------------------------------------------
20 // Details: CMICmdArgValBase constructor.
21 // Type:    Method.
22 // Args:    None.
23 // Return:  None.
24 // Throws:  None.
25 //--
26 CMICmdArgValBase::CMICmdArgValBase()
27     : m_bFound(false), m_bValid(false), m_bMandatory(false), m_bHandled(false),
28       m_bIsMissingOptions(false) {}
29
30 //++
31 //------------------------------------------------------------------------------------
32 // Details: CMICmdArgValBase constructor.
33 // Type:    Method.
34 // Args:    vrArgName       - (R) Argument's name to search by.
35 //          vbMandatory     - (R) True = Yes must be present, false = optional
36 //          argument.
37 //          vbHandleByCmd   - (R) True = Command processes *this option, false =
38 //          not handled.
39 // Return:  None.
40 // Throws:  None.
41 //--
42 CMICmdArgValBase::CMICmdArgValBase(const CMIUtilString &vrArgName,
43                                    const bool vbMandatory,
44                                    const bool vbHandleByCmd)
45     : m_bFound(false), m_bValid(false), m_bMandatory(vbMandatory),
46       m_strArgName(vrArgName), m_bHandled(vbHandleByCmd),
47       m_bIsMissingOptions(false) {}
48
49 //++
50 //------------------------------------------------------------------------------------
51 // Details: Retrieve the state flag of whether the argument is handled by the
52 // command or
53 //          not.
54 // Type:    Method.
55 // Args:    None.
56 // Return:  True - Command needs more information.
57 //          False - All information is present as expected.
58 // Throws:  None.
59 //--
60 bool CMICmdArgValBase::GetIsMissingOptions() const {
61   return m_bIsMissingOptions;
62 }
63
64 //++
65 //------------------------------------------------------------------------------------
66 // Details: Retrieve the state flag of whether the argument is handled by the
67 // command or
68 //          not.
69 // Type:    Method.
70 // Args:    None.
71 // Return:  True - Command handles *this argument or option.
72 //          False - Not handled (argument specified but ignored).
73 // Throws:  None.
74 //--
75 bool CMICmdArgValBase::GetIsHandledByCmd() const { return m_bHandled; }
76
77 //++
78 //------------------------------------------------------------------------------------
79 // Details: Retrieve the name of *this argument.
80 // Type:    Method.
81 // Args:    None.
82 // Return:  CMIUtilString & - Return the text name.
83 // Throws:  None.
84 //--
85 const CMIUtilString &CMICmdArgValBase::GetName() const { return m_strArgName; }
86
87 //++
88 //------------------------------------------------------------------------------------
89 // Details: Retrieve the state flag of whether the argument was found in the
90 // command's
91 //          argument / options string.
92 // Type:    Method.
93 // Args:    None.
94 // Return:  True - Argument found.
95 //          False - Argument not found.
96 // Throws:  None.
97 //--
98 bool CMICmdArgValBase::GetFound() const { return m_bFound; }
99
100 //++
101 //------------------------------------------------------------------------------------
102 // Details: Retrieve the state flag indicating whether the value was obtained
103 // from the
104 //          text arguments string and is valid.
105 // Type:    Method.
106 // Args:    None.
107 // Return:  True - Argument valid.
108 //          False - Argument not valid.
109 // Throws:  None.
110 //--
111 bool CMICmdArgValBase::GetValid() const { return m_bValid; }
112
113 //++
114 //------------------------------------------------------------------------------------
115 // Details: Retrieve the state flag indicating whether *this argument is a
116 // mandatory
117 //          argument for the command or is optional to be present.
118 // Type:    Method.
119 // Args:    None.
120 // Return:  True - Mandatory.
121 //          False - Optional.
122 // Throws:  None.
123 //--
124 bool CMICmdArgValBase::GetIsMandatory() const { return m_bMandatory; }
125
126 //++
127 //------------------------------------------------------------------------------------
128 // Details: Parse the command's argument options string and try to extract the
129 // value *this
130 //          argument is looking for.
131 // Type:    Overrideable.
132 // Args:    vArgContext - (RW) The command's argument options string.
133 // Return:  MIstatus::success - Functional succeeded.
134 //          MIstatus::failure - Functional failed.
135 // Throws:  None.
136 //--
137 bool CMICmdArgValBase::Validate(CMICmdArgContext &vwArgContext) {
138   MIunused(vwArgContext);
139
140   // Override to implement
141
142   return MIstatus::failure;
143 }