4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
26 #include "ail_private.h"
27 #include "ail_convert.h"
29 #define SIZEOFARRAY(x) (sizeof(x)/sizeof(x[0]))
31 struct _ail_str_map_t {
36 static struct _ail_str_map_t str_prop_map[] = {
37 {E_AIL_PROP_PACKAGE_STR, AIL_PROP_PACKAGE_STR},
38 {E_AIL_PROP_EXEC_STR, AIL_PROP_EXEC_STR},
39 {E_AIL_PROP_NAME_STR, AIL_PROP_NAME_STR},
40 {E_AIL_PROP_TYPE_STR, AIL_PROP_TYPE_STR},
41 {E_AIL_PROP_ICON_STR, AIL_PROP_ICON_STR},
42 {E_AIL_PROP_CATEGORIES_STR, AIL_PROP_CATEGORIES_STR},
43 {E_AIL_PROP_VERSION_STR, AIL_PROP_VERSION_STR},
44 {E_AIL_PROP_MIMETYPE_STR, AIL_PROP_MIMETYPE_STR},
45 {E_AIL_PROP_X_SLP_SERVICE_STR, AIL_PROP_X_SLP_SERVICE_STR},
46 {E_AIL_PROP_X_SLP_PACKAGETYPE_STR, AIL_PROP_X_SLP_PACKAGETYPE_STR},
47 {E_AIL_PROP_X_SLP_PACKAGECATEGORIES_STR, AIL_PROP_X_SLP_PACKAGECATEGORIES_STR},
48 {E_AIL_PROP_X_SLP_PACKAGEID_STR, AIL_PROP_X_SLP_PACKAGEID_STR},
49 {E_AIL_PROP_X_SLP_SVC_STR, AIL_PROP_X_SLP_SVC_STR},
50 {E_AIL_PROP_X_SLP_EXE_PATH, AIL_PROP_X_SLP_EXE_PATH},
51 {E_AIL_PROP_X_SLP_APPID_STR, AIL_PROP_X_SLP_APPID_STR},
52 {E_AIL_PROP_X_SLP_PKGID_STR, AIL_PROP_X_SLP_PKGID_STR},
53 {E_AIL_PROP_X_SLP_DOMAIN_STR, AIL_PROP_X_SLP_DOMAIN_STR},
54 {E_AIL_PROP_X_SLP_SUBMODEMAINID_STR, AIL_PROP_X_SLP_SUBMODEMAINID_STR},
55 {E_AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR, AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR}
58 struct _ail_int_map_t {
63 static struct _ail_int_map_t int_prop_map[] = {
64 {E_AIL_PROP_X_SLP_TEMP_INT, AIL_PROP_X_SLP_TEMP_INT},
65 {E_AIL_PROP_X_SLP_INSTALLEDTIME_INT, AIL_PROP_X_SLP_INSTALLEDTIME_INT}
68 struct _ail_bool_map_t {
73 static struct _ail_bool_map_t bool_prop_map[] = {
74 {E_AIL_PROP_NODISPLAY_BOOL, AIL_PROP_NODISPLAY_BOOL},
75 {E_AIL_PROP_X_SLP_TASKMANAGE_BOOL, AIL_PROP_X_SLP_TASKMANAGE_BOOL},
76 {E_AIL_PROP_X_SLP_MULTIPLE_BOOL, AIL_PROP_X_SLP_MULTIPLE_BOOL},
77 {E_AIL_PROP_X_SLP_REMOVABLE_BOOL, AIL_PROP_X_SLP_REMOVABLE_BOOL},
78 {E_AIL_PROP_X_SLP_ENABLED_BOOL, AIL_PROP_X_SLP_ENABLED_BOOL},
79 {E_AIL_PROP_X_SLP_SUBMODE_BOOL, AIL_PROP_X_SLP_SUBMODE_BOOL}
82 inline ail_prop_str_e _ail_convert_to_prop_str(const char *property)
85 ail_prop_str_e prop = -1;
87 retv_if(!property, AIL_ERROR_INVALID_PARAMETER);
89 for (i = 0; i < SIZEOFARRAY(str_prop_map); i++) {
90 if (strcmp(property, str_prop_map[i].property) == 0) {
91 prop = str_prop_map[i].prop;
99 inline ail_prop_int_e _ail_convert_to_prop_int(const char *property)
102 ail_prop_int_e prop = -1;
104 retv_if(!property, AIL_ERROR_INVALID_PARAMETER);
106 for (i = 0; i < SIZEOFARRAY(int_prop_map); i++) {
107 if (strcmp(property, int_prop_map[i].property) == 0) {
108 prop = int_prop_map[i].prop;
116 inline ail_prop_bool_e _ail_convert_to_prop_bool(const char *property)
119 ail_prop_bool_e prop = -1;
121 retv_if(!property, AIL_ERROR_INVALID_PARAMETER);
123 for (i = 0; i < SIZEOFARRAY(bool_prop_map); i++) {
124 if (strcmp(property, bool_prop_map[i].property) == 0) {
125 prop = bool_prop_map[i].prop;