summaryrefslogtreecommitdiff
path: root/include/smartsearch_define.h
blob: 2cf260901f31fd4010aaeb99bc7bbcf80e623aae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
 * Copyright 2012  Samsung Electronics Co., Ltd
 * 
 * Licensed under the Flora License, Version 1.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.tizenopensource.org/license
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */






#ifndef __DEF_SMARTSEARCH_DEFINE_H__
#define __DEF_SMARTSEARCH_DEFINE_H__


enum {
	SEARCH_TYPE_PHONE_CONTACTS = 0,
	SEARCH_TYPE_PHONE_MSG,
	SEARCH_TYPE_PHONE_EMAIL,
	SEARCH_TYPE_PHONE_IMAGES,
	SEARCH_TYPE_PHONE_MUSIC,
	SEARCH_TYPE_PHONE_VIDEO,
	SEARCH_TYPE_PHONE_CALENDAR,
	SEARCH_TYPE_PHONE_MEMO,
	SEARCH_TYPE_PHONE_MENU,
	SEARCH_TYPE_PHONE_MAX
};

enum {
	SEARCH_TYPE_PHONE = 0,
};

enum {
	LAUNCH_ERROR_FILE_NOT_FOUND = 1,
	LAUNCH_ERROR_AUL_LAUNCH,
	LAUNCH_ERROR_APPSVC,
	LAUNCH_ERROR_MAX
};

enum {
	BACK_BTN_TYPE_LOWER,
	BACK_BTN_TYPE_CLOSE
};

enum {
	SEARCH_CATE_BTN_IMG_TYPE_UNPRESSED,
	SEARCH_CATE_BTN_IMG_TYPE_PRESSED,
	SEARCH_CATE_BTN_IMG_TYPE_MAX
};

enum {
	SEARCH_RET_SEARCH_FAIL = -1,
	SEARCH_RET_SEARCH_NONE,
	SEARCH_RET_SEARCH_SUCCESS
};

enum {
	SEARCH_RET_FAIL = -1,
	SEARCH_RET_SUCCESS
};

enum {
	SEARCH_STMT_GET_HISTORY_ALL = 0,
	SEARCH_STMT_GET_HISTORY_WITH_KEYWORD,
	SEARCH_STMT_INSERT_KEYWORD,
	SEARCH_STMT_MAX
};

enum {
	SEARCH_SQL_BIND_TYPE_SIMPLEX = 0,
	SEARCH_SQL_BIND_TYPE_DUPLEX
};	

//==============================================================================================================================

#define SEARCH_PACKAGE "smartsearch"
#define SEARCH_ICON_PATH  RESDIR"/icons/"
#define SEARCH_EDJ EDJDIR"/smartsearch.edj"

#define DEF_BUF_LEN            (512)
#define MAX_LENGTH_PER_LINE    (512)
#define MAX_LENGTH_PER_PATH    (512)
#define MAX_LENGTH_PER_ID      (10)
#define MAX_SEARCH_WORD_SIZE   (128)

#define SMARTSEARCH_KEY_KEYWORD		"db/smartsearch/keyword"

#define PHONE_CATEGORY_LIST_CNT         (SEARCH_TYPE_PHONE_MAX)
#define DB_QUERY_LEN                    (512)

#define NO_RESULT_BODY_LEN	7

#define SEARCH_CATEGORY_LIST_MORE_CNT   (20)

#define DB_ESCAPE_CHAR		"|"


//==============================================================================================================================


#define SEARCH_FREE(ptr)	\
	do { \
		if(ptr != NULL)	\
		{	\
			free(ptr);	\
			ptr = NULL;	\
		}	\
	}while(0);

#define SEARCH_MALLOC(ptr, size, type) \
	do { \
		if(size > 0) { \
			ptr = (type *)malloc(size); \
			if(ptr == NULL) \
				assert(0); \
		} else { \
			assert(0); \
		} \
	} while(0);	

/* Gives comparison result of two strings and returns -1 if any of two is NULL */
#define SEARCH_STRCMP(str1, str2)	((str1 && str2) ? strcmp(str1, str2) : -1)	

/* Returns string length of src and 0 if it is NULL */
#define SEARCH_STRLEN(src)	((src != NULL)? strlen(src): 0)

#define SEARCH_SCALABLED_SIZE(size, _scale_factor)	(int)((size) * (_scale_factor))	

#endif