]> git.lyx.org Git - lyx.git/blob - src/FuncStatus.cpp
Fix bug #8105: Crash when deleting math macro from the inside
[lyx.git] / src / FuncStatus.cpp
1 /**
2  * \file FuncStatus.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Jean-Marc Lasgouttes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "FuncStatus.h"
14
15
16 namespace lyx {
17
18 FuncStatus::FuncStatus()
19         : v_(OK)
20 {
21 }
22
23
24 void FuncStatus::clear()
25 {
26         v_ = OK;
27         message_.erase();
28 }
29
30
31 void FuncStatus::setUnknown(bool b)
32 {
33         if (b)
34                 v_ |= UNKNOWN;
35         else
36                 v_ &= ~UNKNOWN;
37 }
38
39
40
41 bool FuncStatus::unknown() const
42 {
43         return (v_ & UNKNOWN);
44 }
45
46
47 void FuncStatus::setEnabled(bool b)
48 {
49         if (b)
50                 v_ &= ~DISABLED;
51         else
52                 v_ |= DISABLED;
53 }
54
55
56 bool FuncStatus::enabled() const
57 {
58         return !(v_ & DISABLED);
59 }
60
61
62 void FuncStatus::setOnOff(bool b)
63 {
64         v_ |= (b ? ON : OFF);
65 }
66
67
68 bool FuncStatus::onOff(bool b) const
69 {
70         if (b)
71                 return (v_ & ON);
72         else
73                 return (v_ & OFF);
74 }
75
76
77 void FuncStatus::message(docstring const & m)
78 {
79         message_ = m;
80 }
81
82
83 docstring const & FuncStatus::message() const
84 {
85         return message_;
86 }
87
88
89 } // namespace lyx