MICmdArgValConsume.h revision 288943
1//===-- MICmdArgValConsume.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// In-house headers:
13#include "MICmdArgValBase.h"
14
15// Declarations:
16class CMICmdArgContext;
17
18//++ ============================================================================
19// Details: MI common code class. Command argument class. Arguments object
20//          needing specialization derived from the CMICmdArgValBase class.
21//          An argument knows what type of argument it is and how it is to
22//          interpret the options (context) string to find and validate a matching
23//          argument. This type having recognised its argument name just consumes
24//          that argument or option (ignores it). This is the so the validation
25//          process can then ask if all arguments or options have been recognised
26//          other an error will occurred "argument not recognised". For example
27//          this can be used to consume the "--" text which is not an argument in
28//          itself. Normally the GetValue() function (in base class) would return
29//          a value for the argument but is not the case for *this argument type
30//          object.
31//          Based on the Interpreter pattern.
32// Gotchas: None.
33// Authors: Illya Rudkin 20/05/2014.
34// Changes: None.
35//--
36class CMICmdArgValConsume : public CMICmdArgValBaseTemplate<CMIUtilString>
37{
38    // Methods:
39  public:
40    /* ctor */ CMICmdArgValConsume(void);
41    /* ctor */ CMICmdArgValConsume(const CMIUtilString &vrArgName, const bool vbMandatory);
42    //
43    bool IsOk(void) const;
44
45    // Overridden:
46  public:
47    // From CMICmdArgValBase
48    /* dtor */ ~CMICmdArgValConsume(void) override;
49    // From CMICmdArgSet::IArg
50    bool Validate(CMICmdArgContext &vwArgContext) override;
51};
52