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