2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 // Created on June 3, 2009, 9:00 AM
28 #include <dpl/foreach.h>
30 #include "Attribute.h"
42 void addCondition(const Condition & condition)
44 this->conditions.push_back(condition);
47 void addAttribute(const Attribute & attribute)
49 this->attributes.push_back(attribute);
52 void setCombineType(CombineType type)
54 this->combineType = type;
57 Condition() : combineType(AND),
62 Condition(CombineType type) : combineType(type),
71 Condition * getParent()
76 void setParent(Condition * condition)
78 this->parent = condition;
81 Attribute::MatchResult evaluateCondition(
82 const AttributeSet * attrSet) const;
84 friend std::ostream & operator<<(std::ostream & out,
85 Condition & condition)
87 FOREACH (it, condition.attributes)
93 //[CR] change function name
94 void getAttributes(AttributeSet * attrSet);
97 Attribute::MatchResult evaluateChildConditions(
98 const AttributeSet * attrSet,
100 bool & undefinedMatchFound) const;
102 Attribute::MatchResult evaluateAttributes(
103 const AttributeSet * attrSet,
105 bool & undefinedMatchFound) const;
107 // KW Attribute::MatchResult performANDalgorithm(const std::set<Attribute> * attributes) const;
109 // KW Attribute::MatchResult performORalgorithm(const std::set<Attribute> * attributes) const;
113 return attributes.empty() && conditions.empty();
116 bool isAndCondition() const
118 return combineType == AND;
121 bool isOrCondition() const
123 return combineType == OR;
126 std::list<Condition> conditions;
127 CombineType combineType;
128 std::list<Attribute> attributes;
132 #endif /* _CONDITION_H */