YGEnums.cpp 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the LICENSE
  5. * file in the root directory of this source tree.
  6. */
  7. #include "YGEnums.h"
  8. const char* YGAlignToString(const YGAlign value) {
  9. switch (value) {
  10. case YGAlignAuto:
  11. return "auto";
  12. case YGAlignFlexStart:
  13. return "flex-start";
  14. case YGAlignCenter:
  15. return "center";
  16. case YGAlignFlexEnd:
  17. return "flex-end";
  18. case YGAlignStretch:
  19. return "stretch";
  20. case YGAlignBaseline:
  21. return "baseline";
  22. case YGAlignSpaceBetween:
  23. return "space-between";
  24. case YGAlignSpaceAround:
  25. return "space-around";
  26. }
  27. return "unknown";
  28. }
  29. const char* YGDimensionToString(const YGDimension value) {
  30. switch (value) {
  31. case YGDimensionWidth:
  32. return "width";
  33. case YGDimensionHeight:
  34. return "height";
  35. }
  36. return "unknown";
  37. }
  38. const char* YGDirectionToString(const YGDirection value) {
  39. switch (value) {
  40. case YGDirectionInherit:
  41. return "inherit";
  42. case YGDirectionLTR:
  43. return "ltr";
  44. case YGDirectionRTL:
  45. return "rtl";
  46. }
  47. return "unknown";
  48. }
  49. const char* YGDisplayToString(const YGDisplay value) {
  50. switch (value) {
  51. case YGDisplayFlex:
  52. return "flex";
  53. case YGDisplayNone:
  54. return "none";
  55. }
  56. return "unknown";
  57. }
  58. const char* YGEdgeToString(const YGEdge value) {
  59. switch (value) {
  60. case YGEdgeLeft:
  61. return "left";
  62. case YGEdgeTop:
  63. return "top";
  64. case YGEdgeRight:
  65. return "right";
  66. case YGEdgeBottom:
  67. return "bottom";
  68. case YGEdgeStart:
  69. return "start";
  70. case YGEdgeEnd:
  71. return "end";
  72. case YGEdgeHorizontal:
  73. return "horizontal";
  74. case YGEdgeVertical:
  75. return "vertical";
  76. case YGEdgeAll:
  77. return "all";
  78. }
  79. return "unknown";
  80. }
  81. const char* YGExperimentalFeatureToString(const YGExperimentalFeature value) {
  82. switch (value) {
  83. case YGExperimentalFeatureWebFlexBasis:
  84. return "web-flex-basis";
  85. }
  86. return "unknown";
  87. }
  88. const char* YGFlexDirectionToString(const YGFlexDirection value) {
  89. switch (value) {
  90. case YGFlexDirectionColumn:
  91. return "column";
  92. case YGFlexDirectionColumnReverse:
  93. return "column-reverse";
  94. case YGFlexDirectionRow:
  95. return "row";
  96. case YGFlexDirectionRowReverse:
  97. return "row-reverse";
  98. }
  99. return "unknown";
  100. }
  101. const char* YGJustifyToString(const YGJustify value) {
  102. switch (value) {
  103. case YGJustifyFlexStart:
  104. return "flex-start";
  105. case YGJustifyCenter:
  106. return "center";
  107. case YGJustifyFlexEnd:
  108. return "flex-end";
  109. case YGJustifySpaceBetween:
  110. return "space-between";
  111. case YGJustifySpaceAround:
  112. return "space-around";
  113. case YGJustifySpaceEvenly:
  114. return "space-evenly";
  115. }
  116. return "unknown";
  117. }
  118. const char* YGLogLevelToString(const YGLogLevel value) {
  119. switch (value) {
  120. case YGLogLevelError:
  121. return "error";
  122. case YGLogLevelWarn:
  123. return "warn";
  124. case YGLogLevelInfo:
  125. return "info";
  126. case YGLogLevelDebug:
  127. return "debug";
  128. case YGLogLevelVerbose:
  129. return "verbose";
  130. case YGLogLevelFatal:
  131. return "fatal";
  132. }
  133. return "unknown";
  134. }
  135. const char* YGMeasureModeToString(const YGMeasureMode value) {
  136. switch (value) {
  137. case YGMeasureModeUndefined:
  138. return "undefined";
  139. case YGMeasureModeExactly:
  140. return "exactly";
  141. case YGMeasureModeAtMost:
  142. return "at-most";
  143. }
  144. return "unknown";
  145. }
  146. const char* YGNodeTypeToString(const YGNodeType value) {
  147. switch (value) {
  148. case YGNodeTypeDefault:
  149. return "default";
  150. case YGNodeTypeText:
  151. return "text";
  152. }
  153. return "unknown";
  154. }
  155. const char* YGOverflowToString(const YGOverflow value) {
  156. switch (value) {
  157. case YGOverflowVisible:
  158. return "visible";
  159. case YGOverflowHidden:
  160. return "hidden";
  161. case YGOverflowScroll:
  162. return "scroll";
  163. }
  164. return "unknown";
  165. }
  166. const char* YGPositionTypeToString(const YGPositionType value) {
  167. switch (value) {
  168. case YGPositionTypeRelative:
  169. return "relative";
  170. case YGPositionTypeAbsolute:
  171. return "absolute";
  172. }
  173. return "unknown";
  174. }
  175. const char* YGPrintOptionsToString(const YGPrintOptions value) {
  176. switch (value) {
  177. case YGPrintOptionsLayout:
  178. return "layout";
  179. case YGPrintOptionsStyle:
  180. return "style";
  181. case YGPrintOptionsChildren:
  182. return "children";
  183. }
  184. return "unknown";
  185. }
  186. const char* YGUnitToString(const YGUnit value) {
  187. switch (value) {
  188. case YGUnitUndefined:
  189. return "undefined";
  190. case YGUnitPoint:
  191. return "point";
  192. case YGUnitPercent:
  193. return "percent";
  194. case YGUnitAuto:
  195. return "auto";
  196. }
  197. return "unknown";
  198. }
  199. const char* YGWrapToString(const YGWrap value) {
  200. switch (value) {
  201. case YGWrapNoWrap:
  202. return "no-wrap";
  203. case YGWrapWrap:
  204. return "wrap";
  205. case YGWrapWrapReverse:
  206. return "wrap-reverse";
  207. }
  208. return "unknown";
  209. }