Mantid
Loading...
Searching...
No Matches
FileValidator.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
13#include <vector>
14
15namespace Mantid {
16namespace Kernel {
17
18bool has_ending(const std::string &value, const std::string &ending);
19
25class MANTID_KERNEL_DLL FileValidator : public TypedValidator<std::string> {
26public:
27 explicit FileValidator(const std::vector<std::string> &extensions = std::vector<std::string>(),
28 bool testFileExists = true);
29 std::vector<std::string> allowedValues() const override;
30 IValidator_sptr clone() const override;
31
32protected:
34 std::vector<std::string> m_extensions;
37
38private:
39 std::string checkValidity(const std::string &value) const override;
40 bool endswith(const std::string &value) const;
41};
42
43} // namespace Kernel
44} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
FileValidator is a validator that checks that a filepath is valid.
Definition: FileValidator.h:25
bool m_testExist
Flag indicating whether to test for existence of filename.
Definition: FileValidator.h:36
std::vector< std::string > m_extensions
The list of permitted extensions.
Definition: FileValidator.h:34
bool has_ending(const std::string &value, const std::string &ending)
Confirm that the value string ends with then ending string.
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.
Definition: IValidator.h:26
Helper class which provides the Collimation Length for SANS instruments.