1 //===-- MICmdArgSet.h -------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
16 // Other libraries and framework includes
18 #include "MICmdArgContext.h"
19 #include "MICmnBase.h"
22 class CMICmdArgValBase;
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
29 // *this class contains a list of the command's arguments which are
30 // validates against the commands argument options string (context
32 // Each argument tries to extract the value it is looking for.
33 // Argument objects added to *this container are owned by this
35 // and are deleted when this container goes out of scope. Allocate
37 // objects on the heap.
38 // It is assumed the arguments to be parsed are read from left to right
40 // order. The order added to *this container is the order they will
43 class CMICmdArgSet : public CMICmnBase {
47 // Description: ArgSet's interface for command arguments to implement.
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;
59 virtual ~IArg() = default;
63 typedef std::vector<CMICmdArgValBase *> SetCmdArgs_t;
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);
80 ~CMICmdArgSet() override;
84 const SetCmdArgs_t &GetArgsNotHandledByCmd() const;
85 void Destroy(); // Release resources used by *this object
86 bool ValidationFormErrorMessages(const CMICmdArgContext &vwCmdArgsText);
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
98 SetCmdArgs_t m_setCmdArgsThatNotValid; // The set of arguments found in the
99 // text but for some reason unable to
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
111 const CMIUtilString m_constStrCommaSpc;