e80c5006e0584c206c85ed6ee9ccb2b2991c7145
[platform/core/appfw/pkgmgr-info.git] / src / common / request_type.cc
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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 #include "request_type.hh"
18
19 namespace pkgmgr_common {
20
21 const char* ReqTypeToString(ReqType type) {
22   static const char* convertArray[] = {
23       "GET_PKG_INFO",
24       "GET_APP_INFO",
25       "SET_PKG_INFO",
26       "SET_CERT_INFO",
27       "GET_CERT_INFO",
28       "GET_PKG_DEP_INFO",
29       "READ_QUERY",
30       "WRITE_QUERY",
31       "COMMAND",
32       "CREATE_DB",
33       "CREATE_CACHE",
34       "REMOVE_ALL_CACHE",
35       "ERROR_REQ_TYPE"
36   };
37
38   if (type <= ReqType::REQ_TYPE_NONE || type >= ReqType::MAX)
39     return convertArray[ReqType::MAX];
40
41   return convertArray[type];
42 }
43
44 }  // namespace pkgmgr_common