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