blob: 8030cb783aab61059fbe98f90aa6a5ad89bf22b6 [file] [log] [blame]
Deepak Panickal6f9c4682014-05-16 10:51:01 +00001//===-- MICmdArgValFile.h ---------------------------------------*- C++ -*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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 Panickal6f9c4682014-05-16 10:51:01 +00006//
7//===----------------------------------------------------------------------===//
8
Deepak Panickal6f9c4682014-05-16 10:51:01 +00009#pragma once
10
11// In-house headers:
12#include "MICmdArgValBase.h"
13
14// Declarations:
15class CMICmdArgContext;
16
Kate Stoneb9c1b512016-09-06 20:57:50 +000017//++
18//============================================================================
Zachary Turner1d6af022014-11-17 18:06:21 +000019// 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 Stoneb9c1b512016-09-06 20:57:50 +000022// interpret the options (context) string to find and validate a
23// matching
Zachary Turner1d6af022014-11-17 18:06:21 +000024// argument and so extract a value from it .
25// Based on the Interpreter pattern.
Deepak Panickal6f9c4682014-05-16 10:51:01 +000026//--
Kate Stoneb9c1b512016-09-06 20:57:50 +000027class CMICmdArgValFile : public CMICmdArgValBaseTemplate<CMIUtilString> {
28 // Methods:
29public:
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 Panickal6f9c4682014-05-16 10:51:01 +000036
Kate Stoneb9c1b512016-09-06 20:57:50 +000037 // Overridden:
38public:
39 // From CMICmdArgValBase
40 /* dtor */ ~CMICmdArgValFile() override;
41 // From CMICmdArgSet::IArg
42 bool Validate(CMICmdArgContext &vwArgContext) override;
Deepak Panickald2499282014-08-08 16:47:42 +000043
Kate Stoneb9c1b512016-09-06 20:57:50 +000044 // Methods:
45private:
46 bool IsValidChars(const CMIUtilString &vrText) const;
Deepak Panickal6f9c4682014-05-16 10:51:01 +000047};