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 //===----------------------------------------------------------------------===//
13 #include "MICmdArgValBase.h"
16 class CMICmdArgContext;
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
25 // argument and so extract a value from it .
26 // Based on the Interpreter pattern.
28 class CMICmdArgValString : public CMICmdArgValBaseTemplate<CMIUtilString> {
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);
48 bool IsStringArg(const CMIUtilString &vrTxt) const;
52 // From CMICmdArgValBase
53 /* dtor */ ~CMICmdArgValString() override;
54 // From CMICmdArgSet::IArg
55 bool Validate(CMICmdArgContext &vrwArgContext) override;
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;
70 bool m_bHandleQuotedString; // True = Parse a string surrounded by quotes
71 // spaces are not delimiters, false = only text up
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
77 bool m_bHandleDirPaths; // True = Parse a string and accept directory file
78 // style string if present, false = directory file
81 bool m_bHandleAnything; // True = Parse a string and accept anything if
82 // present, false = validate for criteria matches