1 /*
2  * Copyright (c) Facebook, Inc. and its affiliates.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #include <proxygen/lib/http/StatusTypeEnum.h>
10 
11 #define STATUS_TYPE_STR(statusType) #statusType
12 
13 namespace {
14 static const char* statusTypeStrings[] = {STATUS_TYPES_GEN(STATUS_TYPE_STR)};
15 }
16 
17 namespace proxygen {
18 
getStatusTypeString(StatusType statusType)19 const char* getStatusTypeString(StatusType statusType) {
20   int statusTypeInt = static_cast<int>(statusType);
21   if (static_cast<int>(statusType) < 0 ||
22       statusType >= StatusType::ENUM_COUNT) {
23     return statusTypeStrings[static_cast<int>(StatusType::ENUM_COUNT)];
24   } else {
25     return statusTypeStrings[statusTypeInt];
26   }
27 }
28 
29 } // namespace proxygen
30