]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdArgValNumber.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdArgValNumber.h
1 //===-- MICmdArgValNumber.h -------------------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8
9 #pragma once
10
11 // In-house headers:
12 #include "MICmdArgValBase.h"
13
14 // Declarations:
15 class CMICmdArgContext;
16
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
23 //          matching
24 //          argument and so extract a value from it .
25 //          Based on the Interpreter pattern.
26 //--
27 class CMICmdArgValNumber : public CMICmdArgValBaseTemplate<MIint64> {
28   // Enums:
29 public:
30   //++
31   // Details: CMICmdArgValNumber needs to know what format of argument to look
32   // for in
33   //          the command options text.
34   //--
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.
41   };
42
43   // Methods:
44 public:
45   /* ctor */ CMICmdArgValNumber();
46   /* ctor */ CMICmdArgValNumber(
47       const CMIUtilString &vrArgName, const bool vbMandatory,
48       const bool vbHandleByCmd,
49       const MIuint vnNumberFormatMask = eArgValNumberFormat_Decimal);
50   //
51   bool IsArgNumber(const CMIUtilString &vrTxt) const;
52
53   // Overridden:
54 public:
55   // From CMICmdArgValBase
56   /* dtor */ ~CMICmdArgValNumber() override;
57   // From CMICmdArgSet::IArg
58   bool Validate(CMICmdArgContext &vwArgContext) override;
59
60   // Methods:
61 private:
62   bool ExtractNumber(const CMIUtilString &vrTxt);
63   MIint64 GetNumber() const;
64
65   // Attributes:
66 private:
67   MIuint m_nNumberFormatMask;
68   MIint64 m_nNumber;
69 };