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 //===----------------------------------------------------------------------===//
14 #include "MICmdArgContext.h"
15 #include "MICmnBase.h"
18 class CMICmdArgValBase;
21 //============================================================================
22 // Details: MI common code class. Command arguments container class.
23 // A command may have one or more arguments of which some may be
25 // *this class contains a list of the command's arguments which are
26 // validates against the commands argument options string (context
28 // Each argument tries to extract the value it is looking for.
29 // Argument objects added to *this container are owned by this
31 // and are deleted when this container goes out of scope. Allocate
33 // objects on the heap.
34 // It is assumed the arguments to be parsed are read from left to right
36 // order. The order added to *this container is the order they will
39 class CMICmdArgSet : public CMICmnBase {
43 // Description: ArgSet's interface for command arguments to implement.
47 virtual bool GetFound() const = 0;
48 virtual bool GetIsHandledByCmd() const = 0;
49 virtual bool GetIsMandatory() const = 0;
50 virtual bool GetIsMissingOptions() const = 0;
51 virtual const CMIUtilString &GetName() const = 0;
52 virtual bool GetValid() const = 0;
53 virtual bool Validate(CMICmdArgContext &vwArgContext) = 0;
55 virtual ~IArg() = default;
59 typedef std::vector<CMICmdArgValBase *> SetCmdArgs_t;
64 void Add(CMICmdArgValBase *vArg);
65 bool GetArg(const CMIUtilString &vArgName, CMICmdArgValBase *&vpArg) const;
66 const SetCmdArgs_t &GetArgsThatAreMissing() const;
67 const SetCmdArgs_t &GetArgsThatInvalid() const;
68 size_t GetCount() const;
69 bool IsArgContextEmpty() const;
70 bool IsArgsPresentButNotHandledByCmd() const;
71 void WarningArgsNotHandledbyCmdLogFile(const CMIUtilString &vrCmdName);
72 bool Validate(const CMIUtilString &vStrMiCmd,
73 CMICmdArgContext &vwCmdArgsText);
76 ~CMICmdArgSet() override;
80 const SetCmdArgs_t &GetArgsNotHandledByCmd() const;
81 void Destroy(); // Release resources used by *this object
82 bool ValidationFormErrorMessages(const CMICmdArgContext &vwCmdArgsText);
85 bool m_bIsArgsPresentButNotHandledByCmd; // True = The driver's client
86 // presented the command with options
87 // recognised but not handled by
88 // a command, false = all args handled
89 SetCmdArgs_t m_setCmdArgs; // The set of arguments that are that the command
90 // is expecting to find in the options string
91 SetCmdArgs_t m_setCmdArgsThatAreMissing; // The set of arguments that are
92 // required by the command but are
94 SetCmdArgs_t m_setCmdArgsThatNotValid; // The set of arguments found in the
95 // text but for some reason unable to
97 SetCmdArgs_t m_setCmdArgsNotHandledByCmd; // The set of arguments specified by
98 // the command which were present to
99 // the command but not handled
100 SetCmdArgs_t m_setCmdArgsMissingInfo; // The set of arguments that were
101 // present but were found to be missing
102 // additional information i.e.
103 // --thread 3 but 3 is missing
104 CMICmdArgContext m_cmdArgContext; // Copy of the command's argument options
105 // text before validate takes place (empties
107 const CMIUtilString m_constStrCommaSpc;