Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 1 | //===-- MICmdArgValFile.h ---------------------------------------*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 9 | #pragma once |
| 10 | |
| 11 | // In-house headers: |
| 12 | #include "MICmdArgValBase.h" |
| 13 | |
| 14 | // Declarations: |
| 15 | class CMICmdArgContext; |
| 16 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 17 | //++ |
| 18 | //============================================================================ |
Zachary Turner | 1d6af02 | 2014-11-17 18:06:21 +0000 | [diff] [blame] | 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 |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 22 | // interpret the options (context) string to find and validate a |
| 23 | // matching |
Zachary Turner | 1d6af02 | 2014-11-17 18:06:21 +0000 | [diff] [blame] | 24 | // argument and so extract a value from it . |
| 25 | // Based on the Interpreter pattern. |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 26 | //-- |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 27 | class CMICmdArgValFile : public CMICmdArgValBaseTemplate<CMIUtilString> { |
| 28 | // Methods: |
| 29 | public: |
| 30 | /* ctor */ CMICmdArgValFile(); |
| 31 | /* ctor */ CMICmdArgValFile(const CMIUtilString &vrArgName, |
| 32 | const bool vbMandatory, const bool vbHandleByCmd); |
| 33 | // |
| 34 | bool IsFilePath(const CMIUtilString &vrFileNamePath) const; |
| 35 | CMIUtilString GetFileNamePath(const CMIUtilString &vrTxt) const; |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 36 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 37 | // Overridden: |
| 38 | public: |
| 39 | // From CMICmdArgValBase |
| 40 | /* dtor */ ~CMICmdArgValFile() override; |
| 41 | // From CMICmdArgSet::IArg |
| 42 | bool Validate(CMICmdArgContext &vwArgContext) override; |
Deepak Panickal | d249928 | 2014-08-08 16:47:42 +0000 | [diff] [blame] | 43 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 44 | // Methods: |
| 45 | private: |
| 46 | bool IsValidChars(const CMIUtilString &vrText) const; |
Deepak Panickal | 6f9c468 | 2014-05-16 10:51:01 +0000 | [diff] [blame] | 47 | }; |