blob: 25d9842ec07c87d6a56506cf9021a539d15df5ea [file] [log] [blame]
Deepak Panickal6f9c4682014-05-16 10:51:01 +00001//===-- MICmdArgValFile.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
Deepak Panickal6f9c4682014-05-16 10:51:01 +000010#pragma once
11
12// In-house headers:
13#include "MICmdArgValBase.h"
14
15// Declarations:
16class CMICmdArgContext;
17
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
22// interpret the options (context) string to find and validate a matching
23// argument and so extract a value from it .
24// Based on the Interpreter pattern.
Deepak Panickal6f9c4682014-05-16 10:51:01 +000025//--
Zachary Turner1d6af022014-11-17 18:06:21 +000026class CMICmdArgValFile : public CMICmdArgValBaseTemplate<CMIUtilString>
Deepak Panickal6f9c4682014-05-16 10:51:01 +000027{
Zachary Turner1d6af022014-11-17 18:06:21 +000028 // Methods:
29 public:
Bruce Mitchenere2453af2015-08-04 10:24:20 +000030 /* ctor */ CMICmdArgValFile();
Zachary Turner1d6af022014-11-17 18:06:21 +000031 /* ctor */ CMICmdArgValFile(const CMIUtilString &vrArgName, const bool vbMandatory, const bool vbHandleByCmd);
32 //
33 bool IsFilePath(const CMIUtilString &vrFileNamePath) const;
34 CMIUtilString GetFileNamePath(const CMIUtilString &vrTxt) const;
Deepak Panickal6f9c4682014-05-16 10:51:01 +000035
Zachary Turner1d6af022014-11-17 18:06:21 +000036 // Overridden:
37 public:
38 // From CMICmdArgValBase
Bruce Mitchenere2453af2015-08-04 10:24:20 +000039 /* dtor */ ~CMICmdArgValFile() override;
Zachary Turner1d6af022014-11-17 18:06:21 +000040 // From CMICmdArgSet::IArg
Bruce Mitchener88205302015-07-06 15:48:55 +000041 bool Validate(CMICmdArgContext &vwArgContext) override;
Deepak Panickald2499282014-08-08 16:47:42 +000042
Zachary Turner1d6af022014-11-17 18:06:21 +000043 // Methods:
44 private:
45 bool IsValidChars(const CMIUtilString &vrText) const;
Deepak Panickal6f9c4682014-05-16 10:51:01 +000046};