2 * Copyright 2012 Samsung Electronics Co., Ltd
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
8 * http://floralicense.org/license/
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.
23 #include <sys/types.h>
27 #include "mf-ug-dlog.h"
28 #include "mf-ug-search.h"
29 #include "mf-ug-search-internal.h"
32 /*+++++++++++++++++++++++ APIs +++++++++++++++++++++++*/
34 int mf_ug_search_init(mf_search_handle *handle)
37 ms_handle_t *ms_handle = NULL;
42 if (!g_thread_supported()) {
45 ret = _mf_ug_search_init(&ms_handle);
47 ms_error("Fail to init search handle ");
48 *handle = (mf_search_handle) 0;
52 *handle = (mf_search_handle) ms_handle;
54 return MF_SEARCH_ERROR_NONE;
57 int mf_ug_search_start(mf_search_handle handle,
58 const char **root_path, unsigned int path_num, const char *needle, mf_search_option option, void *user_data)
62 return MF_SEARCH_ERROR_INVAL_P;
65 if (!root_path || !needle || path_num < 1) {
66 return MF_SEARCH_ERROR_INVAL_P;
69 ret = _mf_ug_search_start((ms_handle_t *) handle, root_path, path_num, needle, option, user_data);
72 ms_error("Fail to start search ");
77 int mf_ug_search_stop(mf_search_handle handle)
81 ret = _mf_ug_search_stop((ms_handle_t *) handle);
83 ms_error("Fail to stop search ");
88 void mf_ug_search_finalize(mf_search_handle *handle)
90 _mf_ug_search_finalize((ms_handle_t **) handle);
94 /*+++++++++++++++++++++++ UTIL APIs +++++++++++++++++++++++*/
96 char *mf_ug_search_result_dir_get(mf_search_result_t *result)
98 return _mf_ug_search_result_dir_get(result);
101 char *mf_ug_search_result_file_get(mf_search_result_t *result)
103 return _mf_ug_search_result_file_get(result);
106 int mf_ug_search_result_is_end(mf_search_result_t *result, int *is_end)
109 *is_end = _mf_ug_search_result_is_end(result);
111 return MF_SEARCH_ERROR_INVAL_P;
113 return MF_SEARCH_ERROR_NONE;
116 int mf_ug_search_result_total_count_get(mf_search_result_t *result, unsigned int *count)
119 *count = _mf_ug_search_result_total_count_get(result);
121 return MF_SEARCH_ERROR_INVAL_P;
123 return MF_SEARCH_ERROR_NONE;
126 char *mf_ug_search_result_current_dir_get(mf_search_result_t *result)
128 return _mf_ug_search_result_current_dir_get(result);