2019-06-06 19:36:56 -07:00
|
|
|
/*
|
2021-12-30 15:08:43 -08:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2017-11-23 09:40:02 -08:00
|
|
|
*
|
2019-10-15 10:30:08 -07:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-11-23 09:40:02 -08:00
|
|
|
*/
|
2019-10-15 10:30:08 -07:00
|
|
|
|
2017-11-23 09:40:02 -08:00
|
|
|
#pragma once
|
2022-06-07 07:42:49 -07:00
|
|
|
|
2017-11-23 09:40:02 -08:00
|
|
|
#include <string>
|
|
|
|
|
2024-02-02 11:00:53 -08:00
|
|
|
#include <yoga/Yoga.h>
|
2017-11-23 09:40:02 -08:00
|
|
|
|
2023-07-12 09:38:40 -07:00
|
|
|
namespace facebook::yoga {
|
2017-11-23 09:40:02 -08:00
|
|
|
|
C++ Cleanup 4/N: Reorganize Log and YGNodePrint (#1354)
Summary:
X-link: https://github.com/facebook/react-native/pull/39220
Pull Request resolved: https://github.com/facebook/yoga/pull/1354
X-link: https://github.com/facebook/react-native/pull/39197
## This diff
Moves these files to a `yoga/debug` subdirectory and does some mild renaming, namespace adjustment, and removes Yoga internal log function from list of library exports.
## This stack
The organization of the C++ internals of Yoga are in need of attention.
1. Some of the C++ internals are namespaced, but others not.
2. Some of the namespaces include `detail`, but are meant to be used outside of the translation unit (FB Clang Tidy rules warn on any usage of these)
2. Most of the files are in a flat hierarchy, except for event tracing in its own folder
3. Some files and functions begin with YG, others don’t
4. Some functions are uppercase, others are not
5. Almost all of the interesting logic is in Yoga.cpp, and the file is too large to reason about
6. There are multiple grab bag files where folks put random functions they need in (Utils, BitUtils, Yoga-Internal.h)
7. There is no clear indication from file structure or type naming what is private vs not
8. Handles like `YGNodeRef` and `YGConfigRef` can be used to access internals just by importing headers
This stack does some much needed spring cleaning:
1. All non-public headers and C++ implementation details are in separate folders from the root level `yoga`. This will give us room to split up logic and add more files without too large a flat hierarchy
3. All private C++ internals are under the `facebook::yoga` namespace. Details namespaces are only ever used within the same header, as they are intended
4. Utils files are split
5. Most C++ internals drop the YG prefix
6. Most C++ internal function names are all lower camel case
7. We start to split up Yoga.cpp
8. Every header beginning with YG or at the top-level directory is public and C only, with the exception of Yoga-Internal.h which has non-public functions for bindings
9. It is not possible to use private APIs without static casting handles to internal classes
This will give us more leeway to continue splitting monolithic files, and consistent guidelines for style in new files as well.
These changes should not be breaking to any project using only public Yoga headers. This includes every usage of Yoga in fbsource except for RN Fabric which is currently tied to internals. This refactor should make that boundary clearer.
bypass-github-export-checks
Reviewed By: shwanton
Differential Revision: D48847259
fbshipit-source-id: c1607b1c6457d5a47039c735cdb7c365a301ebc0
2023-08-31 01:17:39 -07:00
|
|
|
void nodeToString(
|
2018-12-13 07:09:31 -08:00
|
|
|
std::string& str,
|
2024-02-02 11:00:53 -08:00
|
|
|
YGNodeRef node,
|
|
|
|
YGPrintOptions options,
|
2017-11-23 09:40:02 -08:00
|
|
|
uint32_t level);
|
|
|
|
|
2023-07-12 09:38:40 -07:00
|
|
|
} // namespace facebook::yoga
|