1 //===-- MICmdArgValString.h -------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 // File: MICmdArgValString.h
13 // Overview: CMICmdArgValString interface.
15 // Environment: Compilers: Visual C++ 12.
16 // gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
17 // Libraries: See MIReadmetxt.
25 #include "MICmdArgValBase.h"
28 class CMICmdArgContext;
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.
38 // Authors: Illya Rudkin 15/04/2014.
41 class CMICmdArgValString : public CMICmdArgValBaseTemplate< CMIUtilString >
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 );
50 bool IsStringArg( const CMIUtilString & vrTxt ) const;
54 // From CMICmdArgValBase
55 /* dtor */ virtual ~CMICmdArgValString( void );
56 // From CMICmdArgSet::IArg
57 virtual bool Validate( CMICmdArgContext & vrwArgContext );
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;
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