1 //===-- MICmdArgValListBase.h -----------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 // Third party headers:
15 #include "MICmdArgValBase.h"
18 class CMICmdArgContext;
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
27 // the command arguments text string.
28 // An argument knows what type of argument it is and how it is to
29 // interpret the options (context) string to find and validate a
31 // options and so extract a values from it .
32 // The CMICmdArgValBase objects are added to the derived argument
34 // container. The option arguments belong to that derived class and
36 // be deleted that object goes out of scope.
37 // Based on the Interpreter pattern.
39 class CMICmdArgValListBase
40 : public CMICmdArgValBaseTemplate<std::vector<CMICmdArgValBase *>> {
43 typedef std::vector<CMICmdArgValBase *> VecArgObjPtr_t;
48 // Details: CMICmdArgValListBase needs to know what type of argument to look
50 // the command options text. It also needs to create argument objects
58 eArgValType_OptionLong,
59 eArgValType_OptionShort,
61 eArgValType_StringQuoted,
62 eArgValType_StringQuotedNumber,
63 eArgValType_StringQuotedNumberPath,
64 eArgValType_StringAnything, // Accept any words for a string 'type' even if
65 // they look like --longOptions for example
66 eArgValType_ThreadGrp,
67 eArgValType_count, // Always the last one
73 /* ctor */ CMICmdArgValListBase();
74 /* ctor */ CMICmdArgValListBase(const CMIUtilString &vrArgName,
75 const bool vbMandatory,
76 const bool vbHandleByCmd);
77 /* ctor */ CMICmdArgValListBase(const CMIUtilString &vrArgName,
78 const bool vbMandatory,
79 const bool vbHandleByCmd,
80 const ArgValType_e veType);
84 // From CMICmdArgValBase
85 /* dtor */ ~CMICmdArgValListBase() override;
89 bool IsExpectedCorrectType(const CMIUtilString &vrTxt,
90 const ArgValType_e veType) const;
91 CMICmdArgValBase *CreationObj(const CMIUtilString &vrTxt,
92 const ArgValType_e veType) const;
96 ArgValType_e m_eArgType;