Mantid
Loading...
Searching...
No Matches
MultipleFileProperty.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 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#include "MantidAPI/DllConfig.h"
12#include <set>
13#include <vector>
14
15namespace Mantid {
16namespace API {
17
103class MANTID_API_DLL MultipleFileProperty : public Kernel::PropertyWithValue<std::vector<std::vector<std::string>>> {
104public:
105 MultipleFileProperty(const std::string &name, unsigned int action,
106 const std::vector<std::string> &exts = std::vector<std::string>(),
107 bool allowEmptyTokens = false);
108
109 MultipleFileProperty(const std::string &name, const std::vector<std::string> &exts = std::vector<std::string>());
110
113
114 MultipleFileProperty *clone() const override { return new MultipleFileProperty(*this); }
115
116 std::string setValue(const std::string &propValue) override;
117 std::string value() const override;
118 std::string getDefault() const override;
119 bool isOptional() const;
120
122 const std::vector<std::string> &getExts() const { return m_exts; }
123
125 const std::string &getDefaultExt() const { return m_defaultExt; }
126
127 // Unhide the PropertyWithValue assignment operator
128 using Kernel::PropertyWithValue<std::vector<std::vector<std::string>>>::operator=;
129
130private:
132 std::string isEmptyValueValid() const;
133 std::string setValueAsSingleFile(const std::string &propValue);
134 std::string setValueAsMultipleFiles(const std::string &propValue);
137
139 std::vector<std::string> m_exts;
144 std::string m_defaultExt;
147 unsigned int m_action{2};
151 std::string m_oldPropValue;
155 std::vector<std::vector<std::string>> m_oldFoundValue;
157 bool m_allowEmptyTokens{false};
158};
159
160} // namespace API
161} // namespace Mantid
std::string name
Definition Run.cpp:60
double value
The value of the point.
Definition FitMW.cpp:51
A property to allow a user to specify multiple files to load.
MultipleFileProperty * clone() const override
'Virtual copy constructor'
const std::string & getDefaultExt() const
Returns the main file extension that's used.
std::vector< std::string > m_exts
Suggested extensions.
MultipleFileProperty & operator=(const MultipleFileProperty &)=default
std::vector< std::vector< std::string > > m_oldFoundValue
Last value of the found files used in MultipleFileProperty::setValueAsMultipleFiles and MultipleFileP...
std::string m_defaultExt
The default file extension associated with the type of file this property will handle.
std::string m_oldPropValue
Last value of propValue used in MultipleFileProperty::setValueAsMultipleFiles and MultipleFilePropert...
bool m_multiFileLoadingEnabled
Whether or not the user has turned on multifile loading.
MultipleFileProperty(const MultipleFileProperty &)=default
const std::vector< std::string > & getExts() const
Kernel::MultiFileNameParsing::Parser m_parser
Parser used to parse multi-file strings.
This class takes a string representing multiple files and parses it into a vector of vectors of file ...
The concrete, templated class for properties.
Helper class which provides the Collimation Length for SANS instruments.