]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdArgValListBase.h
Merge lldb trunk r366426, resolve conflicts, and update FREEBSD-Xlist.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdArgValListBase.h
1 //===-- MICmdArgValListBase.h -----------------------------------*- 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 #pragma once
10
11 // Third party headers:
12 #include <vector>
13
14 // In-house headers:
15 #include "MICmdArgValBase.h"
16
17 // Declarations:
18 class CMICmdArgContext;
19
20 //++
21 //============================================================================
22 // Details: MI common code class. Command argument with addition options class.
23 //          For example --recurse 1 2 4 [group ...]. Arguments object that
24 //          require a list of options associated with them derive from the
25 //          CMICmdArgValListBase class. Additional options are also extracted
26 //          from
27 //          the command arguments text string.
28 //          An argument knows what type of argument it is and how it is to
29 //          interpret the options (context) string to find and validate a
30 //          matching
31 //          options and so extract a values from it .
32 //          The CMICmdArgValBase objects are added to the derived argument
33 //          class's
34 //          container. The option arguments belong to that derived class and
35 //          will
36 //          be deleted that object goes out of scope.
37 //          Based on the Interpreter pattern.
38 //--
39 class CMICmdArgValListBase
40     : public CMICmdArgValBaseTemplate<std::vector<CMICmdArgValBase *>> {
41   // Typedef:
42 public:
43   typedef std::vector<CMICmdArgValBase *> VecArgObjPtr_t;
44
45   // Enums:
46 public:
47   //++
48   // Details: CMICmdArgValListBase needs to know what type of argument to look
49   // for in
50   //          the command options text. It also needs to create argument objects
51   //          of
52   //          a specific type.
53   //--
54   enum ArgValType_e {
55     eArgValType_File = 0,
56     eArgValType_Consume,
57     eArgValType_Number,
58     eArgValType_OptionLong,
59     eArgValType_OptionShort,
60     eArgValType_String,
61     eArgValType_StringQuoted,
62     eArgValType_StringQuotedNumber,
63     eArgValType_StringQuotedNumberPath,
64     eArgValType_StringAnything, // Accept any words for a string 'type' even if
65                                 // they look like --longOptions for example
66     eArgValType_ThreadGrp,
67     eArgValType_count, // Always the last one
68     eArgValType_invalid
69   };
70
71   // Methods:
72 public:
73   /* ctor */ CMICmdArgValListBase();
74   /* ctor */ CMICmdArgValListBase(const CMIUtilString &vrArgName,
75                                   const bool vbMandatory,
76                                   const bool vbHandleByCmd);
77   /* ctor */ CMICmdArgValListBase(const CMIUtilString &vrArgName,
78                                   const bool vbMandatory,
79                                   const bool vbHandleByCmd,
80                                   const ArgValType_e veType);
81
82   // Overridden:
83 public:
84   // From CMICmdArgValBase
85   /* dtor */ ~CMICmdArgValListBase() override;
86
87   // Methods:
88 protected:
89   bool IsExpectedCorrectType(const CMIUtilString &vrTxt,
90                              const ArgValType_e veType) const;
91   CMICmdArgValBase *CreationObj(const CMIUtilString &vrTxt,
92                                 const ArgValType_e veType) const;
93
94   // Attributes:
95 protected:
96   ArgValType_e m_eArgType;
97
98   // Methods:
99 private:
100   void Destroy();
101 };