Add #pragma once and extern C to YGEnums.h

Summary: Makes YGEnums.h header looks like other Yoga headers

Reviewed By: gkassabli

Differential Revision: D4274156

fbshipit-source-id: 9fa0ae146bb9e5bd40d93fa3c56f83424ebd2bf9
This commit is contained in:
Emil Sjolander
2016-12-05 04:58:55 -08:00
committed by Facebook Github Bot
parent 1b7ae2ed3d
commit 72cf6806de
2 changed files with 13 additions and 4 deletions

View File

@@ -7,6 +7,12 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#pragma once
#include "YGMacros.h"
YG_EXTERN_C_BEGIN
typedef enum YGFlexDirection {
YGFlexDirectionColumn,
YGFlexDirectionColumnReverse,
@@ -106,3 +112,5 @@ typedef enum YGAlign {
YGAlignStretch,
YGAlignCount,
} YGAlign;
YG_EXTERN_C_END

View File

@@ -116,7 +116,9 @@ root = os.path.dirname(__file__)
# write out C header
with open(root + '/CSSLayout/YGEnums.h', 'w') as f:
f.write(LICENSE)
remaining = len(ENUMS)
f.write('#pragma once\n\n')
f.write('#include "YGMacros.h"\n\n')
f.write('YG_EXTERN_C_BEGIN\n\n')
for name, values in ENUMS.items():
f.write('typedef enum YG%s {\n' % name)
for value in values:
@@ -126,9 +128,8 @@ with open(root + '/CSSLayout/YGEnums.h', 'w') as f:
f.write(' YG%s%s,\n' % (name, value))
f.write(' YG%sCount,\n' % name)
f.write('} YG%s;\n' % name)
if remaining > 1:
f.write('\n')
remaining = remaining - 1
f.write('YG_EXTERN_C_END\n')
# write out java files
for name, values in ENUMS.items():