Implement DbCatEverything flag.

Fixes #5096
This commit is contained in:
Gunnar Beutner 2013-11-20 16:41:48 +01:00
parent e5fba1d881
commit 4534bb08c5
5 changed files with 15 additions and 3 deletions

View File

@ -582,7 +582,9 @@ Data Categories:
DbCatRetention | Retention data
DbCatStateHistory | Historical state data
Multiple categories can be combined using the `|` operator.
Multiple categories can be combined using the `|` operator. In addition to
the category flags listed above the `DbCatEverything` flag may be used as
a shortcut for listing all flags.
### <a id="objecttype-idomysqlconnection"></a> IdoPgSqlConnection
@ -664,7 +666,9 @@ Data Categories:
DbCatRetention | Retention data
DbCatStateHistory | Historical state data
Multiple categories can be combined using the `|` operator.
Multiple categories can be combined using the `|` operator. In addition to
the category flags listed above the `DbCatEverything` flag may be used as
a shortcut for listing all flags.
### <a id="objecttype-livestatuslistener"></a> LiveStatusListener

View File

@ -81,3 +81,4 @@ set DbCatProgramStatus = (1 << 11)
set DbCatRetention = (1 << 12)
set DbCatStateHistory = (1 << 13)
set DbCatEverything = (~0)

View File

@ -30,7 +30,7 @@ AExpression::AExpression(AOperator op, const AValue& operand1)
AExpression::AExpression(AOperator op, const AValue& operand1, const AValue& operand2)
: m_Operator(op), m_Operand1(operand1), m_Operand2(operand2)
{
ASSERT(op == AEAdd || op == AESubtract || op == AEMultiply || op == AEDivide ||
ASSERT(op == AEAdd || op == AENegate || op == AESubtract || op == AEMultiply || op == AEDivide ||
op == AEBinaryAnd || op == AEBinaryOr || op == AEShiftLeft || op == AEShiftRight);
}
@ -44,6 +44,8 @@ Value AExpression::Evaluate(const Object::Ptr& thisRef) const
switch (m_Operator) {
case AEReturn:
return left;
case AENegate:
return ~(long)left;
case AEAdd:
if (left.GetType() == ValueString || right.GetType() == ValueString)
return (String)left + (String)right;

View File

@ -33,6 +33,7 @@ namespace icinga
enum AOperator
{
AEReturn,
AENegate,
AEAdd,
AESubtract,
AEMultiply,

View File

@ -555,6 +555,10 @@ aexpression: T_STRING
$$ = new Value(make_shared<AExpression>(AEReturn, AValue(ATVariable, $1)));
free($1);
}
| '~' aexpression
{
$$ = new Value(make_shared<AExpression>(AENegate, static_cast<AExpression::Ptr>(*$2)));
}
| aexpression '+' aexpression
{
$$ = new Value(make_shared<AExpression>(AEAdd, static_cast<AExpression::Ptr>(*$1), static_cast<AExpression::Ptr>(*$3)));