]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdArgSet.h
Update LLDB snapshot to upstream r225923 (git 2b588ecd)
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdArgSet.h
1 //===-- MICmdArgSet.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:        MICmdArgSet.h
12 //
13 // Overview:    CMICmdArgSet 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 "MICmnBase.h"
29 #include "MICmdArgContext.h"
30
31 // Declarations:
32 class CMICmdArgValBase;
33
34 //++ ============================================================================
35 // Details: MI common code class. Command arguments container class.
36 //          A command may have one or more arguments of which some may be optional.
37 //          *this class contains a list of the command's arguments which are
38 //          validates against the commands argument options string (context string).
39 //          Each argument tries to extract the value it is looking for.
40 //          Argument objects added to *this container are owned by this container
41 //          and are deleted when this container goes out of scope. Allocate argument
42 //          objects on the heap.
43 //          It is assummed the arguments to be parsed are read from left to right in
44 //          order. The order added to *this container is the order they will parsed.
45 // Gotchas: None.
46 // Authors: Illya Rudkin 14/04/2014.
47 // Changes: None.
48 //--
49 class CMICmdArgSet : public CMICmnBase
50 {
51     // Classes:
52   public:
53     //++
54     // Description: ArgSet's interface for command arguments to implement.
55     //--
56     class IArg
57     {
58       public:
59         virtual bool GetFound(void) const = 0;
60         virtual bool GetIsHandledByCmd(void) const = 0;
61         virtual bool GetIsMandatory(void) const = 0;
62         virtual bool GetIsMissingOptions(void) const = 0;
63         virtual const CMIUtilString &GetName(void) const = 0;
64         virtual bool GetValid(void) const = 0;
65         virtual bool Validate(CMICmdArgContext &vwArgContext) = 0;
66
67         /* dtor */ virtual ~IArg(void){};
68     };
69
70     // Typedefs:
71   public:
72     typedef std::vector<CMICmdArgValBase *> SetCmdArgs_t;
73
74     // Methods:
75   public:
76     /* ctor */ CMICmdArgSet(void);
77
78     bool Add(const CMICmdArgValBase &vArg);
79     bool GetArg(const CMIUtilString &vArgName, CMICmdArgValBase *&vpArg) const;
80     const SetCmdArgs_t &GetArgsThatAreMissing(void) const;
81     const SetCmdArgs_t &GetArgsThatInvalid(void) const;
82     MIuint GetCount(void) const;
83     bool IsArgContextEmpty(void) const;
84     bool IsArgsPresentButNotHandledByCmd(void) const;
85     void WarningArgsNotHandledbyCmdLogFile(const CMIUtilString &vrCmdName);
86     bool Validate(const CMIUtilString &vStrMiCmd, CMICmdArgContext &vwCmdArgsText);
87
88     // Overrideable:
89   public:
90     /* dtor */ virtual ~CMICmdArgSet(void);
91
92     // Methods:
93   private:
94     const SetCmdArgs_t &GetArgsNotHandledByCmd(void) const;
95     void
96     Destroy(void); // Release resources used by *this object
97     bool ValidationFormErrorMessages(const CMICmdArgContext &vwCmdArgsText);
98
99     // Attributes:
100   private:
101     bool m_bIsArgsPresentButNotHandledByCmd; // True = The driver's client presented the command with options recognised but not handled by
102                                              // a command, false = all args handled
103     SetCmdArgs_t m_setCmdArgs;               // The set of arguments that are that the command is expecting to find in the options string
104     SetCmdArgs_t m_setCmdArgsThatAreMissing; // The set of arguments that are required by the command but are missing
105     SetCmdArgs_t m_setCmdArgsThatNotValid;   // The set of arguments found in the text but for some reason unable to extract a value
106     SetCmdArgs_t
107         m_setCmdArgsNotHandledByCmd;      // The set of arguments specified by the command which were present to the command but not handled
108     SetCmdArgs_t m_setCmdArgsMissingInfo; // The set of arguments that were present but were found to be missing additional information i.e.
109                                           // --thread 3 but 3 is missing
110     CMICmdArgContext m_cmdArgContext;     // Copy of the command's argument options text before validate takes place (empties it of content)
111     const CMIUtilString m_constStrCommaSpc;
112 };