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;
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 and so extract a value from it .
24 // Based on the Interpreter pattern.
26 // Authors: Illya Rudkin 14/04/2014.
29 class CMICmdArgValNumber : public CMICmdArgValBaseTemplate<MIint64>
33 //++ ---------------------------------------------------------------------------------
34 // Details: CMICmdArgValNumber needs to know what format of argument to look for in
35 // the command options text.
37 enum ArgValNumberFormat_e
39 eArgValNumberFormat_Decimal = (1u << 0),
40 eArgValNumberFormat_Hexadecimal = (1u << 1),
41 eArgValNumberFormat_Auto = ((eArgValNumberFormat_Hexadecimal << 1) - 1u) ///< Indicates to try and lookup everything up during a query.
46 /* ctor */ CMICmdArgValNumber(void);
47 /* ctor */ CMICmdArgValNumber(const CMIUtilString &vrArgName, const bool vbMandatory, const bool vbHandleByCmd,
48 const MIuint vnNumberFormatMask = eArgValNumberFormat_Decimal);
50 bool IsArgNumber(const CMIUtilString &vrTxt) const;
54 // From CMICmdArgValBase
55 /* dtor */ ~CMICmdArgValNumber(void) override;
56 // From CMICmdArgSet::IArg
57 bool Validate(CMICmdArgContext &vwArgContext) override;
61 bool ExtractNumber(const CMIUtilString &vrTxt);
62 MIint64 GetNumber(void) const;
66 MIuint m_nNumberFormatMask;