Mantid
Loading...
Searching...
No Matches
OptionalBool.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2015 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 "MantidKernel/DllConfig.h"
12
13#include <iosfwd>
14#include <map>
15#include <string>
16
17namespace Json {
18class Value;
19}
20
21namespace Mantid {
22namespace Kernel {
23
26class MANTID_KERNEL_DLL OptionalBool {
27public:
28 enum Value : unsigned char { False, True, Unset };
29 static std::map<std::string, Value> strToEnumMap();
30 static std::map<Value, std::string> enumToStrMap();
31 const static std::string StrUnset;
32 const static std::string StrFalse;
33 const static std::string StrTrue;
34
35public:
37 OptionalBool(bool arg);
39 OptionalBool(std::string arg);
40 OptionalBool(char const *arg);
41 OptionalBool(const int arg);
42 OptionalBool(const OptionalBool &other) = default;
43 OptionalBool &operator=(const OptionalBool &other) = default;
44 OptionalBool &operator=(std::string const &arg);
45 OptionalBool &operator=(char const *arg);
46 OptionalBool &operator=(const int arg);
47 bool operator==(const OptionalBool &other) const;
48 bool operator!=(const OptionalBool &other) const;
49 Value getValue() const;
50 Value Validate(const std::string &arg);
51 virtual ~OptionalBool() = default;
52
53private:
54 friend MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &os, OptionalBool const &object);
55 friend MANTID_KERNEL_DLL std::istream &operator>>(std::istream &istream, OptionalBool &object);
56
58};
59
60MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &os, OptionalBool const &object);
61
62MANTID_KERNEL_DLL std::istream &operator>>(std::istream &istream, OptionalBool &object);
63
65MANTID_KERNEL_DLL ::Json::Value encodeAsJson(const OptionalBool &);
66
67namespace pwvjdetail {
68
69template <> struct ToCpp<OptionalBool> {
70 bool operator()(const Json::Value &value);
71};
72
73} // namespace pwvjdetail
74
75// Instantiated and exported by PropertyWithValue.cpp
78
79} // namespace Kernel
80} // namespace Mantid
double value
The value of the point.
Definition FitMW.cpp:51
OptionalBool : Tri-state bool.
virtual ~OptionalBool()=default
OptionalBool(const OptionalBool &other)=default
static const std::string StrUnset
static const std::string StrFalse
static const std::string StrTrue
OptionalBool & operator=(const OptionalBool &other)=default
The concrete, templated class for properties.
MANTID_KERNEL_DLL std::ostream & operator<<(std::ostream &, CPUTimer &)
Convenience function to provide for easier debug printing.
Definition CPUTimer.cpp:86
MANTID_KERNEL_DLL std::istream & operator>>(std::istream &, Interpolation &)
Reads in parameter value.
MANTID_KERNEL_DLL::Json::Value encodeAsJson(const OptionalBool &)
Encode an OptionalBool as a Json::Value.
MANTID_KERNEL_EXTERN_TEMPLATE(PropertyWithValue< Matrix< float > >)
Helper class which provides the Collimation Length for SANS instruments.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr bool operator!=(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr wide_integer< Bits, Signed > operator>>(const wide_integer< Bits, Signed > &lhs, T2 n) noexcept
constexpr wide_integer< Bits, Signed > operator<<(const wide_integer< Bits, Signed > &lhs, T2 n) noexcept
General type to convert a Json::Value to a set C++ type.