1 //===-- MICmdArgValNumber.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 //===----------------------------------------------------------------------===//
13 #include "MICmdArgValBase.h"
16 class CMICmdArgContext;
19 //============================================================================
20 // Details: MI common code class. Command argument class. Arguments object
21 // needing specialization derived from the CMICmdArgValBase class.
22 // An argument knows what type of argument it is and how it is to
23 // interpret the options (context) string to find and validate a
25 // argument and so extract a value from it .
26 // Based on the Interpreter pattern.
28 class CMICmdArgValNumber : public CMICmdArgValBaseTemplate<MIint64> {
32 //---------------------------------------------------------------------------------
33 // Details: CMICmdArgValNumber needs to know what format of argument to look
35 // the command options text.
37 enum ArgValNumberFormat_e {
38 eArgValNumberFormat_Decimal = (1u << 0),
39 eArgValNumberFormat_Hexadecimal = (1u << 1),
40 eArgValNumberFormat_Auto =
41 ((eArgValNumberFormat_Hexadecimal << 1) -
42 1u) ///< Indicates to try and lookup everything up during a query.
47 /* ctor */ CMICmdArgValNumber();
48 /* ctor */ CMICmdArgValNumber(
49 const CMIUtilString &vrArgName, const bool vbMandatory,
50 const bool vbHandleByCmd,
51 const MIuint vnNumberFormatMask = eArgValNumberFormat_Decimal);
53 bool IsArgNumber(const CMIUtilString &vrTxt) const;
57 // From CMICmdArgValBase
58 /* dtor */ ~CMICmdArgValNumber() override;
59 // From CMICmdArgSet::IArg
60 bool Validate(CMICmdArgContext &vwArgContext) override;
64 bool ExtractNumber(const CMIUtilString &vrTxt);
65 MIint64 GetNumber() const;
69 MIuint m_nNumberFormatMask;