]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdArgValNumber.h
Update lldb to upstream trunk r242221.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / MICmdArgValNumber.h
1 //===-- MICmdArgValNumber.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:
16 class 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 and so extract a value from it .
24 //          Based on the Interpreter pattern.
25 // Gotchas: None.
26 // Authors: Illya Rudkin 14/04/2014.
27 // Changes: None.
28 //--
29 class CMICmdArgValNumber : public CMICmdArgValBaseTemplate<MIint64>
30 {
31     // Enums:
32   public:
33     //++ ---------------------------------------------------------------------------------
34     // Details: CMICmdArgValNumber needs to know what format of argument to look for in
35     //          the command options text.
36     //--
37     enum ArgValNumberFormat_e
38     {
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.
42     };
43
44     // Methods:
45   public:
46     /* ctor */ CMICmdArgValNumber(void);
47     /* ctor */ CMICmdArgValNumber(const CMIUtilString &vrArgName, const bool vbMandatory, const bool vbHandleByCmd,
48                                   const MIuint vnNumberFormatMask = eArgValNumberFormat_Decimal);
49     //
50     bool IsArgNumber(const CMIUtilString &vrTxt) const;
51
52     // Overridden:
53   public:
54     // From CMICmdArgValBase
55     /* dtor */ ~CMICmdArgValNumber(void) override;
56     // From CMICmdArgSet::IArg
57     bool Validate(CMICmdArgContext &vwArgContext) override;
58
59     // Methods:
60   private:
61     bool ExtractNumber(const CMIUtilString &vrTxt);
62     MIint64 GetNumber(void) const;
63
64     // Attributes:
65   private:
66     MIuint m_nNumberFormatMask;
67     MIint64 m_nNumber;
68 };