]> granicus.if.org Git - icinga2/commitdiff
Implement DbCatEverything flag.
authorGunnar Beutner <gunnar@beutner.name>
Wed, 20 Nov 2013 15:41:48 +0000 (16:41 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Wed, 20 Nov 2013 15:47:46 +0000 (16:47 +0100)
Fixes #5096

doc/4.3-object-types.md
itl/constants.conf
lib/config/aexpression.cpp
lib/config/aexpression.h
lib/config/config_parser.yy

index 70cdf8a17ce8fc2f576ef5a784ca8ea792ac203d..1e03e9076097b4e99a0528ab6ab247afbe70efe1 100644 (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
 
index 2897655193535fd0bee9dbca22eba031701d28de..9bea2377835f302697b122d4c0ada20fcc10bd76 100644 (file)
@@ -81,3 +81,4 @@ set DbCatProgramStatus = (1 << 11)
 set DbCatRetention = (1 << 12)
 set DbCatStateHistory = (1 << 13)
 
+set DbCatEverything = (~0)
index 87c9fc02a6048fe449a2d13ceb5175990ad88c42..19f12564f60c4b8c7b3c032834eba20af831a555 100644 (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;
index e9382aa2c1df39b514ef0598dd444571edc9f9a9..46258ab5438f1a04beab3ed5600feed84d00e9fa 100644 (file)
@@ -33,6 +33,7 @@ namespace icinga
 enum AOperator
 {
        AEReturn,
+       AENegate,
        AEAdd,
        AESubtract,
        AEMultiply,
index 7886bcdf35ba6e2b9ba5e64933893237857c3305..3d0b25ec1e06df1b471806303c3344ec13f4443a 100644 (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)));