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