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
114class MANTID_API_DLL MultipleFileProperty : public Kernel::PropertyWithValue<std::vector<std::vector<std::string>>> {
115public:
116 MultipleFileProperty(const std::string &name, unsigned int action,
117 const std::vector<std::string> &exts = std::vector<std::string>(),
118 bool allowEmptyTokens = false);
119
120 MultipleFileProperty(const std::string &name, const std::vector<std::string> &exts = std::vector<std::string>());
121
124
125 MultipleFileProperty *clone() const override { return new MultipleFileProperty(*this); }
126
127 std::string setValue(const std::string &propValue) override;
128 std::string value() const override;
129 std::string getDefault() const override;
130 bool isOptional() const;
131
133 std::vector<std::string> getExts() const { return m_exts; }
134
136 std::string getDefaultExt() const { return m_defaultExt; }
137
138 // Unhide the PropertyWithValue assignment operator
139 using Kernel::PropertyWithValue<std::vector<std::vector<std::string>>>::operator=;
140
141private:
143 std::string isEmptyValueValid() const;
144 std::string setValueAsSingleFile(const std::string &propValue);
145 std::string setValueAsMultipleFiles(const std::string &propValue);
148
150 std::vector<std::string> m_exts;
155 std::string m_defaultExt;
158 unsigned int m_action{2};
162 std::string m_oldPropValue;
166 std::vector<std::vector<std::string>> m_oldFoundValue;
168 bool m_allowEmptyTokens{false};
169};
170
171} // namespace API
172} // namespace Mantid
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'
std::vector< std::string > m_exts
Suggested extensions.
std::vector< std::string > getExts() const
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 getDefaultExt() const
Returns the main file extension that's used.
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
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.