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 { Unset, True, False };
28 static std::map<std::string, Value> strToEmumMap();
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 virtual ~OptionalBool() = default;
39 bool operator==(const OptionalBool &other) const;
40 bool operator!=(const OptionalBool &other) const;
41 Value getValue() const;
42
43private:
44 friend MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &os, OptionalBool const &object);
45 friend MANTID_KERNEL_DLL std::istream &operator>>(std::istream &istream, OptionalBool &object);
46
48};
49
50MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &os, OptionalBool const &object);
51
52MANTID_KERNEL_DLL std::istream &operator>>(std::istream &istream, OptionalBool &object);
53
55MANTID_KERNEL_DLL ::Json::Value encodeAsJson(const OptionalBool &);
56
57namespace pwvjdetail {
58
59template <> struct ToCpp<OptionalBool> { bool operator()(const Json::Value &value); };
60
61} // namespace pwvjdetail
62
63} // namespace Kernel
64} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
std::ostream & operator<<(std::ostream &out, const MantidQt::MantidWidgets::IndexType< i > &index)
Definition: IndexTypes.h:103
OptionalBool : Tri-state bool.
Definition: OptionalBool.h:25
virtual ~OptionalBool()=default
static const std::string StrUnset
Definition: OptionalBool.h:30
static const std::string StrFalse
Definition: OptionalBool.h:31
static const std::string StrTrue
Definition: OptionalBool.h:32
Definition: Algorithm.h:38
MANTID_API_DLL std::istream & operator>>(std::istream &istr, API::Boolean &)
Redaing a Boolean from an input stream.
Definition: Column.cpp:61
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)
General type to convert a Json::Value to a set C++ type.