]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdArgValListBase.h
Update libucl to latest git snapshot (20151027)
[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 #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 // Gotchas: None.
35 // Authors: Illya Rudkin 16/04/2014.
36 // Changes: None.
37 //--
38 class CMICmdArgValListBase : public CMICmdArgValBaseTemplate<std::vector<CMICmdArgValBase *>>
39 {
40     // Typedef:
41   public:
42     typedef std::vector<CMICmdArgValBase *> VecArgObjPtr_t;
43
44     // Enums:
45   public:
46     //++ ---------------------------------------------------------------------------------
47     // Details: CMICmdArgValListBase needs to know what type of argument to look for in
48     //          the command options text. It also needs to create argument objects of
49     //          a specific type.
50     //--
51     enum ArgValType_e
52     {
53         eArgValType_File = 0,
54         eArgValType_Consume,
55         eArgValType_Number,
56         eArgValType_OptionLong,
57         eArgValType_OptionShort,
58         eArgValType_String,
59         eArgValType_StringQuoted,
60         eArgValType_StringQuotedNumber,
61         eArgValType_StringQuotedNumberPath,
62         eArgValType_StringAnything, // Accept any words for a string 'type' even if they look like --longOptions for example
63         eArgValType_ThreadGrp,
64         eArgValType_count, // Always the last one
65         eArgValType_invalid
66     };
67
68     // Methods:
69   public:
70     /* ctor */ CMICmdArgValListBase(void);
71     /* ctor */ CMICmdArgValListBase(const CMIUtilString &vrArgName, const bool vbMandatory, const bool vbHandleByCmd);
72     /* ctor */ CMICmdArgValListBase(const CMIUtilString &vrArgName, const bool vbMandatory, const bool vbHandleByCmd,
73                                     const ArgValType_e veType);
74
75     // Overridden:
76   public:
77     // From CMICmdArgValBase
78     /* dtor */ ~CMICmdArgValListBase(void) override;
79
80     // Methods:
81   protected:
82     bool IsExpectedCorrectType(const CMIUtilString &vrTxt, const ArgValType_e veType) const;
83     CMICmdArgValBase *CreationObj(const CMIUtilString &vrTxt, const ArgValType_e veType) const;
84
85     // Attributes:
86   protected:
87     ArgValType_e m_eArgType;
88
89     // Methods:
90   private:
91     void Destroy(void);
92 };