apply FSL(Flora Software License)
[profile/ivi/org.tizen.browser.git] / src / database / browser-bookmark-db.h
1 /*\r
2   * Copyright 2012  Samsung Electronics Co., Ltd\r
3   *\r
4   * Licensed under the Flora License, Version 1.0 (the "License");\r
5   * you may not use this file except in compliance with the License.\r
6   * You may obtain a copy of the License at\r
7   *\r
8   *    http://www.tizenopensource.org/license\r
9   *\r
10   * Unless required by applicable law or agreed to in writing, software\r
11   * distributed under the License is distributed on an "AS IS" BASIS,\r
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13   * See the License for the specific language governing permissions and\r
14   * limitations under the License.\r
15   */\r
16 \r
17 #ifndef BROWSER_BOOKMARK_DB_H\r
18 #define BROWSER_BOOKMARK_DB_H\r
19 \r
20 #include "browser-config.h"\r
21 \r
22 extern "C" {\r
23 #include "db-util.h"\r
24 }\r
25 \r
26 #include <iostream>\r
27 #include <string>\r
28 #include <vector>\r
29 \r
30 class Browser_Bookmark_DB {\r
31 public:\r
32         struct bookmark_item {\r
33                 int id;\r
34                 std::string url;\r
35                 std::string title;\r
36                 Eina_Bool is_folder;\r
37                 int parent;\r
38                 int order_index;\r
39                 Eina_Bool is_editable;\r
40                 Eina_Bool is_delete;\r
41                 void *user_data_1;\r
42                 void *user_data_2;\r
43                 int user_data_3;\r
44         };\r
45 \r
46         struct bookmark_item_type {\r
47                 int id;\r
48                 bool is_folder;\r
49         };\r
50 \r
51         Browser_Bookmark_DB();\r
52         ~Browser_Bookmark_DB();\r
53 \r
54         Eina_Bool get_bookmark_list(std::vector<bookmark_item *> &list, int folder_id);\r
55         Eina_Bool get_folder_list(std::vector<bookmark_item *> &list);\r
56         Eina_Bool get_folder_id(int current_folder_id, const char *folder_name, int *folder_id);\r
57         std::string get_folder_name_by_id(const int folder_id);\r
58         Eina_Bool get_bookmark_id_by_title_url(int folder_id, const char *title, const char *url, int *bookmark_id);\r
59         bookmark_item *get_bookmark_item_by_id(int bookmark_id);\r
60         Eina_Bool get_untitled_folder_count(int *count);\r
61         Eina_Bool is_duplicated(int folder_id, const char *title, const char *url);\r
62         Eina_Bool is_duplicated(const char *folder_name);\r
63         Eina_Bool is_full(void);\r
64         Eina_Bool save_bookmark(int folder_id, const char *title, const char *url);\r
65         Eina_Bool save_folder(const char *folder_name);\r
66         Eina_Bool delete_bookmark(int bookmark_id);\r
67         Eina_Bool delete_folder(int folder_id);\r
68         Eina_Bool modify_bookmark_title(int bookmark_id, const char *title);\r
69         Eina_Bool modify_bookmark(int bookmark_id, int folder_id, const char *title, const char *url);\r
70         Eina_Bool modify_bookmark_order_index(int bookmark_id, int folder_id, int order_index); \r
71 private:\r
72         Eina_Bool _open_db(void);\r
73         Eina_Bool _close_db(void);\r
74         Eina_Bool _get_last_index(int folder_id, int *last_index);\r
75         \r
76         static sqlite3* m_db_descriptor;\r
77 };\r
78 \r
79 #endif  /* BROWSER_BOOKMARK_DB_H */\r
80 \r