]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/lldb-mi/MICmdArgValString.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / tools / lldb-mi / MICmdArgValString.h
1 //===-- MICmdArgValString.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 //============================================================================
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
24 //          matching
25 //          argument and so extract a value from it .
26 //          Based on the Interpreter pattern.
27 //--
28 class CMICmdArgValString : public CMICmdArgValBaseTemplate<CMIUtilString> {
29   // Methods:
30 public:
31   /* ctor */ CMICmdArgValString();
32   /* ctor */ CMICmdArgValString(const bool vbAnything);
33   /* ctor */ CMICmdArgValString(const bool vbHandleQuotes,
34                                 const bool vbAcceptNumbers,
35                                 const bool vbHandleDirPaths);
36   /* ctor */ CMICmdArgValString(const CMIUtilString &vrArgName,
37                                 const bool vbMandatory,
38                                 const bool vbHandleByCmd,
39                                 const bool vbHandleQuotes = false,
40                                 const bool vbAcceptNumbers = false);
41   /* ctor */ CMICmdArgValString(const CMIUtilString &vrArgName,
42                                 const bool vbMandatory,
43                                 const bool vbHandleByCmd,
44                                 const bool vbHandleQuotes,
45                                 const bool vbAcceptNumbers,
46                                 const bool vbHandleDirPaths);
47   //
48   bool IsStringArg(const CMIUtilString &vrTxt) const;
49
50   // Overridden:
51 public:
52   // From CMICmdArgValBase
53   /* dtor */ ~CMICmdArgValString() override;
54   // From CMICmdArgSet::IArg
55   bool Validate(CMICmdArgContext &vrwArgContext) override;
56
57   // Methods:
58 private:
59   bool ValidateSingleText(CMICmdArgContext &vrwArgContext);
60   bool ValidateQuotedText(CMICmdArgContext &vrwArgContext);
61   bool ValidateQuotedTextEmbedded(CMICmdArgContext &vrwArgContext);
62   bool ValidateQuotedQuotedTextEmbedded(CMICmdArgContext &vrwArgContext);
63   bool IsStringArgSingleText(const CMIUtilString &vrTxt) const;
64   bool IsStringArgQuotedText(const CMIUtilString &vrTxt) const;
65   bool IsStringArgQuotedTextEmbedded(const CMIUtilString &vrTxt) const;
66   bool IsStringArgQuotedQuotedTextEmbedded(const CMIUtilString &vrTxt) const;
67
68   // Attribute:
69 private:
70   bool m_bHandleQuotedString; // True = Parse a string surrounded by quotes
71                               // spaces are not delimiters, false = only text up
72                               // to next
73                               // delimiting space character
74   bool m_bAcceptNumbers;      // True = Parse a string and accept as a number if
75                          // number, false = numbers not recognised as string
76                          // types
77   bool m_bHandleDirPaths; // True = Parse a string and accept directory file
78                           // style string if present, false = directory file
79                           // path not
80                           // accepted
81   bool m_bHandleAnything; // True = Parse a string and accept anything if
82                           // present, false = validate for criteria matches
83 };