sync with master
[apps/osp/Call.git] / inc / CallSettingDataService.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 /**
18  * @file                CallSettingDataService.h
19  * @brief               This is the header file for the %CallSettingDataService class.
20  *
21  * This header file contains the declarations for %CallSettingDataService class.
22  */
23 #ifndef _PHN_CALL_SETTING_DATA_SERVICE_H_
24 #define _PHN_CALL_SETTING_DATA_SERVICE_H_
25
26 #include <FApp.h>
27 #include <FBase.h>
28 #include <FIo.h>
29 #include "CallRejectInfo.h"
30 #include "CallSpeedDialInfo.h"
31
32 /**
33  * @class CallSettingDataService
34  * @brief This class providing database service APIS to CallRejectInfo Application forms
35  *
36  */
37 class CallSettingDataService
38 {
39 public:
40         /**
41          * Creates an instance of its own.
42          * creates CallSettingDataService(singleton) if it does not exist else returns the existing form
43          */
44         static CallSettingDataService* CreateInstance(void);
45
46         virtual ~CallSettingDataService(void);
47
48         ///Opens the Database.
49         /**
50          * Only one Database is maintained. Its name is hardcoded.
51          * It is assumed that OpenDB is called once while starting the application and CloseDB is called once while closing application.
52          */
53         result OpenDatabase(void);
54
55         ///Closes the Database
56         result CloseDatabase(void);
57
58         ///Creates a database table to store CallRejectInfo information
59         result CreateCallRejectTableDatabase(void);
60         ///Creates a database table to store SpeedDial information
61         result CreateSpeedDialTableDatabase(void);
62         ///Searches for a keyword in the CallRejectInfo Contents from Database
63         /**
64          * @param search keyword
65          * @param Linked list to store the result of the search
66          */
67         bool IsCallToBeRejected(Tizen::Base::String& phoneNumber);
68
69 private:
70         /**
71          * Constructor
72          * made private as CallSettingDataService a singleton.
73          */
74         CallSettingDataService(void);
75
76         /**
77          * Copy constructor
78          * made private as CallSettingDataService a singleton.
79          */
80         CallSettingDataService(const CallSettingDataService& dataService);
81
82         /**
83          * Operator =
84          * made private as CallSettingDataService a singleton.
85          */
86         CallSettingDataService& operator =(const CallSettingDataService& dataService);
87
88         //checks if the condition is applicable for the passed phoneNumber
89         bool CheckRejectCondition(Tizen::Base::String& phoneNumber, CallRejectInfo& callRejectInfo);
90
91         ///singleton CallSettingDataService object
92         static CallSettingDataService* __pCallSettingDataService;
93
94         /// Database object
95         /**
96          * Its made static as we need only one instance of it across different CallSettingDataService object calls.
97          * Its created while calling OpenDB and distructed while calling CloseDB.
98          */
99         static Tizen::Io::Database* __pDatabase;
100
101         ///name of the database
102         const Tizen::Base::String __strDbName;
103
104         /// an Enumerator used to iterate through the results of a database query.
105         Tizen::Io::DbEnumerator* __pEnum;
106
107         /// Used to create and execute database statements(queries)
108         Tizen::Io::DbStatement* __pStmt;
109 };
110
111 #endif /* _PHN_CALL_SETTING_DATA_SERVICE_H_ */