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.
18 * @file IFilterTracer.cpp
19 * @author Kisub Song (kisubs.song@samsung.com)
25 #include "FilterValidator.h"
33 FilterValidator::FilterValidator(PropertyStructArray properties)
36 for(i=0; properties[i].attributeName != 0 ; i++)
37 m_properties[properties[i].attributeName] =
38 PropertyPtr(new Property(properties[i].type));
41 FilterValidator::~FilterValidator()
45 bool FilterValidator::validateAttribute(std::string& attrName,
46 MatchFlag& matchFlag, AnyArrayPtr& values, int depth)
48 if(m_properties[attrName] == NULL)
51 PropertyPtr prop = m_properties[attrName];
55 AnyArray::iterator arrayIter;
56 for(arrayIter = values->begin(); arrayIter != values->end(); arrayIter++)
57 if(!(prop->type & (*arrayIter)->getType()))
64 bool FilterValidator::validateAttributeRange(std::string& attrName,
65 AnyPtr& initialValue, AnyPtr& endValue, int depth)
67 if(m_properties[attrName] == NULL)
70 PropertyPtr prop = m_properties[attrName];
72 if(initialValue == NULL && endValue == NULL)
75 if(prop->type != initialValue->getType())
78 if(prop->type != endValue->getType())
84 bool FilterValidator::validateComposite(int depth)