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.
17 * StorageChangesMessageGenerator.h
19 * Created on: 2011. 10. 28.
23 #ifndef STORAGECHANGESMESSAGEGENERATOR_H_
24 #define STORAGECHANGESMESSAGEGENERATOR_H_
26 #include <API/Filter/IFilterVisitor.h>
27 #include <API/Filter/SortMode.h>
28 #include <API/Messaging/IMessaging.h>
37 // using namespace std;
39 class StorageChangesMessageGenerator: public TizenApis::Api::Tizen::IFilterVisitor{
47 operandIntersection = 4
50 StorageChangesMessageGenerator(Api::Messaging::IMessagePtr msg);
51 virtual ~StorageChangesMessageGenerator();
53 void visitPreComposite(Api::Tizen::FilterType& type, int depth);
54 void visitInComposite(Api::Tizen::FilterType& type, int depth);
55 void visitPostComposite(Api::Tizen::FilterType& type, int depth);
56 void visitAttribute(std::string& attrName,
57 Api::Tizen::AnyArrayPtr& values, std::string& matchFlag, bool caseSensitive, int depth);
58 void visitAttributeRange(std::string& attrName, Api::Tizen::AnyPtr& initialValue, Api::Tizen::AnyPtr& endValue, int depth);
59 bool getMatchFlagResult(Api::Tizen::AnyPtr& value, std::string& valueString, std::string& matchFlag);
60 bool getCompareResult();
66 std::string convertToEmfAttrName(std::string attrName);
67 bool getMatchExactlyClause(std::string& attrName, Api::Tizen::AnyPtr& value);
68 bool getMatchContainsClause(std::string& attrName, Api::Tizen::AnyPtr& value);
69 bool getMatchStartwithClause(std::string& attrName, Api::Tizen::AnyPtr& value);
70 bool getMatchEndwithClause(std::string& attrName, Api::Tizen::AnyPtr& value);
71 bool getBetweenRangeClause(struct tm initialValue, struct tm endValue);
73 void visitAttributeEach(std::string& attrName, Api::Tizen::AnyPtr& value, std::string& matchFlag, int depth);
74 int convertMessageType(std::string& stringType);
75 int convertFolderType(std::string& stringType);
77 struct tm convertToTimeFormat(const std::string& timeString);
78 std::string createTimeString(std::string& timeString);
79 std::string createFolderType(std::string& value);
80 std::string createPriorityType(std::string& value);
81 std::string createDateTimeType(Api::Tizen::AnyPtr& value);
82 void initAttributeMap();
88 std::vector<std::string> typeVector;
89 std::map<std::string, std::string> attributeMap;
91 std::vector<bool> m_result;
92 std::vector<int> m_operand;
95 Api::Messaging::MessageType m_type;
96 Api::Messaging::FolderType m_folder;
99 std::vector<std::string> m_to;
100 std::vector<std::string> m_cc;
101 std::vector<std::string> m_bcc;
104 Api::Messaging::MessagePriority::Priority m_priority;
105 std::string m_subject;
107 Api::Messaging::RecipientsPtr Recipents;
108 std::string m_currentType;
110 static const std::string STRING_MATCH_EXCACTLY;
111 static const std::string STRING_MATCH_CONTAINS;
112 static const std::string STRING_MATCH_STARTSWITH;
113 static const std::string STRING_MATCH_ENDSWITH;
114 static const std::string STRING_MATCH_CASESENSITIVE;
116 static const int MESSAGE_TYPE_NOT_INITIALIZED;
120 typedef DPL::SharedPtr<StorageChangesMessageGenerator> StorageChangesMessageGeneratorPtr;
121 } // namespace Platform
122 } // namespace WrtPlugins
124 #endif /* MESSAGEQUERYGENERATOR_H_ */