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{
44 std::map<std::string, std::string> attributeMap;
47 QueryGeneratorMode m_mode;
49 std::vector<std::string> m_queryVector;
53 std::vector<std::string> typeVector;
55 std::string m_currentType;
57 bool m_folderPathProcessing;
60 std::string m_folderpath;
62 static const std::string STRING_MATCH_EXACTLY;
63 static const std::string STRING_MATCH_CONTAINS;
64 static const std::string STRING_MATCH_STARTSWITH;
65 static const std::string STRING_MATCH_ENDSWITH;
66 static const std::string STRING_MATCH_CASESENSITIVE;
68 static const int ACCOUNT_ID_NOT_INITIALIZED;
71 FolderQueryGenerator();
72 virtual ~FolderQueryGenerator();
74 void visitPreComposite(Api::Tizen::FilterType& type, int depth);
75 void visitInComposite(Api::Tizen::FilterType& type, int depth);
76 void visitPostComposite(Api::Tizen::FilterType& type, int depth);
77 void visitAttribute(std::string& attrName, Api::Tizen::AnyArrayPtr& values, std::string& matchFlag, bool caseSensitive, int depth);
78 void visitAttributeRange(std::string& attrName, Api::Tizen::AnyPtr& initialValue, Api::Tizen::AnyPtr& endValue, int depth);
79 void visitID(Api::Tizen::AnyArrayPtr &value, int depth);
82 std::string getFolderPath();
83 bool isFolderPathExist();
87 virtual bool getMatchExactlyClause(std::string& attrName, Api::Tizen::AnyPtr& value);
88 void visitAttributeEach(std::string& attrName, Api::Tizen::AnyPtr& value, std::string& matchFlag, int depth);
91 std::string getMatchStartsWithClause(std::string& attrName, Api::Tizen::AnyPtr& value);
92 std::string getMatchEndsWithClause(std::string& attrName, Api::Tizen::AnyPtr& value);
93 std::string getMatchContainsClause(std::string& attrName, Api::Tizen::AnyPtr& value);
97 typedef DPL::SharedPtr<FolderQueryGenerator> FolderQueryGeneratorPtr;
98 } // namespace Platform
99 } // namespace WrtPlugins