Mantid
Loading...
Searching...
No Matches
MandatoryValidator.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 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
10#include <memory>
11#include <vector>
12
13namespace Mantid {
14namespace Kernel {
15namespace Detail {
17template <typename T> DLLExport bool checkIsEmpty(const T &);
18
20template <typename T> bool checkIsEmpty(const std::vector<T> &value) { return value.empty(); }
21
23template <typename T> struct IsEmpty {
29 static bool check(const T &value) { return checkIsEmpty(value); }
30};
31} // namespace Detail
32
43template <typename TYPE> class DLLExport MandatoryValidator : public TypedValidator<TYPE> {
44public:
45 IValidator_sptr clone() const override { return std::make_shared<MandatoryValidator>(); }
46
47private:
53 std::string checkValidity(const TYPE &value) const override {
55 return "A value must be entered for this parameter";
56 else
57 return "";
58 }
59};
60
61} // namespace Kernel
62} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Definition: System.h:53
Validator to check that a property is not left empty.
IValidator_sptr clone() const override
std::string checkValidity(const TYPE &value) const override
Check if a value has been provided.
DLLExport bool checkIsEmpty(const T &)
Forward declare checking function.
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.
Defines the concept of emptiness.
static bool check(const T &value)
Returns true if the value is considered empty.