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 * FolderQueryGenerator.h
19 * Created on: 2011. 10. 28.
23 #ifndef FOLDERQUERYGENERATOR_H_
24 #define FOLDERQUERYGENERATOR_H_
26 #include <API/Filter/IFilterVisitor.h>
27 #include <API/Filter/SortMode.h>
35 class FolderQueryGenerator: public TizenApis::Api::Tizen::IFilterVisitor {
38 enum QueryGeneratorMode {
39 MODE_EMAIL, MODE_SMS_MMS
43 std::map<std::string, std::string> attributeMap;
46 QueryGeneratorMode m_mode;
48 std::vector<std::string> m_queryVector;
52 std::vector<std::string> typeVector;
54 std::string m_currentType;
56 bool m_folderPathProcessing;
59 std::string m_folderpath;
61 static const std::string STRING_MATCH_EXACTLY;
62 static const std::string STRING_MATCH_CONTAINS;
63 static const std::string STRING_MATCH_STARTSWITH;
64 static const std::string STRING_MATCH_ENDSWITH;
65 static const std::string STRING_MATCH_CASESENSITIVE;
67 static const int ACCOUNT_ID_NOT_INITIALIZED;
70 FolderQueryGenerator();
71 virtual ~FolderQueryGenerator();
73 void visitPreComposite(Api::Tizen::FilterType& type, int depth);
74 void visitInComposite(Api::Tizen::FilterType& type, int depth);
75 void visitPostComposite(Api::Tizen::FilterType& type, int depth);
76 void visitAttribute(std::string& attrName, Api::Tizen::MatchFlag& matchFlag,
77 Api::Tizen::AnyArrayPtr& values, int depth);
78 void visitAttributeRange(std::string& attrName,
79 Api::Tizen::AnyPtr& initialValue, Api::Tizen::AnyPtr& endValue,
81 void visitID(Api::Tizen::AnyArrayPtr &value, int depth);
84 std::string getFolderPath();
85 bool isFolderPathExist();
89 virtual bool getMatchExactlyClause(std::string& attrName,
90 Api::Tizen::AnyPtr& value);
91 void visitAttributeEach(std::string& attrName,
92 Api::Tizen::MatchFlag& matchFlag, Api::Tizen::AnyPtr& value,
96 std::string getMatchStartsWithClause(std::string& attrName,
97 Api::Tizen::AnyPtr& value);
98 std::string getMatchEndsWithClause(std::string& attrName,
99 Api::Tizen::AnyPtr& value);
100 std::string getMatchContainsClause(std::string& attrName,
101 Api::Tizen::AnyPtr& value);
105 typedef DPL::SharedPtr<FolderQueryGenerator> FolderQueryGeneratorPtr;
106 } // namespace Platform
107 } // namespace WrtPlugins