Git Init
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / Messaging / StorageChangesFolderGenerator.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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. 
15 */
16 /*
17  * StorageChangesFolderGenerator.h
18  *
19  *  Created on: 2011. 10. 28.
20  *      Author: sangtai
21  */
22
23 #ifndef STORAGECHANGESFOLDERGENERATOR_H_
24 #define STORAGECHANGESFOLDERGENERATOR_H_
25
26 #include <API/Filter/IFilterVisitor.h>
27 #include <API/Filter/SortMode.h>
28 #include <API/Messaging/IMessaging.h>
29
30
31 #include <map>
32
33 namespace TizenApis {
34         namespace Platform {
35                 namespace Messaging {
36
37
38 //              using namespace std;
39
40                 class StorageChangesFolderGenerator: public TizenApis::Api::Tizen::IFilterVisitor{
41                         public:
42
43                                 enum operandType
44                                 {
45                                         leftblank = 1,
46                                         rightblank = 2,
47                                         operandUnion = 3,
48                                         operandIntersection = 4
49                                 };
50                                 
51                                 StorageChangesFolderGenerator(Api::Messaging::IMessageFolderPtr conv);
52                                 virtual ~StorageChangesFolderGenerator();
53
54                                 void visitPreComposite(Api::Tizen::FilterType& type, int depth);
55                                 void visitInComposite(Api::Tizen::FilterType& type, int depth);
56                                 void visitPostComposite(Api::Tizen::FilterType& type, int depth);
57                                 void visitAttribute(std::string& attrName,
58                                                 Api::Tizen::AnyArrayPtr& values, std::string& matchFlag, bool caseSensitive, int depth);
59                                 void visitAttributeRange(std::string& attrName, Api::Tizen::AnyPtr& initialValue, Api::Tizen::AnyPtr& endValue, int depth);
60                                 bool getMatchFlagResult(Api::Tizen::AnyPtr& value, std::string& valueString, std::string& matchFlag);
61                                 bool getCompareResult();                                                        
62
63                         private:
64                                 bool getMatchExactlyClause(std::string& attrName, Api::Tizen::AnyPtr& value);
65                                 bool getMatchContainsClause(std::string& attrName, Api::Tizen::AnyPtr& value);
66                                 bool getMatchStartwithClause(std::string& attrName, Api::Tizen::AnyPtr& value);
67                                 bool getMatchEndwithClause(std::string& attrName, Api::Tizen::AnyPtr& value);                           
68
69                                 void visitAttributeEach(std::string& attrName, Api::Tizen::AnyPtr& value, std::string& matchFlag, int depth);
70                                 int convertMessageType(std::string& stringType);
71                                 int convertFolderType(std::string& stringType);                         
72
73
74                         private:
75                                 int m_messageType;
76
77                                 std::vector<std::string> typeVector;
78                                 std::map<std::string, std::string> attributeMap;
79
80                                 std::vector<bool> m_result;
81                                 std::vector<int> m_operand;                             
82
83                                 unsigned long m_id;
84                                 unsigned long m_parentid;
85                                 unsigned long m_accountid;
86 //                              Api::Messaging::MessageType m_contestType;
87                                 unsigned short m_contestType;                           
88                                 std::string m_name;
89                                 std::string m_path;
90 //                              Api::Messaging::FolderType m_type;                              
91                                 unsigned short m_type;                          
92                                 bool m_synchronizable;
93
94                                 static const std::string STRING_MATCH_EXCACTLY;
95                                 static const std::string STRING_MATCH_CONTAINS;
96                                 static const std::string STRING_MATCH_STARTSWITH;
97                                 static const std::string STRING_MATCH_ENDSWITH;
98                                 static const std::string STRING_MATCH_CASESENSITIVE;
99
100                                 static const int MESSAGE_TYPE_NOT_INITIALIZED;
101
102                 };
103
104                 typedef DPL::SharedPtr<StorageChangesFolderGenerator> StorageChangesFolderGeneratorPtr;
105         }               // namespace Platform
106 } // namespace WrtPlugins
107 }
108 #endif /* MESSAGEQUERYGENERATOR_H_ */