/src/open5gs/lib/sbi/openapi/model/ho_state.c
Line | Count | Source |
1 | | |
2 | | #include <stdlib.h> |
3 | | #include <string.h> |
4 | | #include <stdio.h> |
5 | | #include "ho_state.h" |
6 | | |
7 | | char* OpenAPI_ho_state_ToString(OpenAPI_ho_state_e ho_state) |
8 | 0 | { |
9 | 0 | const char *ho_stateArray[] = { "NULL", "NONE", "PREPARING", "PREPARED", "COMPLETED", "CANCELLED" }; |
10 | 0 | size_t sizeofArray = sizeof(ho_stateArray) / sizeof(ho_stateArray[0]); |
11 | 0 | if (ho_state < sizeofArray) |
12 | 0 | return (char *)ho_stateArray[ho_state]; |
13 | 0 | else |
14 | 0 | return (char *)"Unknown"; |
15 | 0 | } |
16 | | |
17 | | OpenAPI_ho_state_e OpenAPI_ho_state_FromString(char* ho_state) |
18 | 274 | { |
19 | 274 | int stringToReturn = 0; |
20 | 274 | const char *ho_stateArray[] = { "NULL", "NONE", "PREPARING", "PREPARED", "COMPLETED", "CANCELLED" }; |
21 | 274 | size_t sizeofArray = sizeof(ho_stateArray) / sizeof(ho_stateArray[0]); |
22 | 1.66k | while (stringToReturn < sizeofArray) { |
23 | 1.44k | if (strcmp(ho_state, ho_stateArray[stringToReturn]) == 0) { |
24 | 58 | return stringToReturn; |
25 | 58 | } |
26 | 1.38k | stringToReturn++; |
27 | 1.38k | } |
28 | 216 | return 0; |
29 | 274 | } |
30 | | |