2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #include "ConversationFilterValidator.h"
19 #include "ConversationFilterValidatorFactory.h"
24 using namespace DeviceAPI::Tizen;
29 ConversationFilterValidator::ConversationFilterValidator(PropertyStructArray properties):FilterValidator(properties){
30 m_isTypeSetted = false;
33 ConversationFilterValidator::~ConversationFilterValidator() {
34 m_isTypeSetted = false;
38 bool ConversationFilterValidator::validateAttributeRange(std::string& attrName, DeviceAPI::Tizen::AnyPtr& initialValue, DeviceAPI::Tizen::AnyPtr& endValue, int depth){
39 if(initialValue == NULL || endValue == NULL)
44 if(attrName.compare(ConversationFilterValidatorFactory::ATTRIBUTE_TIMESTAMP)!=0){
45 LoggerE(">>> [ERROR] Not Supported attribute :[" << attrName << "]");
49 retVal = FilterValidator::validateAttributeRange(attrName, initialValue, endValue, depth);
53 bool ConversationFilterValidator::validateAttribute(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag,
54 DeviceAPI::Tizen::AnyPtr& matchValue, int depth){
56 if(matchValue == NULL)
61 if(validateAttributeEach(attrName, matchFlag, matchValue, depth) == false){
62 MsgLogWanning(">>>[Warning] attrName:[" << attrName << "] is invalid value:[" << matchValue->toString() << "]");
66 retBool = FilterValidator::validateAttribute(attrName, matchFlag, matchValue,depth);
67 LoggerD(">>> retBool:" << retBool);
71 bool ConversationFilterValidator::validateAttributeEach(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& value, int depth){
72 LoggerD("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]");
74 if(attrName.compare(ConversationFilterValidatorFactory::ATTRIBUTE_TYPE)==0){
75 if(m_isTypeSetted == true){
76 MsgLoggerE(">>> [ERROR] duplicated type :[" << attrName << "], value:[" << value->toString()<< "]");
79 m_isTypeSetted = true;