]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/MICmdArgValString.h
Merge ^/head r275118 through r275209.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / 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 //++
11 // File:                MICmdArgValString.h
12 //
13 // Overview:    CMICmdArgValString interface.
14 //
15 // Environment: Compilers:      Visual C++ 12.
16 //                                                      gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
17 //                              Libraries:      See MIReadmetxt. 
18 //
19 // Copyright:   None.
20 //--
21
22 #pragma once
23
24 // In-house headers:
25 #include "MICmdArgValBase.h"
26
27 // Declarations:
28 class CMICmdArgContext;
29
30 //++ ============================================================================
31 // Details:     MI common code class. Command argument class. Arguments object
32 //                      needing specialization derived from the CMICmdArgValBase class. 
33 //                      An argument knows what type of argument it is and how it is to 
34 //                      interpret the options (context) string to find and validate a matching 
35 //                      argument and so extract a value from it .
36 //                      Based on the Interpreter pattern.
37 // Gotchas:     None.
38 // Authors:     Illya Rudkin 15/04/2014.
39 // Changes:     None.
40 //--
41 class CMICmdArgValString : public CMICmdArgValBaseTemplate< CMIUtilString >
42 {
43 // Methods:
44 public:
45         /* ctor */      CMICmdArgValString( void );
46         /* ctor */      CMICmdArgValString( const bool vbAnything );
47         /* ctor */      CMICmdArgValString( const bool vbHandleQuotes, const bool vbAcceptNumbers, const bool vbHandleDirPaths );
48         /* ctor */      CMICmdArgValString( const CMIUtilString & vrArgName, const bool vbMandatory, const bool vbHandleByCmd, const bool vbHandleQuotes = false, const bool vbAcceptNumbers = false );
49         //
50         bool    IsStringArg( const CMIUtilString & vrTxt ) const;
51
52 // Overridden:
53 public:
54         // From CMICmdArgValBase
55         /* dtor */ virtual ~CMICmdArgValString( void );
56         // From CMICmdArgSet::IArg
57         virtual bool    Validate( CMICmdArgContext & vrwArgContext );
58
59 // Methods:
60 private:
61         bool    ValidateSingleText( CMICmdArgContext & vrwArgContext );
62         bool    ValidateQuotedText( CMICmdArgContext & vrwArgContext );
63         bool    ValidateQuotedTextEmbedded( CMICmdArgContext & vrwArgContext );
64         bool    ValidateQuotedQuotedTextEmbedded( CMICmdArgContext & vrwArgContext );
65         bool    IsStringArgSingleText( const CMIUtilString & vrTxt ) const;
66         bool    IsStringArgQuotedText( const CMIUtilString & vrTxt ) const;
67         bool    IsStringArgQuotedTextEmbedded( const CMIUtilString & vrTxt ) const;
68         bool    IsStringArgQuotedQuotedTextEmbedded( const CMIUtilString & vrTxt ) const;
69
70 // Attribute:
71 private:
72         bool    m_bHandleQuotedString;  // True = Parse a string surrounded by quotes spaces are not delimitors, false = only text up to next delimiting space character
73         bool    m_bAcceptNumbers;               // True = Parse a string and accept as a number if number, false = numbers not recognised as string types
74         bool    m_bHandleDirPaths;              // True = Parse a string and accept directory file style string if present, false = directory file path not accepted
75         bool    m_bHandleAnything;              // True = Parse a string and accept anything if present, false = validate for criteria matches
76 };