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 FilterValidator.h
19 * @author Kisub Song (kisubs.song@samsung.com)
24 #ifndef _API_FILTER_VALIDATOR_H_
25 #define _API_FILTER_VALIDATOR_H_
30 #include <dpl/shared_ptr.h>
31 #include <API/Filter/FilterTypes.h>
39 typedef DPL::SharedPtr<IFilter> FilterPtr;
40 typedef std::vector<std::string> MatchFlagArray;
41 typedef DPL::SharedPtr<MatchFlagArray> MatchFlagArrayPtr;
45 const char * attributeName;
46 const PrimitiveType type;
48 typedef PropertyStruct PropertyStructArray[];
50 // GoF Visitor Pattern
57 Property(PrimitiveType pType) :
61 typedef DPL::SharedPtr<Property> PropertyPtr;
62 typedef std::map<std::string, PropertyPtr> PropertyMap;
64 PropertyMap m_properties;
67 FilterValidator(PropertyStructArray properties);
69 virtual ~FilterValidator();
71 // validate AttributeFilter
72 virtual bool validateAttribute(std::string& attrName,
73 MatchFlag& matchFlag, AnyArrayPtr& values, int depth=0);
75 // validate AttributeRangeFilter
76 virtual bool validateAttributeRange(std::string& attrName,
77 AnyPtr& initialValue, AnyPtr& endValue, int depth=0);
79 // validate CompositeFilter
80 virtual bool validateComposite(int depth=0);
83 typedef DPL::SharedPtr<FilterValidator> FilterValidatorPtr;
89 #endif // _API_FILTER_VALIDATOR_H_