1 //===-- MICmdArgValNumber.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 //===----------------------------------------------------------------------===//
12 #include "MICmdArgValBase.h"
15 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
24 // argument and so extract a value from it .
25 // Based on the Interpreter pattern.
27 class CMICmdArgValNumber : public CMICmdArgValBaseTemplate<MIint64> {
31 // Details: CMICmdArgValNumber needs to know what format of argument to look
33 // the command options text.
35 enum ArgValNumberFormat_e {
36 eArgValNumberFormat_Decimal = (1u << 0),
37 eArgValNumberFormat_Hexadecimal = (1u << 1),
38 eArgValNumberFormat_Auto =
39 ((eArgValNumberFormat_Hexadecimal << 1) -
40 1u) ///< Indicates to try and lookup everything up during a query.
45 /* ctor */ CMICmdArgValNumber();
46 /* ctor */ CMICmdArgValNumber(
47 const CMIUtilString &vrArgName, const bool vbMandatory,
48 const bool vbHandleByCmd,
49 const MIuint vnNumberFormatMask = eArgValNumberFormat_Decimal);
51 bool IsArgNumber(const CMIUtilString &vrTxt) const;
55 // From CMICmdArgValBase
56 /* dtor */ ~CMICmdArgValNumber() override;
57 // From CMICmdArgSet::IArg
58 bool Validate(CMICmdArgContext &vwArgContext) override;
62 bool ExtractNumber(const CMIUtilString &vrTxt);
63 MIint64 GetNumber() const;
67 MIuint m_nNumberFormatMask;