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 #ifndef FOLDERQUERYGENERATOR_H_
19 #define FOLDERQUERYGENERATOR_H_
21 #include <IFilterVisitor.h>
29 class FolderQueryGenerator: public DeviceAPI::Tizen::IFilterVisitor {
32 enum QueryGeneratorMode {
33 MODE_EMAIL, MODE_SMS_MMS
37 std::map<std::string, std::string> attributeMap;
40 QueryGeneratorMode m_mode;
42 std::vector<std::string> m_queryVector;
46 std::vector<std::string> typeVector;
48 std::string m_currentType;
50 bool m_folderPathProcessing;
53 std::string m_folderpath;
55 static const std::string STRING_MATCH_EXACTLY;
56 static const std::string STRING_MATCH_CONTAINS;
57 static const std::string STRING_MATCH_STARTSWITH;
58 static const std::string STRING_MATCH_ENDSWITH;
59 static const std::string STRING_MATCH_EXISTS;
61 static const int ACCOUNT_ID_NOT_INITIALIZED;
64 FolderQueryGenerator();
65 virtual ~FolderQueryGenerator();
67 void visitPreComposite(DeviceAPI::Tizen::FilterType& type, int depth);
68 void visitInComposite(DeviceAPI::Tizen::FilterType& type, int depth);
69 void visitPostComposite(DeviceAPI::Tizen::FilterType& type, int depth);
70 void visitAttribute(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag,
71 DeviceAPI::Tizen::AnyPtr& matchValue, int depth);
72 void visitAttributeRange(std::string& attrName,
73 DeviceAPI::Tizen::AnyPtr& initialValue, DeviceAPI::Tizen::AnyPtr& endValue,
77 std::string getFolderPath();
78 bool isFolderPathExist();
82 virtual bool getMatchExactlyClause(std::string& attrName,
83 DeviceAPI::Tizen::AnyPtr& value);
84 virtual bool getMatchExistClause(std::string& attrName);
85 void visitAttributeEach(std::string& attrName,
86 DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& value,
90 std::string getMatchStartsWithClause(std::string& attrName,
91 DeviceAPI::Tizen::AnyPtr& value);
92 std::string getMatchEndsWithClause(std::string& attrName,
93 DeviceAPI::Tizen::AnyPtr& value);
94 std::string getMatchContainsClause(std::string& attrName,
95 DeviceAPI::Tizen::AnyPtr& value);
99 typedef DPL::SharedPtr<FolderQueryGenerator> FolderQueryGeneratorPtr;