2003-08-23 00:17:00 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file FuncStatus.cpp
|
2003-08-23 00:17:00 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author Jean-Marc Lasgouttes
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
2002-01-09 09:36:35 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "FuncStatus.h"
|
|
|
|
|
2004-11-25 09:15:26 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
FuncStatus::FuncStatus()
|
|
|
|
: v_(OK)
|
2002-01-09 09:36:35 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-21 16:15:14 +00:00
|
|
|
void FuncStatus::clear()
|
2002-01-09 09:36:35 +00:00
|
|
|
{
|
|
|
|
v_ = OK;
|
2004-11-25 09:15:26 +00:00
|
|
|
message_.erase();
|
2002-01-09 09:36:35 +00:00
|
|
|
}
|
|
|
|
|
2003-10-21 16:15:14 +00:00
|
|
|
|
|
|
|
void FuncStatus::operator|=(FuncStatus const & f)
|
2002-01-09 09:36:35 +00:00
|
|
|
{
|
|
|
|
v_ |= f.v_;
|
2004-11-25 09:15:26 +00:00
|
|
|
if (!f.message_.empty())
|
|
|
|
message_ = f.message_;
|
2002-01-09 09:36:35 +00:00
|
|
|
}
|
|
|
|
|
2003-10-21 16:15:14 +00:00
|
|
|
|
|
|
|
void FuncStatus::unknown(bool b)
|
2002-01-09 09:36:35 +00:00
|
|
|
{
|
|
|
|
if (b)
|
|
|
|
v_ |= UNKNOWN;
|
|
|
|
else
|
|
|
|
v_ &= !UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-21 16:15:14 +00:00
|
|
|
|
|
|
|
bool FuncStatus::unknown() const
|
2002-01-09 09:36:35 +00:00
|
|
|
{
|
|
|
|
return (v_ & UNKNOWN);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-18 13:57:20 +00:00
|
|
|
void FuncStatus::enabled(bool b)
|
2002-01-09 09:36:35 +00:00
|
|
|
{
|
|
|
|
if (b)
|
|
|
|
v_ &= !DISABLED;
|
2004-03-18 13:57:20 +00:00
|
|
|
else
|
|
|
|
v_ |= DISABLED;
|
2002-01-09 09:36:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-18 13:57:20 +00:00
|
|
|
bool FuncStatus::enabled() const
|
2002-01-09 09:36:35 +00:00
|
|
|
{
|
2004-03-18 13:57:20 +00:00
|
|
|
return !(v_ & DISABLED);
|
2002-01-09 09:36:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-21 16:15:14 +00:00
|
|
|
void FuncStatus::setOnOff(bool b)
|
2002-01-09 09:36:35 +00:00
|
|
|
{
|
|
|
|
v_ |= (b ? ON : OFF);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-21 16:15:14 +00:00
|
|
|
bool FuncStatus::onoff(bool b) const
|
2002-01-09 09:36:35 +00:00
|
|
|
{
|
2002-03-21 17:27:08 +00:00
|
|
|
if (b)
|
2002-01-09 09:36:35 +00:00
|
|
|
return (v_ & ON);
|
|
|
|
else
|
|
|
|
return (v_ & OFF);
|
|
|
|
}
|
2004-11-25 09:15:26 +00:00
|
|
|
|
|
|
|
|
2006-09-11 08:54:10 +00:00
|
|
|
void FuncStatus::message(docstring const & m)
|
2004-11-25 09:15:26 +00:00
|
|
|
{
|
|
|
|
message_ = m;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-11 08:54:10 +00:00
|
|
|
docstring const & FuncStatus::message() const
|
2004-11-25 09:15:26 +00:00
|
|
|
{
|
|
|
|
return message_;
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|