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"
11
12#include <iosfwd>
13#include <map>
14#include <string>
15
16namespace Json {
17class Value;
18}
19
20namespace Mantid {
21namespace Kernel {
22
25class MANTID_KERNEL_DLL OptionalBool {
26public:
27 enum Value : unsigned char { False, True, Unset };
28 static std::map<std::string, Value> strToEnumMap();
29 static std::map<Value, std::string> enumToStrMap();
30 const static std::string StrUnset;
31 const static std::string StrFalse;
32 const static std::string StrTrue;
33
34public:
36 OptionalBool(bool arg);
38 OptionalBool(std::string arg);
39 OptionalBool(char const *arg);
40 OptionalBool(const int arg);
41 OptionalBool(const OptionalBool &other) = default;
42 OptionalBool &operator=(const OptionalBool &other) = default;
43 OptionalBool &operator=(std::string const &arg);
44 OptionalBool &operator=(char const *arg);
45 OptionalBool &operator=(const int arg);
46 bool operator==(const OptionalBool &other) const;
47 bool operator!=(const OptionalBool &other) const;
48 Value getValue() const;
49 Value Validate(const std::string &arg);
50 virtual ~OptionalBool() = default;
51
52private:
53 friend MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &os, OptionalBool const &object);
54 friend MANTID_KERNEL_DLL std::istream &operator>>(std::istream &istream, OptionalBool &object);
55
57};
58
59MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &os, OptionalBool const &object);
60
61MANTID_KERNEL_DLL std::istream &operator>>(std::istream &istream, OptionalBool &object);
62
64MANTID_KERNEL_DLL ::Json::Value encodeAsJson(const OptionalBool &);
65
66namespace pwvjdetail {
67
68template <> struct ToCpp<OptionalBool> {
69 bool operator()(const Json::Value &value);
70};
71
72} // namespace pwvjdetail
73
74} // namespace Kernel
75} // 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
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.
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.