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