diff --git a/CMakeLists.txt b/CMakeLists.txt index 1654da035..ae5189e3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,63 +22,63 @@ add_library(${CORE_WIDGETS_ADDON} SHARED "${CMAKE_JS_SRC}" "${PROJECT_SOURCE_DIR}/src/cpp/main.cpp" # core internals - "${PROJECT_SOURCE_DIR}/src/cpp/Extras/Utils/nutils.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/core/FlexLayout/flexlayout.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/core/FlexLayout/flexitem.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/core/YogaWidget/nodestyle.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/core/Events/eventsmap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/core/Events/eventwidget.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/core/YogaWidget/yogawidget.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/Extras/Utils/nutils.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/core/FlexLayout/flexlayout.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/core/FlexLayout/flexitem.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/core/YogaWidget/nodestyle.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/core/Events/eventsmap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/core/Events/eventwidget.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/core/YogaWidget/yogawidget.cpp" # core deps - "${PROJECT_SOURCE_DIR}/deps/yoga/log.cpp" - "${PROJECT_SOURCE_DIR}/deps/yoga/Utils.cpp" - "${PROJECT_SOURCE_DIR}/deps/yoga/YGConfig.cpp" - "${PROJECT_SOURCE_DIR}/deps/yoga/YGEnums.cpp" - "${PROJECT_SOURCE_DIR}/deps/yoga/YGLayout.cpp" - "${PROJECT_SOURCE_DIR}/deps/yoga/YGNode.cpp" - "${PROJECT_SOURCE_DIR}/deps/yoga/YGNodePrint.cpp" - "${PROJECT_SOURCE_DIR}/deps/yoga/YGStyle.cpp" - "${PROJECT_SOURCE_DIR}/deps/yoga/YGValue.cpp" - "${PROJECT_SOURCE_DIR}/deps/yoga/Yoga.cpp" - "${PROJECT_SOURCE_DIR}/deps/yoga/event/event.cpp" - "${PROJECT_SOURCE_DIR}/deps/yoga/internal/experiments.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/deps/yoga/log.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/deps/yoga/Utils.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/deps/yoga/YGConfig.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/deps/yoga/YGEnums.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/deps/yoga/YGLayout.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/deps/yoga/YGNode.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/deps/yoga/YGNodePrint.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/deps/yoga/YGStyle.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/deps/yoga/YGValue.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/deps/yoga/Yoga.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/deps/yoga/event/event.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/deps/yoga/internal/experiments.cpp" # wrapped cpps - "${PROJECT_SOURCE_DIR}/src/cpp/QtGui/QApplication/qapplication_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtGui/QClipboard/qclipboard_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtGui/QPixmap/qpixmap_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtGui/QIcon/qicon_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtGui/QCursor/qcursor_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QWidget/qwidget_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QGridLayout/qgridlayout_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QDial/qdial_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QLabel/qlabel_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QLayout/qlayout_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QSpinBox/qspinbox_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QCheckBox/qcheckbox_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QProgressBar/qprogressbar_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QRadioButton/qradiobutton_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QTabWidget/qtabwidget_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QLineEdit/qlineedit_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QScrollArea/qscrollarea_wrap.cpp" - "${PROJECT_SOURCE_DIR}/src/cpp/core/FlexLayout/flexlayout_wrap.cpp" - # Custom widgets - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QWidget/nwidget.hpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QLabel/nlabel.hpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QCheckBox/ncheckbox.hpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QDial/ndial.hpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QLineEdit/nlineedit.hpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QMainWindow/nmainwindow.hpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QProgressBar/nprogressbar.hpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QPushButton/npushbutton.hpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QSpinBox/nspinbox.hpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QRadioButton/nradiobutton.hpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QPlainTextEdit/nplaintextedit.hpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QScrollArea/nscrollarea.hpp" - "${PROJECT_SOURCE_DIR}/src/cpp/QtWidgets/QTabWidget/ntabwidget.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QApplication/qapplication_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QClipboard/qclipboard_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QPixmap/qpixmap_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QIcon/qicon_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QCursor/qcursor_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QWidget/qwidget_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QGridLayout/qgridlayout_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QDial/qdial_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QLabel/qlabel_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QLayout/qlayout_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QMainWindow/qmainwindow_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QPushButton/qpushbutton_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QSpinBox/qspinbox_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QCheckBox/qcheckbox_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QProgressBar/qprogressbar_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QRadioButton/qradiobutton_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QTabWidget/qtabwidget_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QLineEdit/qlineedit_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QScrollArea/qscrollarea_wrap.cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/lib/core/FlexLayout/flexlayout_wrap.cpp" + # Custom widgets (include them for automoc since they contain Q_OBJECT) + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QWidget/nwidget.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QLabel/nlabel.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QCheckBox/ncheckbox.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QDial/ndial.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QLineEdit/nlineedit.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QMainWindow/nmainwindow.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QProgressBar/nprogressbar.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QPushButton/npushbutton.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QSpinBox/nspinbox.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QRadioButton/nradiobutton.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QPlainTextEdit/nplaintextedit.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QScrollArea/nscrollarea.hpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QTabWidget/ntabwidget.hpp" ) # common @@ -96,7 +96,13 @@ AddNapiSupport(${CORE_WIDGETS_ADDON}) target_include_directories(${CORE_WIDGETS_ADDON} PRIVATE "${CMAKE_JS_INC}" "${PROJECT_SOURCE_DIR}" - "${PROJECT_SOURCE_DIR}/deps" + "${PROJECT_SOURCE_DIR}/src/cpp/deps" + "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui" +) + +target_include_directories(${CORE_WIDGETS_ADDON} PUBLIC + "${PROJECT_SOURCE_DIR}/src/cpp" + "${PROJECT_SOURCE_DIR}/src/cpp/include" ) target_link_libraries(${CORE_WIDGETS_ADDON} PRIVATE diff --git a/deps/yoga/YGLayout.h b/deps/yoga/YGLayout.h deleted file mode 100644 index 74082a764..000000000 --- a/deps/yoga/YGLayout.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once -#include "YGFloatOptional.h" -#include "Yoga-internal.h" - -struct YGLayout { - std::array position = {}; - std::array dimensions = {{YGUndefined, YGUndefined}}; - std::array margin = {}; - std::array border = {}; - std::array padding = {}; - YGDirection direction : 2; - bool didUseLegacyFlag : 1; - bool doesLegacyStretchFlagAffectsLayout : 1; - bool hadOverflow : 1; - - uint32_t computedFlexBasisGeneration = 0; - YGFloatOptional computedFlexBasis = {}; - - // Instead of recomputing the entire layout every single time, we cache some - // information to break early when nothing changed - uint32_t generationCount = 0; - YGDirection lastOwnerDirection = (YGDirection) -1; - - uint32_t nextCachedMeasurementsIndex = 0; - std::array - cachedMeasurements = {}; - std::array measuredDimensions = {{YGUndefined, YGUndefined}}; - - YGCachedMeasurement cachedLayout = YGCachedMeasurement(); - - YGLayout() - : direction(YGDirectionInherit), - didUseLegacyFlag(false), - doesLegacyStretchFlagAffectsLayout(false), - hadOverflow(false) {} - - bool operator==(YGLayout layout) const; - bool operator!=(YGLayout layout) const { return !(*this == layout); } -}; diff --git a/deps/yoga/YGStyle.h b/deps/yoga/YGStyle.h deleted file mode 100644 index ce3816040..000000000 --- a/deps/yoga/YGStyle.h +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. - */ -#pragma once -#include -#include -#include -#include -#include -#include "CompactValue.h" -#include "YGEnums.h" -#include "YGFloatOptional.h" -#include "Yoga-internal.h" -#include "Yoga.h" - -#if !defined(ENUM_BITFIELDS_NOT_SUPPORTED) -#define BITFIELD_ENUM_SIZED(num) : num -#else -#define BITFIELD_ENUM_SIZED(num) -#endif - -#define BITFIELD_ACCESSORS(FIELD) \ - decltype(FIELD##_) get_##FIELD() const { return FIELD##_; } \ - void set_##FIELD(decltype(FIELD##_) x) { FIELD##_ = x; } - -#define BITFIELD_REF(FIELD) \ - BitfieldRef< \ - decltype(FIELD##_), \ - &YGStyle::get_##FIELD, \ - &YGStyle::set_##FIELD, \ - FIELD##Bit> - -class YGStyle { - template - using Values = - facebook::yoga::detail::Values()>; - using CompactValue = facebook::yoga::detail::CompactValue; - - static constexpr uint64_t allBits(int fromBit, int toBit) { - return fromBit < toBit - ? (uint64_t{1} << fromBit) | allBits(fromBit + 1, toBit) - : 0; - } - -public: - using Dimensions = Values; - using Edges = Values; - - template - struct Ref { - YGStyle& style; - operator T() const { return style.*Prop; } - Ref& operator=(T value) { - style.*Prop = value; - style.assignedProps_.set(PropBit); - return *this; - } - }; - - template YGStyle::*Prop, int PropBit> - struct IdxRef { - struct Ref { - YGStyle& style; - Idx idx; - operator CompactValue() const { return (style.*Prop)[idx]; } - operator YGValue() const { return (style.*Prop)[idx]; } - Ref& operator=(CompactValue value) { - (style.*Prop)[idx] = value; - style.assignedProps_.set(PropBit + idx); - return *this; - } - }; - - YGStyle& style; - IdxRef& operator=(const Values& values) { - style.*Prop = values; - style.assignedProps_ |= - allBits(PropBit, PropBit + facebook::yoga::enums::count()); - return *this; - } - operator const Values&() const { return style.*Prop; } - Ref operator[](Idx idx) { return {style, idx}; } - CompactValue operator[](Idx idx) const { return (style.*Prop)[idx]; } - }; - - template < - typename T, - T (YGStyle::*Get)() const, - void (YGStyle::*Set)(T), - int PropBit> - struct BitfieldRef { - YGStyle& style; - - operator T() const { return (style.*Get)(); } - BitfieldRef& operator=(T x) { - (style.*Set)(x); - style.assignedProps_.set(PropBit); - return *this; - } - }; - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wbitfield-constant-conversion" -#endif - - YGStyle() - : direction_(YGDirectionInherit), - flexDirection_(YGFlexDirectionColumn), - justifyContent_(YGJustifyFlexStart), - alignContent_(YGAlignFlexStart), - alignItems_(YGAlignStretch), - alignSelf_(YGAlignAuto), - positionType_(YGPositionTypeRelative), - flexWrap_(YGWrapNoWrap), - overflow_(YGOverflowVisible), - display_(YGDisplayFlex) {} - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - - ~YGStyle() = default; - - static constexpr int directionBit = 0; - static constexpr int flexDirectionBit = directionBit + 1; - static constexpr int justifyContentBit = flexDirectionBit + 1; - static constexpr int alignContentBit = justifyContentBit + 1; - static constexpr int alignItemsBit = alignContentBit + 1; - static constexpr int alignSelfBit = alignItemsBit + 1; - static constexpr int positionTypeBit = alignSelfBit + 1; - static constexpr int flexWrapBit = positionTypeBit + 1; - static constexpr int overflowBit = flexWrapBit + 1; - static constexpr int displayBit = overflowBit + 1; - static constexpr int flexBit = displayBit + 1; - static constexpr int flexGrowBit = flexBit + 1; - static constexpr int flexShrinkBit = flexGrowBit + 1; - static constexpr int flexBasisBit = flexShrinkBit + 1; - static constexpr int marginBit = flexBasisBit + 1; - static constexpr int positionBit = - marginBit + facebook::yoga::enums::count(); - static constexpr int paddingBit = - positionBit + facebook::yoga::enums::count(); - static constexpr int borderBit = - paddingBit + facebook::yoga::enums::count(); - static constexpr int dimensionsBit = - borderBit + facebook::yoga::enums::count(); - static constexpr int maxDimensionsBit = - dimensionsBit + facebook::yoga::enums::count(); - static constexpr int minDimensionsBit = - maxDimensionsBit + facebook::yoga::enums::count(); - static constexpr int aspectRatioBit = - minDimensionsBit + facebook::yoga::enums::count(); - - static constexpr int numStyles = aspectRatioBit + 1; - -private: - std::bitset assignedProps_; - - /* Some platforms don't support enum bitfields, - so please use BITFIELD_ENUM_SIZED(BITS_COUNT) */ - YGDirection direction_ BITFIELD_ENUM_SIZED(2); - YGFlexDirection flexDirection_ BITFIELD_ENUM_SIZED(2); - YGJustify justifyContent_ BITFIELD_ENUM_SIZED(3); - YGAlign alignContent_ BITFIELD_ENUM_SIZED(3); - YGAlign alignItems_ BITFIELD_ENUM_SIZED(3); - YGAlign alignSelf_ BITFIELD_ENUM_SIZED(3); - YGPositionType positionType_ BITFIELD_ENUM_SIZED(1); - YGWrap flexWrap_ BITFIELD_ENUM_SIZED(2); - YGOverflow overflow_ BITFIELD_ENUM_SIZED(2); - YGDisplay display_ BITFIELD_ENUM_SIZED(1); - YGFloatOptional flex_ = {}; - YGFloatOptional flexGrow_ = {}; - YGFloatOptional flexShrink_ = {}; - CompactValue flexBasis_ = CompactValue::ofAuto(); - Edges margin_ = {}; - Edges position_ = {}; - Edges padding_ = {}; - Edges border_ = {}; - Dimensions dimensions_{CompactValue::ofAuto()}; - Dimensions minDimensions_ = {}; - Dimensions maxDimensions_ = {}; - // Yoga specific properties, not compatible with flexbox specification - YGFloatOptional aspectRatio_ = {}; - - BITFIELD_ACCESSORS(direction) - BITFIELD_ACCESSORS(flexDirection) - BITFIELD_ACCESSORS(justifyContent) - BITFIELD_ACCESSORS(alignContent); - BITFIELD_ACCESSORS(alignItems); - BITFIELD_ACCESSORS(alignSelf); - BITFIELD_ACCESSORS(positionType); - BITFIELD_ACCESSORS(flexWrap); - BITFIELD_ACCESSORS(overflow); - BITFIELD_ACCESSORS(display); - -public: - const decltype(assignedProps_)& assignedProps() const { - return assignedProps_; - } - - // for library users needing a type - using ValueRepr = std::remove_reference::type; - - YGDirection direction() const { return direction_; } - BITFIELD_REF(direction) direction() { return {*this}; } - - YGFlexDirection flexDirection() const { return flexDirection_; } - BITFIELD_REF(flexDirection) flexDirection() { return {*this}; } - - YGJustify justifyContent() const { return justifyContent_; } - BITFIELD_REF(justifyContent) justifyContent() { return {*this}; } - - YGAlign alignContent() const { return alignContent_; } - BITFIELD_REF(alignContent) alignContent() { return {*this}; } - - YGAlign alignItems() const { return alignItems_; } - BITFIELD_REF(alignItems) alignItems() { return {*this}; } - - YGAlign alignSelf() const { return alignSelf_; } - BITFIELD_REF(alignSelf) alignSelf() { return {*this}; } - - YGPositionType positionType() const { return positionType_; } - BITFIELD_REF(positionType) positionType() { return {*this}; } - - YGWrap flexWrap() const { return flexWrap_; } - BITFIELD_REF(flexWrap) flexWrap() { return {*this}; } - - YGOverflow overflow() const { return overflow_; } - BITFIELD_REF(overflow) overflow() { return {*this}; } - - YGDisplay display() const { return display_; } - BITFIELD_REF(display) display() { return {*this}; } - - YGFloatOptional flex() const { return flex_; } - Ref flex() { return {*this}; } - - YGFloatOptional flexGrow() const { return flexGrow_; } - Ref flexGrow() { - return {*this}; - } - - YGFloatOptional flexShrink() const { return flexShrink_; } - Ref flexShrink() { - return {*this}; - } - - CompactValue flexBasis() const { return flexBasis_; } - Ref flexBasis() { - return {*this}; - } - - const Edges& margin() const { return margin_; } - IdxRef margin() { return {*this}; } - - const Edges& position() const { return position_; } - IdxRef position() { - return {*this}; - } - - const Edges& padding() const { return padding_; } - IdxRef padding() { return {*this}; } - - const Edges& border() const { return border_; } - IdxRef border() { return {*this}; } - - const Dimensions& dimensions() const { return dimensions_; } - IdxRef dimensions() { - return {*this}; - } - - const Dimensions& minDimensions() const { return minDimensions_; } - IdxRef - minDimensions() { - return {*this}; - } - - const Dimensions& maxDimensions() const { return maxDimensions_; } - IdxRef - maxDimensions() { - return {*this}; - } - - // Yoga specific properties, not compatible with flexbox specification - YGFloatOptional aspectRatio() const { return aspectRatio_; } - Ref aspectRatio() { - return {*this}; - } -}; - -bool operator==(const YGStyle& lhs, const YGStyle& rhs); -inline bool operator!=(const YGStyle& lhs, const YGStyle& rhs) { - return !(lhs == rhs); -} - -#undef BITFIELD_ENUM_SIZED -#undef BITFIELD_ACCESSORS -#undef BITFIELD_REF diff --git a/deps/spdlog/async.h b/src/cpp/deps/spdlog/async.h similarity index 100% rename from deps/spdlog/async.h rename to src/cpp/deps/spdlog/async.h diff --git a/deps/spdlog/async_logger.h b/src/cpp/deps/spdlog/async_logger.h similarity index 100% rename from deps/spdlog/async_logger.h rename to src/cpp/deps/spdlog/async_logger.h diff --git a/deps/spdlog/common.h b/src/cpp/deps/spdlog/common.h similarity index 100% rename from deps/spdlog/common.h rename to src/cpp/deps/spdlog/common.h diff --git a/deps/spdlog/details/async_logger_impl.h b/src/cpp/deps/spdlog/details/async_logger_impl.h similarity index 100% rename from deps/spdlog/details/async_logger_impl.h rename to src/cpp/deps/spdlog/details/async_logger_impl.h diff --git a/deps/spdlog/details/circular_q.h b/src/cpp/deps/spdlog/details/circular_q.h similarity index 100% rename from deps/spdlog/details/circular_q.h rename to src/cpp/deps/spdlog/details/circular_q.h diff --git a/deps/spdlog/details/console_globals.h b/src/cpp/deps/spdlog/details/console_globals.h similarity index 100% rename from deps/spdlog/details/console_globals.h rename to src/cpp/deps/spdlog/details/console_globals.h diff --git a/deps/spdlog/details/file_helper.h b/src/cpp/deps/spdlog/details/file_helper.h similarity index 100% rename from deps/spdlog/details/file_helper.h rename to src/cpp/deps/spdlog/details/file_helper.h diff --git a/deps/spdlog/details/fmt_helper.h b/src/cpp/deps/spdlog/details/fmt_helper.h similarity index 100% rename from deps/spdlog/details/fmt_helper.h rename to src/cpp/deps/spdlog/details/fmt_helper.h diff --git a/deps/spdlog/details/log_msg.h b/src/cpp/deps/spdlog/details/log_msg.h similarity index 100% rename from deps/spdlog/details/log_msg.h rename to src/cpp/deps/spdlog/details/log_msg.h diff --git a/deps/spdlog/details/logger_impl.h b/src/cpp/deps/spdlog/details/logger_impl.h similarity index 100% rename from deps/spdlog/details/logger_impl.h rename to src/cpp/deps/spdlog/details/logger_impl.h diff --git a/deps/spdlog/details/mpmc_blocking_q.h b/src/cpp/deps/spdlog/details/mpmc_blocking_q.h similarity index 100% rename from deps/spdlog/details/mpmc_blocking_q.h rename to src/cpp/deps/spdlog/details/mpmc_blocking_q.h diff --git a/deps/spdlog/details/null_mutex.h b/src/cpp/deps/spdlog/details/null_mutex.h similarity index 100% rename from deps/spdlog/details/null_mutex.h rename to src/cpp/deps/spdlog/details/null_mutex.h diff --git a/deps/spdlog/details/os.h b/src/cpp/deps/spdlog/details/os.h similarity index 100% rename from deps/spdlog/details/os.h rename to src/cpp/deps/spdlog/details/os.h diff --git a/deps/spdlog/details/pattern_formatter.h b/src/cpp/deps/spdlog/details/pattern_formatter.h similarity index 100% rename from deps/spdlog/details/pattern_formatter.h rename to src/cpp/deps/spdlog/details/pattern_formatter.h diff --git a/deps/spdlog/details/periodic_worker.h b/src/cpp/deps/spdlog/details/periodic_worker.h similarity index 100% rename from deps/spdlog/details/periodic_worker.h rename to src/cpp/deps/spdlog/details/periodic_worker.h diff --git a/deps/spdlog/details/registry.h b/src/cpp/deps/spdlog/details/registry.h similarity index 100% rename from deps/spdlog/details/registry.h rename to src/cpp/deps/spdlog/details/registry.h diff --git a/deps/spdlog/details/thread_pool.h b/src/cpp/deps/spdlog/details/thread_pool.h similarity index 100% rename from deps/spdlog/details/thread_pool.h rename to src/cpp/deps/spdlog/details/thread_pool.h diff --git a/deps/spdlog/fmt/bin_to_hex.h b/src/cpp/deps/spdlog/fmt/bin_to_hex.h similarity index 100% rename from deps/spdlog/fmt/bin_to_hex.h rename to src/cpp/deps/spdlog/fmt/bin_to_hex.h diff --git a/deps/spdlog/fmt/bundled/LICENSE.rst b/src/cpp/deps/spdlog/fmt/bundled/LICENSE.rst similarity index 100% rename from deps/spdlog/fmt/bundled/LICENSE.rst rename to src/cpp/deps/spdlog/fmt/bundled/LICENSE.rst diff --git a/deps/spdlog/fmt/bundled/chrono.h b/src/cpp/deps/spdlog/fmt/bundled/chrono.h similarity index 100% rename from deps/spdlog/fmt/bundled/chrono.h rename to src/cpp/deps/spdlog/fmt/bundled/chrono.h diff --git a/deps/spdlog/fmt/bundled/color.h b/src/cpp/deps/spdlog/fmt/bundled/color.h similarity index 100% rename from deps/spdlog/fmt/bundled/color.h rename to src/cpp/deps/spdlog/fmt/bundled/color.h diff --git a/deps/spdlog/fmt/bundled/core.h b/src/cpp/deps/spdlog/fmt/bundled/core.h similarity index 100% rename from deps/spdlog/fmt/bundled/core.h rename to src/cpp/deps/spdlog/fmt/bundled/core.h diff --git a/deps/spdlog/fmt/bundled/format-inl.h b/src/cpp/deps/spdlog/fmt/bundled/format-inl.h similarity index 100% rename from deps/spdlog/fmt/bundled/format-inl.h rename to src/cpp/deps/spdlog/fmt/bundled/format-inl.h diff --git a/deps/spdlog/fmt/bundled/format.h b/src/cpp/deps/spdlog/fmt/bundled/format.h similarity index 100% rename from deps/spdlog/fmt/bundled/format.h rename to src/cpp/deps/spdlog/fmt/bundled/format.h diff --git a/deps/spdlog/fmt/bundled/locale.h b/src/cpp/deps/spdlog/fmt/bundled/locale.h similarity index 100% rename from deps/spdlog/fmt/bundled/locale.h rename to src/cpp/deps/spdlog/fmt/bundled/locale.h diff --git a/deps/spdlog/fmt/bundled/ostream.h b/src/cpp/deps/spdlog/fmt/bundled/ostream.h similarity index 100% rename from deps/spdlog/fmt/bundled/ostream.h rename to src/cpp/deps/spdlog/fmt/bundled/ostream.h diff --git a/deps/spdlog/fmt/bundled/posix.h b/src/cpp/deps/spdlog/fmt/bundled/posix.h similarity index 100% rename from deps/spdlog/fmt/bundled/posix.h rename to src/cpp/deps/spdlog/fmt/bundled/posix.h diff --git a/deps/spdlog/fmt/bundled/printf.h b/src/cpp/deps/spdlog/fmt/bundled/printf.h similarity index 100% rename from deps/spdlog/fmt/bundled/printf.h rename to src/cpp/deps/spdlog/fmt/bundled/printf.h diff --git a/deps/spdlog/fmt/bundled/ranges.h b/src/cpp/deps/spdlog/fmt/bundled/ranges.h similarity index 100% rename from deps/spdlog/fmt/bundled/ranges.h rename to src/cpp/deps/spdlog/fmt/bundled/ranges.h diff --git a/deps/spdlog/fmt/bundled/time.h b/src/cpp/deps/spdlog/fmt/bundled/time.h similarity index 100% rename from deps/spdlog/fmt/bundled/time.h rename to src/cpp/deps/spdlog/fmt/bundled/time.h diff --git a/deps/spdlog/fmt/fmt.h b/src/cpp/deps/spdlog/fmt/fmt.h similarity index 100% rename from deps/spdlog/fmt/fmt.h rename to src/cpp/deps/spdlog/fmt/fmt.h diff --git a/deps/spdlog/fmt/ostr.h b/src/cpp/deps/spdlog/fmt/ostr.h similarity index 100% rename from deps/spdlog/fmt/ostr.h rename to src/cpp/deps/spdlog/fmt/ostr.h diff --git a/deps/spdlog/formatter.h b/src/cpp/deps/spdlog/formatter.h similarity index 100% rename from deps/spdlog/formatter.h rename to src/cpp/deps/spdlog/formatter.h diff --git a/deps/spdlog/logger.h b/src/cpp/deps/spdlog/logger.h similarity index 100% rename from deps/spdlog/logger.h rename to src/cpp/deps/spdlog/logger.h diff --git a/deps/spdlog/sinks/android_sink.h b/src/cpp/deps/spdlog/sinks/android_sink.h similarity index 100% rename from deps/spdlog/sinks/android_sink.h rename to src/cpp/deps/spdlog/sinks/android_sink.h diff --git a/deps/spdlog/sinks/ansicolor_sink.h b/src/cpp/deps/spdlog/sinks/ansicolor_sink.h similarity index 100% rename from deps/spdlog/sinks/ansicolor_sink.h rename to src/cpp/deps/spdlog/sinks/ansicolor_sink.h diff --git a/deps/spdlog/sinks/base_sink.h b/src/cpp/deps/spdlog/sinks/base_sink.h similarity index 100% rename from deps/spdlog/sinks/base_sink.h rename to src/cpp/deps/spdlog/sinks/base_sink.h diff --git a/deps/spdlog/sinks/basic_file_sink.h b/src/cpp/deps/spdlog/sinks/basic_file_sink.h similarity index 100% rename from deps/spdlog/sinks/basic_file_sink.h rename to src/cpp/deps/spdlog/sinks/basic_file_sink.h diff --git a/deps/spdlog/sinks/daily_file_sink.h b/src/cpp/deps/spdlog/sinks/daily_file_sink.h similarity index 100% rename from deps/spdlog/sinks/daily_file_sink.h rename to src/cpp/deps/spdlog/sinks/daily_file_sink.h diff --git a/deps/spdlog/sinks/dist_sink.h b/src/cpp/deps/spdlog/sinks/dist_sink.h similarity index 100% rename from deps/spdlog/sinks/dist_sink.h rename to src/cpp/deps/spdlog/sinks/dist_sink.h diff --git a/deps/spdlog/sinks/msvc_sink.h b/src/cpp/deps/spdlog/sinks/msvc_sink.h similarity index 100% rename from deps/spdlog/sinks/msvc_sink.h rename to src/cpp/deps/spdlog/sinks/msvc_sink.h diff --git a/deps/spdlog/sinks/null_sink.h b/src/cpp/deps/spdlog/sinks/null_sink.h similarity index 100% rename from deps/spdlog/sinks/null_sink.h rename to src/cpp/deps/spdlog/sinks/null_sink.h diff --git a/deps/spdlog/sinks/ostream_sink.h b/src/cpp/deps/spdlog/sinks/ostream_sink.h similarity index 100% rename from deps/spdlog/sinks/ostream_sink.h rename to src/cpp/deps/spdlog/sinks/ostream_sink.h diff --git a/deps/spdlog/sinks/rotating_file_sink.h b/src/cpp/deps/spdlog/sinks/rotating_file_sink.h similarity index 100% rename from deps/spdlog/sinks/rotating_file_sink.h rename to src/cpp/deps/spdlog/sinks/rotating_file_sink.h diff --git a/deps/spdlog/sinks/sink.h b/src/cpp/deps/spdlog/sinks/sink.h similarity index 100% rename from deps/spdlog/sinks/sink.h rename to src/cpp/deps/spdlog/sinks/sink.h diff --git a/deps/spdlog/sinks/stdout_color_sinks.h b/src/cpp/deps/spdlog/sinks/stdout_color_sinks.h similarity index 100% rename from deps/spdlog/sinks/stdout_color_sinks.h rename to src/cpp/deps/spdlog/sinks/stdout_color_sinks.h diff --git a/deps/spdlog/sinks/stdout_sinks.h b/src/cpp/deps/spdlog/sinks/stdout_sinks.h similarity index 100% rename from deps/spdlog/sinks/stdout_sinks.h rename to src/cpp/deps/spdlog/sinks/stdout_sinks.h diff --git a/deps/spdlog/sinks/syslog_sink.h b/src/cpp/deps/spdlog/sinks/syslog_sink.h similarity index 100% rename from deps/spdlog/sinks/syslog_sink.h rename to src/cpp/deps/spdlog/sinks/syslog_sink.h diff --git a/deps/spdlog/sinks/wincolor_sink.h b/src/cpp/deps/spdlog/sinks/wincolor_sink.h similarity index 100% rename from deps/spdlog/sinks/wincolor_sink.h rename to src/cpp/deps/spdlog/sinks/wincolor_sink.h diff --git a/deps/spdlog/spdlog.h b/src/cpp/deps/spdlog/spdlog.h similarity index 100% rename from deps/spdlog/spdlog.h rename to src/cpp/deps/spdlog/spdlog.h diff --git a/deps/spdlog/tweakme.h b/src/cpp/deps/spdlog/tweakme.h similarity index 100% rename from deps/spdlog/tweakme.h rename to src/cpp/deps/spdlog/tweakme.h diff --git a/deps/spdlog/version.h b/src/cpp/deps/spdlog/version.h similarity index 100% rename from deps/spdlog/version.h rename to src/cpp/deps/spdlog/version.h diff --git a/src/cpp/deps/yoga/Bitfield.h b/src/cpp/deps/yoga/Bitfield.h new file mode 100644 index 000000000..da85a5bf3 --- /dev/null +++ b/src/cpp/deps/yoga/Bitfield.h @@ -0,0 +1,144 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. + */ +#pragma once + +#include +#include +#include +#include + +namespace facebook { +namespace yoga { + +namespace detail { + +constexpr size_t log2ceil(size_t n) { + return n < 1 ? 0 : (1 + log2ceil(n / 2)); +} + +// The number of bits necessary to represent enums defined with YG_ENUM_SEQ_DECL +template +constexpr size_t bitWidth() { + static_assert( + enums::count() > 0, "Enums must have at least one entries"); + return log2ceil(enums::count() - 1); +} + +// Number of bits needed for a boolean +template <> +constexpr size_t bitWidth() { + return 1; +} + +template +struct BitTraits {}; + +template +struct BitTraits { + // Base cases + static constexpr size_t width(size_t) { return 0; } + static constexpr size_t shift(size_t) { return 0; } +}; + +template +struct BitTraits { + using Rest = BitTraits; + + static constexpr size_t width(size_t idx) { + return idx == 0 ? bitWidth() : Rest::width(idx - 1); + } + + static constexpr size_t shift(size_t idx) { + return idx == 0 ? Rest::width(0) + Rest::shift(0) : Rest::shift(idx - 1); + } + + static constexpr U mask(size_t idx) { + return ((U{1} << width(idx)) - 1) << shift(idx); + } +}; + +template +struct IndexedType { + using Type = typename IndexedType::Type; +}; + +template +struct IndexedType<0, T, Ts...> { + using Type = T; +}; + +} // namespace detail + +template +class Bitfield { + static_assert( + std::is_integral::value, + "Bitfield needs an integral storage type"); + static_assert( + std::is_unsigned::value, + "Bitfield needs an unsigned storage type"); + static_assert(sizeof...(Fields) > 0, "Bitfield needs at least one member"); + + using BitTraits = detail::BitTraits; + +#if !defined(_MSC_VER) || _MSC_VER > 1914 + static_assert( + BitTraits::shift(0) + BitTraits::width(0) <= + std::numeric_limits::digits, + "Specified storage type is too narrow to hold all types"); +#endif + + template + using TypeAt = typename detail::IndexedType::Type; + + template + static constexpr Storage initStorage(Value value, Values... values) { + return ((value << BitTraits::shift(Idx)) & BitTraits::mask(Idx)) | + initStorage(values...); + } + + template + static constexpr Storage initStorage() { + return Storage{0}; + } + + Storage storage_ = 0; + +public: + template + class Ref { + Bitfield& bitfield_; + + public: + Ref(Bitfield& bitfield) : bitfield_(bitfield) {} + Ref& operator=(TypeAt value) { + bitfield_.storage_ = (bitfield_.storage_ & ~BitTraits::mask(Idx)) | + ((value << BitTraits::shift(Idx)) & BitTraits::mask(Idx)); + return *this; + } + operator TypeAt() const { + return const_cast(bitfield_).at(); + } + }; + + constexpr Bitfield() = default; + constexpr Bitfield(Fields... values) : storage_{initStorage<0>(values...)} {} + + template + constexpr TypeAt at() const { + return static_cast>( + (storage_ & BitTraits::mask(Idx)) >> BitTraits::shift(Idx)); + } + + template + Ref at() { + return {*this}; + } +}; + +} // namespace yoga +} // namespace facebook diff --git a/deps/yoga/CompactValue.h b/src/cpp/deps/yoga/CompactValue.h similarity index 100% rename from deps/yoga/CompactValue.h rename to src/cpp/deps/yoga/CompactValue.h diff --git a/deps/yoga/Utils.cpp b/src/cpp/deps/yoga/Utils.cpp similarity index 100% rename from deps/yoga/Utils.cpp rename to src/cpp/deps/yoga/Utils.cpp diff --git a/deps/yoga/Utils.h b/src/cpp/deps/yoga/Utils.h similarity index 100% rename from deps/yoga/Utils.h rename to src/cpp/deps/yoga/Utils.h diff --git a/deps/yoga/YGConfig.cpp b/src/cpp/deps/yoga/YGConfig.cpp similarity index 100% rename from deps/yoga/YGConfig.cpp rename to src/cpp/deps/yoga/YGConfig.cpp diff --git a/deps/yoga/YGConfig.h b/src/cpp/deps/yoga/YGConfig.h similarity index 100% rename from deps/yoga/YGConfig.h rename to src/cpp/deps/yoga/YGConfig.h diff --git a/deps/yoga/YGEnums.cpp b/src/cpp/deps/yoga/YGEnums.cpp similarity index 100% rename from deps/yoga/YGEnums.cpp rename to src/cpp/deps/yoga/YGEnums.cpp diff --git a/deps/yoga/YGEnums.h b/src/cpp/deps/yoga/YGEnums.h similarity index 100% rename from deps/yoga/YGEnums.h rename to src/cpp/deps/yoga/YGEnums.h diff --git a/deps/yoga/YGFloatOptional.h b/src/cpp/deps/yoga/YGFloatOptional.h similarity index 100% rename from deps/yoga/YGFloatOptional.h rename to src/cpp/deps/yoga/YGFloatOptional.h diff --git a/deps/yoga/YGLayout.cpp b/src/cpp/deps/yoga/YGLayout.cpp similarity index 93% rename from deps/yoga/YGLayout.cpp rename to src/cpp/deps/yoga/YGLayout.cpp index d1144ea6f..ee3988686 100644 --- a/deps/yoga/YGLayout.cpp +++ b/src/cpp/deps/yoga/YGLayout.cpp @@ -15,7 +15,8 @@ bool YGLayout::operator==(YGLayout layout) const { YGFloatArrayEqual(margin, layout.margin) && YGFloatArrayEqual(border, layout.border) && YGFloatArrayEqual(padding, layout.padding) && - direction == layout.direction && hadOverflow == layout.hadOverflow && + direction() == layout.direction() && + hadOverflow() == layout.hadOverflow() && lastOwnerDirection == layout.lastOwnerDirection && nextCachedMeasurementsIndex == layout.nextCachedMeasurementsIndex && cachedLayout == layout.cachedLayout && diff --git a/src/cpp/deps/yoga/YGLayout.h b/src/cpp/deps/yoga/YGLayout.h new file mode 100644 index 000000000..4b62ceccf --- /dev/null +++ b/src/cpp/deps/yoga/YGLayout.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. + */ +#pragma once +#include "Bitfield.h" +#include "YGFloatOptional.h" +#include "Yoga-internal.h" + +struct YGLayout { + std::array position = {}; + std::array dimensions = {{YGUndefined, YGUndefined}}; + std::array margin = {}; + std::array border = {}; + std::array padding = {}; + +private: + static constexpr size_t directionIdx = 0; + static constexpr size_t didUseLegacyFlagIdx = 1; + static constexpr size_t doesLegacyStretchFlagAffectsLayoutIdx = 2; + static constexpr size_t hadOverflowIdx = 3; + facebook::yoga::Bitfield flags_ = + {YGDirectionInherit, false, false, false}; + +public: + uint32_t computedFlexBasisGeneration = 0; + YGFloatOptional computedFlexBasis = {}; + + // Instead of recomputing the entire layout every single time, we cache some + // information to break early when nothing changed + uint32_t generationCount = 0; + YGDirection lastOwnerDirection = (YGDirection) -1; + + uint32_t nextCachedMeasurementsIndex = 0; + std::array + cachedMeasurements = {}; + std::array measuredDimensions = {{YGUndefined, YGUndefined}}; + + YGCachedMeasurement cachedLayout = YGCachedMeasurement(); + + YGDirection direction() const { return flags_.at(); } + decltype(flags_)::Ref direction() { + return flags_.at(); + } + + bool didUseLegacyFlag() const { return flags_.at(); } + decltype(flags_)::Ref didUseLegacyFlag() { + return flags_.at(); + } + + bool doesLegacyStretchFlagAffectsLayout() const { + return flags_.at(); + } + decltype(flags_)::Ref + doesLegacyStretchFlagAffectsLayout() { + return flags_.at(); + } + + bool hadOverflow() const { return flags_.at(); } + decltype(flags_)::Ref hadOverflow() { + return flags_.at(); + } + + bool operator==(YGLayout layout) const; + bool operator!=(YGLayout layout) const { return !(*this == layout); } +}; diff --git a/deps/yoga/YGMacros.h b/src/cpp/deps/yoga/YGMacros.h similarity index 100% rename from deps/yoga/YGMacros.h rename to src/cpp/deps/yoga/YGMacros.h diff --git a/deps/yoga/YGNode.cpp b/src/cpp/deps/yoga/YGNode.cpp similarity index 93% rename from deps/yoga/YGNode.cpp rename to src/cpp/deps/yoga/YGNode.cpp index 8941487fb..bb240dfc8 100644 --- a/deps/yoga/YGNode.cpp +++ b/src/cpp/deps/yoga/YGNode.cpp @@ -15,14 +15,7 @@ using facebook::yoga::detail::CompactValue; YGNode::YGNode(YGNode&& node) { context_ = node.context_; - hasNewLayout_ = node.hasNewLayout_; - isReferenceBaseline_ = node.isReferenceBaseline_; - isDirty_ = node.isDirty_; - nodeType_ = node.nodeType_; - measureUsesContext_ = node.measureUsesContext_; - baselineUsesContext_ = node.baselineUsesContext_; - printUsesContext_ = node.printUsesContext_; - useWebDefaults_ = node.useWebDefaults_; + flags_ = node.flags_; measure_ = node.measure_; baseline_ = node.baseline_; print_ = node.print_; @@ -48,7 +41,7 @@ YGNode::YGNode(const YGNode& node, YGConfigRef config) : YGNode{node} { void YGNode::print(void* printContext) { if (print_.noContext != nullptr) { - if (printUsesContext_) { + if (flags_.at()) { print_.withContext(this, printContext); } else { print_.noContext(this); @@ -154,14 +147,14 @@ YGSize YGNode::measure( YGMeasureMode heightMode, void* layoutContext) { - return measureUsesContext_ + return flags_.at() ? measure_.withContext( this, width, widthMode, height, heightMode, layoutContext) : measure_.noContext(this, width, widthMode, height, heightMode); } float YGNode::baseline(float width, float height, void* layoutContext) { - return baselineUsesContext_ + return flags_.at() ? baseline_.withContext(this, width, height, layoutContext) : baseline_.noContext(this, width, height); } @@ -172,7 +165,7 @@ void YGNode::setMeasureFunc(decltype(YGNode::measure_) measureFunc) { if (measureFunc.noContext == nullptr) { // TODO: t18095186 Move nodeType to opt-in function and mark appropriate // places in Litho - nodeType_ = YGNodeTypeDefault; + flags_.at() = YGNodeTypeDefault; } else { YGAssertWithNode( this, @@ -188,14 +181,14 @@ void YGNode::setMeasureFunc(decltype(YGNode::measure_) measureFunc) { } void YGNode::setMeasureFunc(YGMeasureFunc measureFunc) { - measureUsesContext_ = false; + flags_.at() = false; decltype(YGNode::measure_) m; m.noContext = measureFunc; setMeasureFunc(m); } void YGNode::setMeasureFunc(MeasureWithContextFn measureFunc) { - measureUsesContext_ = true; + flags_.at() = true; decltype(YGNode::measure_) m; m.withContext = measureFunc; setMeasureFunc(m); @@ -214,10 +207,10 @@ void YGNode::insertChild(YGNodeRef child, uint32_t index) { } void YGNode::setDirty(bool isDirty) { - if (isDirty == isDirty_) { + if (isDirty == flags_.at()) { return; } - isDirty_ = isDirty; + flags_.at() = isDirty; if (isDirty && dirtied_) { dirtied_(this); } @@ -238,7 +231,7 @@ void YGNode::removeChild(uint32_t index) { } void YGNode::setLayoutDirection(YGDirection direction) { - layout_.direction = direction; + layout_.direction() = direction; } void YGNode::setLayoutMargin(float margin, int index) { @@ -276,7 +269,7 @@ void YGNode::setLayoutMeasuredDimension(float measuredDimension, int index) { } void YGNode::setLayoutHadOverflow(bool hadOverflow) { - layout_.hadOverflow = hadOverflow; + layout_.hadOverflow() = hadOverflow; } void YGNode::setLayoutDimension(float dimension, int index) { @@ -357,7 +350,7 @@ YGValue YGNode::resolveFlexBasisPtr() const { return flexBasis; } if (!style_.flex().isUndefined() && style_.flex().unwrap() > 0.0f) { - return useWebDefaults_ ? YGValueAuto : YGValueZero; + return flags_.at() ? YGValueAuto : YGValueZero; } return YGValueAuto; } @@ -396,7 +389,7 @@ void YGNode::cloneChildrenIfNeeded(void* cloneContext) { } void YGNode::markDirtyAndPropogate() { - if (!isDirty_) { + if (!flags_.at()) { setDirty(true); setLayoutComputedFlexBasis(YGFloatOptional()); if (owner_) { @@ -406,7 +399,7 @@ void YGNode::markDirtyAndPropogate() { } void YGNode::markDirtyAndPropogateDownwards() { - isDirty_ = true; + flags_.at() = true; for_each(children_.begin(), children_.end(), [](YGNodeRef childNode) { childNode->markDirtyAndPropogateDownwards(); }); @@ -433,11 +426,12 @@ float YGNode::resolveFlexShrink() const { if (!style_.flexShrink().isUndefined()) { return style_.flexShrink().unwrap(); } - if (!useWebDefaults_ && !style_.flex().isUndefined() && + if (!flags_.at() && !style_.flex().isUndefined() && style_.flex().unwrap() < 0.0f) { return -style_.flex().unwrap(); } - return useWebDefaults_ ? kWebDefaultFlexShrink : kDefaultFlexShrink; + return flags_.at() ? kWebDefaultFlexShrink + : kDefaultFlexShrink; } bool YGNode::isNodeFlexible() { @@ -526,12 +520,12 @@ YGFloatOptional YGNode::getTrailingPaddingAndBorder( } bool YGNode::didUseLegacyFlag() { - bool didUseLegacyFlag = layout_.didUseLegacyFlag; + bool didUseLegacyFlag = layout_.didUseLegacyFlag(); if (didUseLegacyFlag) { return true; } for (const auto& child : children_) { - if (child->layout_.didUseLegacyFlag) { + if (child->layout_.didUseLegacyFlag()) { didUseLegacyFlag = true; break; } @@ -541,11 +535,11 @@ bool YGNode::didUseLegacyFlag() { void YGNode::setLayoutDoesLegacyFlagAffectsLayout( bool doesLegacyFlagAffectsLayout) { - layout_.doesLegacyStretchFlagAffectsLayout = doesLegacyFlagAffectsLayout; + layout_.doesLegacyStretchFlagAffectsLayout() = doesLegacyFlagAffectsLayout; } void YGNode::setLayoutDidUseLegacyFlag(bool didUseLegacyFlag) { - layout_.didUseLegacyFlag = didUseLegacyFlag; + layout_.didUseLegacyFlag() = didUseLegacyFlag; } bool YGNode::isLayoutTreeEqualToNode(const YGNode& node) const { @@ -582,7 +576,7 @@ void YGNode::reset() { clearChildren(); - auto webDefaults = useWebDefaults_; + auto webDefaults = flags_.at(); *this = YGNode{getConfig()}; if (webDefaults) { useWebDefaults(); diff --git a/deps/yoga/YGNode.h b/src/cpp/deps/yoga/YGNode.h similarity index 86% rename from deps/yoga/YGNode.h rename to src/cpp/deps/yoga/YGNode.h index cc11cc88d..cc5f36861 100644 --- a/deps/yoga/YGNode.h +++ b/src/cpp/deps/yoga/YGNode.h @@ -7,6 +7,7 @@ #pragma once #include #include +#include "Bitfield.h" #include "CompactValue.h" #include "YGConfig.h" #include "YGLayout.h" @@ -23,15 +24,20 @@ struct YGNode { using PrintWithContextFn = void (*)(YGNode*, void*); private: + static constexpr size_t hasNewLayout_ = 0; + static constexpr size_t isReferenceBaseline_ = 1; + static constexpr size_t isDirty_ = 2; + static constexpr size_t nodeType_ = 3; + static constexpr size_t measureUsesContext_ = 4; + static constexpr size_t baselineUsesContext_ = 5; + static constexpr size_t printUsesContext_ = 6; + static constexpr size_t useWebDefaults_ = 7; + void* context_ = nullptr; - bool hasNewLayout_ : 1; - bool isReferenceBaseline_ : 1; - bool isDirty_ : 1; - YGNodeType nodeType_ : 1; - bool measureUsesContext_ : 1; - bool baselineUsesContext_ : 1; - bool printUsesContext_ : 1; - bool useWebDefaults_ : 1; + using Flags = facebook::yoga:: + Bitfield; + Flags flags_ = + {true, false, false, YGNodeTypeDefault, false, false, false, false}; uint8_t reserved_ = 0; union { YGMeasureFunc noContext; @@ -63,7 +69,7 @@ private: void setBaselineFunc(decltype(baseline_)); void useWebDefaults() { - useWebDefaults_ = true; + flags_.at() = true; style_.flexDirection() = YGFlexDirectionRow; style_.alignContent() = YGAlignStretch; } @@ -79,17 +85,8 @@ private: public: YGNode() : YGNode{YGConfigGetDefault()} {} - explicit YGNode(const YGConfigRef config) - : hasNewLayout_{true}, - isReferenceBaseline_{false}, - isDirty_{false}, - nodeType_{YGNodeTypeDefault}, - measureUsesContext_{false}, - baselineUsesContext_{false}, - printUsesContext_{false}, - useWebDefaults_{config->useWebDefaults}, - config_{config} { - if (useWebDefaults_) { + explicit YGNode(const YGConfigRef config) : config_{config} { + if (config->useWebDefaults) { useWebDefaults(); } }; @@ -116,9 +113,9 @@ public: void print(void*); - bool getHasNewLayout() const { return hasNewLayout_; } + bool getHasNewLayout() const { return flags_.at(); } - YGNodeType getNodeType() const { return nodeType_; } + YGNodeType getNodeType() const { return flags_.at(); } bool hasMeasureFunc() const noexcept { return measure_.noContext != nullptr; } @@ -144,7 +141,7 @@ public: uint32_t getLineIndex() const { return lineIndex_; } - bool isReferenceBaseline() { return isReferenceBaseline_; } + bool isReferenceBaseline() { return flags_.at(); } // returns the YGNodeRef that owns this YGNode. An owner is used to identify // the YogaTree that a YGNode belongs to. This method will return the parent @@ -177,7 +174,7 @@ public: YGConfigRef getConfig() const { return config_; } - bool isDirty() const { return isDirty_; } + bool isDirty() const { return flags_.at(); } std::array getResolvedDimensions() const { return resolvedDimensions_; @@ -225,17 +222,19 @@ public: void setPrintFunc(YGPrintFunc printFunc) { print_.noContext = printFunc; - printUsesContext_ = false; + flags_.at() = false; } void setPrintFunc(PrintWithContextFn printFunc) { print_.withContext = printFunc; - printUsesContext_ = true; + flags_.at() = true; } void setPrintFunc(std::nullptr_t) { setPrintFunc(YGPrintFunc{nullptr}); } - void setHasNewLayout(bool hasNewLayout) { hasNewLayout_ = hasNewLayout; } + void setHasNewLayout(bool hasNewLayout) { + flags_.at() = hasNewLayout; + } - void setNodeType(YGNodeType nodeType) { nodeType_ = nodeType; } + void setNodeType(YGNodeType nodeType) { flags_.at() = nodeType; } void setMeasureFunc(YGMeasureFunc measureFunc); void setMeasureFunc(MeasureWithContextFn); @@ -244,11 +243,11 @@ public: } void setBaselineFunc(YGBaselineFunc baseLineFunc) { - baselineUsesContext_ = false; + flags_.at() = false; baseline_.noContext = baseLineFunc; } void setBaselineFunc(BaselineWithContextFn baseLineFunc) { - baselineUsesContext_ = true; + flags_.at() = true; baseline_.withContext = baseLineFunc; } void setBaselineFunc(std::nullptr_t) { @@ -264,7 +263,7 @@ public: void setLineIndex(uint32_t lineIndex) { lineIndex_ = lineIndex; } void setIsReferenceBaseline(bool isReferenceBaseline) { - isReferenceBaseline_ = isReferenceBaseline; + flags_.at() = isReferenceBaseline; } void setOwner(YGNodeRef owner) { owner_ = owner; } diff --git a/deps/yoga/YGNodePrint.cpp b/src/cpp/deps/yoga/YGNodePrint.cpp similarity index 100% rename from deps/yoga/YGNodePrint.cpp rename to src/cpp/deps/yoga/YGNodePrint.cpp diff --git a/deps/yoga/YGNodePrint.h b/src/cpp/deps/yoga/YGNodePrint.h similarity index 100% rename from deps/yoga/YGNodePrint.h rename to src/cpp/deps/yoga/YGNodePrint.h diff --git a/deps/yoga/YGStyle.cpp b/src/cpp/deps/yoga/YGStyle.cpp similarity index 100% rename from deps/yoga/YGStyle.cpp rename to src/cpp/deps/yoga/YGStyle.cpp diff --git a/src/cpp/deps/yoga/YGStyle.h b/src/cpp/deps/yoga/YGStyle.h new file mode 100644 index 000000000..b497b5c15 --- /dev/null +++ b/src/cpp/deps/yoga/YGStyle.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. + */ +#pragma once +#include +#include +#include +#include +#include "Bitfield.h" +#include "CompactValue.h" +#include "YGEnums.h" +#include "YGFloatOptional.h" +#include "Yoga-internal.h" +#include "Yoga.h" + +class YGStyle { + template + using Values = + facebook::yoga::detail::Values()>; + using CompactValue = facebook::yoga::detail::CompactValue; + +public: + using Dimensions = Values; + using Edges = Values; + + template + struct Ref { + YGStyle& style; + operator T() const { return style.*Prop; } + Ref& operator=(T value) { + style.*Prop = value; + return *this; + } + }; + + template YGStyle::*Prop> + struct IdxRef { + struct Ref { + YGStyle& style; + Idx idx; + operator CompactValue() const { return (style.*Prop)[idx]; } + operator YGValue() const { return (style.*Prop)[idx]; } + Ref& operator=(CompactValue value) { + (style.*Prop)[idx] = value; + return *this; + } + }; + + YGStyle& style; + IdxRef& operator=(const Values& values) { + style.*Prop = values; + return *this; + } + operator const Values&() const { return style.*Prop; } + Ref operator[](Idx idx) { return {style, idx}; } + CompactValue operator[](Idx idx) const { return (style.*Prop)[idx]; } + }; + + YGStyle() = default; + ~YGStyle() = default; + +private: + static constexpr size_t directionIdx = 0; + static constexpr size_t flexDirectionIdx = 1; + static constexpr size_t justifyContentIdx = 2; + static constexpr size_t alignContentIdx = 3; + static constexpr size_t alignItemsIdx = 4; + static constexpr size_t alignSelfIdx = 5; + static constexpr size_t positionTypeIdx = 6; + static constexpr size_t flexWrapIdx = 7; + static constexpr size_t overflowIdx = 8; + static constexpr size_t displayIdx = 9; + using Flags = facebook::yoga::Bitfield< + uint32_t, + YGDirection, + YGFlexDirection, + YGJustify, + YGAlign, + YGAlign, + YGAlign, + YGPositionType, + YGWrap, + YGOverflow, + YGDisplay>; + + Flags flags_ = {YGDirectionInherit, + YGFlexDirectionColumn, + YGJustifyFlexStart, + YGAlignFlexStart, + YGAlignStretch, + YGAlignAuto, + YGPositionTypeRelative, + YGWrapNoWrap, + YGOverflowVisible, + YGDisplayFlex}; + YGFloatOptional flex_ = {}; + YGFloatOptional flexGrow_ = {}; + YGFloatOptional flexShrink_ = {}; + CompactValue flexBasis_ = CompactValue::ofAuto(); + Edges margin_ = {}; + Edges position_ = {}; + Edges padding_ = {}; + Edges border_ = {}; + Dimensions dimensions_{CompactValue::ofAuto()}; + Dimensions minDimensions_ = {}; + Dimensions maxDimensions_ = {}; + // Yoga specific properties, not compatible with flexbox specification + YGFloatOptional aspectRatio_ = {}; + +public: + // for library users needing a type + using ValueRepr = std::remove_reference::type; + + YGDirection direction() const { return flags_.at(); } + Flags::Ref direction() { return flags_.at(); } + + YGFlexDirection flexDirection() const { + return flags_.at(); + } + Flags::Ref flexDirection() { + return flags_.at(); + } + + YGJustify justifyContent() const { return flags_.at(); } + Flags::Ref justifyContent() { + return flags_.at(); + } + + YGAlign alignContent() const { return flags_.at(); } + Flags::Ref alignContent() { + return flags_.at(); + } + + YGAlign alignItems() const { return flags_.at(); } + Flags::Ref alignItems() { return flags_.at(); } + + YGAlign alignSelf() const { return flags_.at(); } + Flags::Ref alignSelf() { return flags_.at(); } + + YGPositionType positionType() const { return flags_.at(); } + Flags::Ref positionType() { + return flags_.at(); + } + + YGWrap flexWrap() const { return flags_.at(); } + Flags::Ref flexWrap() { return flags_.at(); } + + YGOverflow overflow() const { return flags_.at(); } + Flags::Ref overflow() { return flags_.at(); } + + YGDisplay display() const { return flags_.at(); } + Flags::Ref display() { return flags_.at(); } + + YGFloatOptional flex() const { return flex_; } + Ref flex() { return {*this}; } + + YGFloatOptional flexGrow() const { return flexGrow_; } + Ref flexGrow() { return {*this}; } + + YGFloatOptional flexShrink() const { return flexShrink_; } + Ref flexShrink() { return {*this}; } + + CompactValue flexBasis() const { return flexBasis_; } + Ref flexBasis() { return {*this}; } + + const Edges& margin() const { return margin_; } + IdxRef margin() { return {*this}; } + + const Edges& position() const { return position_; } + IdxRef position() { return {*this}; } + + const Edges& padding() const { return padding_; } + IdxRef padding() { return {*this}; } + + const Edges& border() const { return border_; } + IdxRef border() { return {*this}; } + + const Dimensions& dimensions() const { return dimensions_; } + IdxRef dimensions() { return {*this}; } + + const Dimensions& minDimensions() const { return minDimensions_; } + IdxRef minDimensions() { + return {*this}; + } + + const Dimensions& maxDimensions() const { return maxDimensions_; } + IdxRef maxDimensions() { + return {*this}; + } + + // Yoga specific properties, not compatible with flexbox specification + YGFloatOptional aspectRatio() const { return aspectRatio_; } + Ref aspectRatio() { return {*this}; } +}; + +bool operator==(const YGStyle& lhs, const YGStyle& rhs); +inline bool operator!=(const YGStyle& lhs, const YGStyle& rhs) { + return !(lhs == rhs); +} diff --git a/deps/yoga/YGValue.cpp b/src/cpp/deps/yoga/YGValue.cpp similarity index 100% rename from deps/yoga/YGValue.cpp rename to src/cpp/deps/yoga/YGValue.cpp diff --git a/deps/yoga/YGValue.h b/src/cpp/deps/yoga/YGValue.h similarity index 100% rename from deps/yoga/YGValue.h rename to src/cpp/deps/yoga/YGValue.h diff --git a/deps/yoga/Yoga-internal.h b/src/cpp/deps/yoga/Yoga-internal.h similarity index 100% rename from deps/yoga/Yoga-internal.h rename to src/cpp/deps/yoga/Yoga-internal.h diff --git a/deps/yoga/Yoga.cpp b/src/cpp/deps/yoga/Yoga.cpp similarity index 99% rename from deps/yoga/Yoga.cpp rename to src/cpp/deps/yoga/Yoga.cpp index e87fa3251..1a374ab37 100644 --- a/deps/yoga/Yoga.cpp +++ b/src/cpp/deps/yoga/Yoga.cpp @@ -15,7 +15,6 @@ #include "YGNodePrint.h" #include "Yoga-internal.h" #include "event/event.h" -#include "internal/experiments-inl.h" #ifdef _MSC_VER #include @@ -892,7 +891,7 @@ YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) { "Cannot get layout properties of multi-edge shorthands"); \ \ if (edge == YGEdgeStart) { \ - if (node->getLayout().direction == YGDirectionRTL) { \ + if (node->getLayout().direction() == YGDirectionRTL) { \ return node->getLayout().instanceName[YGEdgeRight]; \ } else { \ return node->getLayout().instanceName[YGEdgeLeft]; \ @@ -900,7 +899,7 @@ YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) { } \ \ if (edge == YGEdgeEnd) { \ - if (node->getLayout().direction == YGDirectionRTL) { \ + if (node->getLayout().direction() == YGDirectionRTL) { \ return node->getLayout().instanceName[YGEdgeLeft]; \ } else { \ return node->getLayout().instanceName[YGEdgeRight]; \ @@ -916,15 +915,15 @@ YG_NODE_LAYOUT_PROPERTY_IMPL(float, Right, position[YGEdgeRight]); YG_NODE_LAYOUT_PROPERTY_IMPL(float, Bottom, position[YGEdgeBottom]); YG_NODE_LAYOUT_PROPERTY_IMPL(float, Width, dimensions[YGDimensionWidth]); YG_NODE_LAYOUT_PROPERTY_IMPL(float, Height, dimensions[YGDimensionHeight]); -YG_NODE_LAYOUT_PROPERTY_IMPL(YGDirection, Direction, direction); -YG_NODE_LAYOUT_PROPERTY_IMPL(bool, HadOverflow, hadOverflow); +YG_NODE_LAYOUT_PROPERTY_IMPL(YGDirection, Direction, direction()); +YG_NODE_LAYOUT_PROPERTY_IMPL(bool, HadOverflow, hadOverflow()); YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Margin, margin); YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Border, border); YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Padding, padding); bool YGNodeLayoutGetDidLegacyStretchFlagAffectLayout(const YGNodeRef node) { - return node->getLayout().doesLegacyStretchFlagAffectsLayout; + return node->getLayout().doesLegacyStretchFlagAffectsLayout(); } uint32_t gCurrentGenerationCount = 0; @@ -1645,6 +1644,8 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions( layoutContext); layoutMarkerData.measureCallbacks += 1; + layoutMarkerData.measureCallbackReasonsCount[static_cast(reason)] += + 1; Event::publish( node, @@ -1657,15 +1658,6 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions( measuredSize.height, reason}); - if (internal::isEnabled(internal::Experiment::kDoubleMeasureCallbacks)) { - node->measure( - innerWidth, - widthMeasureMode, - innerHeight, - heightMeasureMode, - layoutContext); - } - node->setLayoutMeasuredDimension( YGNodeBoundAxis( node, @@ -1853,7 +1845,7 @@ static float YGNodeComputeFlexBasisForChildren( const uint32_t generationCount) { float totalOuterFlexBasis = 0.0f; YGNodeRef singleFlexChild = nullptr; - YGVector children = node->getChildren(); + const YGVector &children = node->getChildren(); YGMeasureMode measureModeMainDim = YGFlexDirectionIsRow(mainAxis) ? widthMeasureMode : heightMeasureMode; // If there is only one child with flexGrow + flexShrink it means we can set @@ -2185,27 +2177,29 @@ static float YGDistributeFreeSpaceSecondPass( const YGMeasureMode childHeightMeasureMode = !isMainAxisRow ? childMainMeasureMode : childCrossMeasureMode; + const bool isLayoutPass = performLayout && !requiresStretchLayout; // Recursively call the layout algorithm for this child with the updated // main size. YGLayoutNodeInternal( currentRelativeChild, childWidth, childHeight, - node->getLayout().direction, + node->getLayout().direction(), childWidthMeasureMode, childHeightMeasureMode, availableInnerWidth, availableInnerHeight, - performLayout && !requiresStretchLayout, - LayoutPassReason::kFlex, + isLayoutPass, + isLayoutPass ? LayoutPassReason::kFlexLayout + : LayoutPassReason::kFlexMeasure, config, layoutMarkerData, layoutContext, depth, generationCount); node->setLayoutHadOverflow( - node->getLayout().hadOverflow | - currentRelativeChild->getLayout().hadOverflow); + node->getLayout().hadOverflow() | + currentRelativeChild->getLayout().hadOverflow()); } return deltaFreeSpace; } @@ -2964,7 +2958,7 @@ static void YGNodelayoutImpl( } node->setLayoutHadOverflow( - node->getLayout().hadOverflow | + node->getLayout().hadOverflow() | (collectedFlexItemsValues.remainingFreeSpace < 0)); // STEP 6: MAIN-AXIS JUSTIFICATION & CROSS-AXIS SIZE DETERMINATION @@ -4143,7 +4137,7 @@ void YGNodeCalculateLayoutWithContext( 0, // tree root gCurrentGenerationCount)) { node->setPosition( - node->getLayout().direction, ownerWidth, ownerHeight, ownerWidth); + node->getLayout().direction(), ownerWidth, ownerHeight, ownerWidth); YGRoundToPixelGrid(node, node->getConfig()->pointScaleFactor, 0.0f, 0.0f); #ifdef DEBUG @@ -4193,7 +4187,7 @@ void YGNodeCalculateLayoutWithContext( 0, // tree root gCurrentGenerationCount)) { nodeWithoutLegacyFlag->setPosition( - nodeWithoutLegacyFlag->getLayout().direction, + nodeWithoutLegacyFlag->getLayout().direction(), ownerWidth, ownerHeight, ownerWidth); diff --git a/deps/yoga/Yoga.h b/src/cpp/deps/yoga/Yoga.h similarity index 100% rename from deps/yoga/Yoga.h rename to src/cpp/deps/yoga/Yoga.h diff --git a/deps/yoga/event/event.cpp b/src/cpp/deps/yoga/event/event.cpp similarity index 93% rename from deps/yoga/event/event.cpp rename to src/cpp/deps/yoga/event/event.cpp index 326214fc4..48e8f41da 100644 --- a/deps/yoga/event/event.cpp +++ b/src/cpp/deps/yoga/event/event.cpp @@ -16,18 +16,20 @@ const char* LayoutPassReasonToString(const LayoutPassReason value) { switch (value) { case LayoutPassReason::kInitial: return "initial"; - case LayoutPassReason::kMeasureChild: - return "measure"; - case LayoutPassReason::kAbsMeasureChild: - return "abs_measure"; - case LayoutPassReason::kFlex: - return "flex"; case LayoutPassReason::kAbsLayout: return "abs_layout"; case LayoutPassReason::kStretch: return "stretch"; case LayoutPassReason::kMultilineStretch: return "multiline_stretch"; + case LayoutPassReason::kFlexLayout: + return "flex_layout"; + case LayoutPassReason::kMeasureChild: + return "measure"; + case LayoutPassReason::kAbsMeasureChild: + return "abs_measure"; + case LayoutPassReason::kFlexMeasure: + return "flex_measure"; default: return "unknown"; } diff --git a/deps/yoga/event/event.h b/src/cpp/deps/yoga/event/event.h similarity index 90% rename from deps/yoga/event/event.h rename to src/cpp/deps/yoga/event/event.h index 618574e8d..39b07394d 100644 --- a/deps/yoga/event/event.h +++ b/src/cpp/deps/yoga/event/event.h @@ -8,6 +8,7 @@ #include #include +#include #include struct YGConfig; @@ -23,6 +24,18 @@ enum struct LayoutType : int { kCachedMeasure = 3 }; +enum struct LayoutPassReason : int { + kInitial = 0, + kAbsLayout = 1, + kStretch = 2, + kMultilineStretch = 3, + kFlexLayout = 4, + kMeasureChild = 5, + kAbsMeasureChild = 6, + kFlexMeasure = 7, + COUNT +}; + struct LayoutData { int layouts; int measures; @@ -30,16 +43,8 @@ struct LayoutData { int cachedLayouts; int cachedMeasures; int measureCallbacks; -}; - -enum struct LayoutPassReason : int { - kInitial = 0, - kMeasureChild = 1, - kAbsMeasureChild = 2, - kFlex = 3, - kAbsLayout = 4, - kStretch = 5, - kMultilineStretch = 6 + std::array(LayoutPassReason::COUNT)> + measureCallbackReasonsCount; }; const char* LayoutPassReasonToString(const LayoutPassReason value); diff --git a/deps/yoga/internal/experiments-inl.h b/src/cpp/deps/yoga/internal/experiments-inl.h similarity index 100% rename from deps/yoga/internal/experiments-inl.h rename to src/cpp/deps/yoga/internal/experiments-inl.h diff --git a/deps/yoga/internal/experiments.cpp b/src/cpp/deps/yoga/internal/experiments.cpp similarity index 100% rename from deps/yoga/internal/experiments.cpp rename to src/cpp/deps/yoga/internal/experiments.cpp diff --git a/deps/yoga/internal/experiments.h b/src/cpp/deps/yoga/internal/experiments.h similarity index 100% rename from deps/yoga/internal/experiments.h rename to src/cpp/deps/yoga/internal/experiments.h diff --git a/deps/yoga/log.cpp b/src/cpp/deps/yoga/log.cpp similarity index 100% rename from deps/yoga/log.cpp rename to src/cpp/deps/yoga/log.cpp diff --git a/deps/yoga/log.h b/src/cpp/deps/yoga/log.h similarity index 100% rename from deps/yoga/log.h rename to src/cpp/deps/yoga/log.h diff --git a/src/cpp/Extras/Utils/nutils.h b/src/cpp/include/nodegui/Extras/Utils/nutils.h similarity index 77% rename from src/cpp/Extras/Utils/nutils.h rename to src/cpp/include/nodegui/Extras/Utils/nutils.h index 3dc210687..2c5c43529 100644 --- a/src/cpp/Extras/Utils/nutils.h +++ b/src/cpp/include/nodegui/Extras/Utils/nutils.h @@ -1,6 +1,6 @@ #pragma once -#include "src/cpp/core/FlexLayout/flexlayout.h" +#include "core/FlexLayout/flexlayout.h" namespace extrautils { YGSize measureQtWidget (YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode); diff --git a/src/cpp/QtGui/QApplication/qapplication_wrap.h b/src/cpp/include/nodegui/QtGui/QApplication/qapplication_wrap.h similarity index 100% rename from src/cpp/QtGui/QApplication/qapplication_wrap.h rename to src/cpp/include/nodegui/QtGui/QApplication/qapplication_wrap.h diff --git a/src/cpp/QtGui/QClipboard/qclipboard_wrap.h b/src/cpp/include/nodegui/QtGui/QClipboard/qclipboard_wrap.h similarity index 91% rename from src/cpp/QtGui/QClipboard/qclipboard_wrap.h rename to src/cpp/include/nodegui/QtGui/QClipboard/qclipboard_wrap.h index 386a0e98d..916ee2e0a 100644 --- a/src/cpp/QtGui/QClipboard/qclipboard_wrap.h +++ b/src/cpp/include/nodegui/QtGui/QClipboard/qclipboard_wrap.h @@ -2,7 +2,7 @@ #include #include -#include "src/cpp/core/Component/component_macro.h" +#include "core/Component/component_macro.h" class QClipboardWrap : public Napi::ObjectWrap { diff --git a/src/cpp/QtGui/QCursor/qcursor_wrap.h b/src/cpp/include/nodegui/QtGui/QCursor/qcursor_wrap.h similarity index 91% rename from src/cpp/QtGui/QCursor/qcursor_wrap.h rename to src/cpp/include/nodegui/QtGui/QCursor/qcursor_wrap.h index e723107fa..8627faaf9 100644 --- a/src/cpp/QtGui/QCursor/qcursor_wrap.h +++ b/src/cpp/include/nodegui/QtGui/QCursor/qcursor_wrap.h @@ -3,7 +3,7 @@ #include #include #include -#include "src/cpp/core/Component/component_macro.h" +#include "core/Component/component_macro.h" class QCursorWrap : public Napi::ObjectWrap { diff --git a/src/cpp/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.h b/src/cpp/include/nodegui/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.h similarity index 100% rename from src/cpp/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.h rename to src/cpp/include/nodegui/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.h diff --git a/src/cpp/QtGui/QIcon/qicon_wrap.h b/src/cpp/include/nodegui/QtGui/QIcon/qicon_wrap.h similarity index 90% rename from src/cpp/QtGui/QIcon/qicon_wrap.h rename to src/cpp/include/nodegui/QtGui/QIcon/qicon_wrap.h index 549a0e60c..b7db9dce6 100644 --- a/src/cpp/QtGui/QIcon/qicon_wrap.h +++ b/src/cpp/include/nodegui/QtGui/QIcon/qicon_wrap.h @@ -3,7 +3,7 @@ #include #include #include -#include "src/cpp/core/Component/component_macro.h" +#include "core/Component/component_macro.h" class QIconWrap : public Napi::ObjectWrap { diff --git a/src/cpp/QtGui/QPixmap/qpixmap_wrap.h b/src/cpp/include/nodegui/QtGui/QPixmap/qpixmap_wrap.h similarity index 91% rename from src/cpp/QtGui/QPixmap/qpixmap_wrap.h rename to src/cpp/include/nodegui/QtGui/QPixmap/qpixmap_wrap.h index b8c90ca62..2ba3371c0 100644 --- a/src/cpp/QtGui/QPixmap/qpixmap_wrap.h +++ b/src/cpp/include/nodegui/QtGui/QPixmap/qpixmap_wrap.h @@ -3,7 +3,7 @@ #include #include #include -#include "src/cpp/core/Component/component_macro.h" +#include "core/Component/component_macro.h" class QPixmapWrap : public Napi::ObjectWrap { private: diff --git a/src/cpp/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h b/src/cpp/include/nodegui/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h similarity index 93% rename from src/cpp/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h rename to src/cpp/include/nodegui/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h index ebe8f6a54..0daa9e18e 100644 --- a/src/cpp/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h +++ b/src/cpp/include/nodegui/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h @@ -1,7 +1,7 @@ #pragma once -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "QtWidgets/QWidget/qwidget_macro.h" #include "deps/spdlog/spdlog.h" /* diff --git a/src/cpp/QtWidgets/QAbstractSlider/qabstractslider_macro.h b/src/cpp/include/nodegui/QtWidgets/QAbstractSlider/qabstractslider_macro.h similarity index 96% rename from src/cpp/QtWidgets/QAbstractSlider/qabstractslider_macro.h rename to src/cpp/include/nodegui/QtWidgets/QAbstractSlider/qabstractslider_macro.h index f12ca9489..dd6f0f579 100644 --- a/src/cpp/QtWidgets/QAbstractSlider/qabstractslider_macro.h +++ b/src/cpp/include/nodegui/QtWidgets/QAbstractSlider/qabstractslider_macro.h @@ -1,7 +1,7 @@ #pragma once -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "QtWidgets/QWidget/qwidget_macro.h" #include "deps/spdlog/spdlog.h" /* diff --git a/src/cpp/QtWidgets/QCheckBox/ncheckbox.hpp b/src/cpp/include/nodegui/QtWidgets/QCheckBox/ncheckbox.hpp similarity index 92% rename from src/cpp/QtWidgets/QCheckBox/ncheckbox.hpp rename to src/cpp/include/nodegui/QtWidgets/QCheckBox/ncheckbox.hpp index b2fa48f4c..b7a06bbb4 100644 --- a/src/cpp/QtWidgets/QCheckBox/ncheckbox.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QCheckBox/ncheckbox.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "core/NodeWidget/nodewidget.h" #include "napi.h" class NCheckBox: public QCheckBox, public NodeWidget diff --git a/src/cpp/QtWidgets/QCheckBox/qcheckbox_wrap.h b/src/cpp/include/nodegui/QtWidgets/QCheckBox/qcheckbox_wrap.h similarity index 92% rename from src/cpp/QtWidgets/QCheckBox/qcheckbox_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QCheckBox/qcheckbox_wrap.h index 85b81bbc5..8c02100f7 100644 --- a/src/cpp/QtWidgets/QCheckBox/qcheckbox_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QCheckBox/qcheckbox_wrap.h @@ -3,7 +3,7 @@ #include #include #include "ncheckbox.hpp" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QWidget/qwidget_macro.h" class QCheckBoxWrap : public Napi::ObjectWrap{ diff --git a/src/cpp/QtWidgets/QDial/ndial.hpp b/src/cpp/include/nodegui/QtWidgets/QDial/ndial.hpp similarity index 97% rename from src/cpp/QtWidgets/QDial/ndial.hpp rename to src/cpp/include/nodegui/QtWidgets/QDial/ndial.hpp index 5765d329f..176643e62 100644 --- a/src/cpp/QtWidgets/QDial/ndial.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QDial/ndial.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "core/NodeWidget/nodewidget.h" class NDial: public QDial, public NodeWidget { diff --git a/src/cpp/QtWidgets/QDial/qdial_wrap.h b/src/cpp/include/nodegui/QtWidgets/QDial/qdial_wrap.h similarity index 87% rename from src/cpp/QtWidgets/QDial/qdial_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QDial/qdial_wrap.h index 48addd455..bf15db077 100644 --- a/src/cpp/QtWidgets/QDial/qdial_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QDial/qdial_wrap.h @@ -4,8 +4,8 @@ #include #include #include "ndial.hpp" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" -#include "src/cpp/QtWidgets/QAbstractSlider/qabstractslider_macro.h" +#include "QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QAbstractSlider/qabstractslider_macro.h" class QDialWrap : public Napi::ObjectWrap{ private: diff --git a/src/cpp/QtWidgets/QGridLayout/qgridlayout_wrap.h b/src/cpp/include/nodegui/QtWidgets/QGridLayout/qgridlayout_wrap.h similarity index 92% rename from src/cpp/QtWidgets/QGridLayout/qgridlayout_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QGridLayout/qgridlayout_wrap.h index 2f0b23d5e..8d766be09 100644 --- a/src/cpp/QtWidgets/QGridLayout/qgridlayout_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QGridLayout/qgridlayout_wrap.h @@ -3,7 +3,7 @@ #include #include #include -#include "src/cpp/QtWidgets/QLayout/qlayout_macro.h" +#include "QtWidgets/QLayout/qlayout_macro.h" class QGridLayoutWrap : public Napi::ObjectWrap{ private: diff --git a/src/cpp/QtWidgets/QLabel/nlabel.hpp b/src/cpp/include/nodegui/QtWidgets/QLabel/nlabel.hpp similarity index 81% rename from src/cpp/QtWidgets/QLabel/nlabel.hpp rename to src/cpp/include/nodegui/QtWidgets/QLabel/nlabel.hpp index 0e88b003c..1a0dca34e 100644 --- a/src/cpp/QtWidgets/QLabel/nlabel.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QLabel/nlabel.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "core/NodeWidget/nodewidget.h" class NLabel: public QLabel, public NodeWidget { diff --git a/src/cpp/QtWidgets/QLabel/qlabel_wrap.h b/src/cpp/include/nodegui/QtWidgets/QLabel/qlabel_wrap.h similarity index 92% rename from src/cpp/QtWidgets/QLabel/qlabel_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QLabel/qlabel_wrap.h index 7e9a6e90d..63782364b 100644 --- a/src/cpp/QtWidgets/QLabel/qlabel_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QLabel/qlabel_wrap.h @@ -3,7 +3,7 @@ #include #include #include "nlabel.hpp" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QWidget/qwidget_macro.h" class QLabelWrap : public Napi::ObjectWrap{ private: diff --git a/src/cpp/QtWidgets/QLayout/qlayout_macro.h b/src/cpp/include/nodegui/QtWidgets/QLayout/qlayout_macro.h similarity index 96% rename from src/cpp/QtWidgets/QLayout/qlayout_macro.h rename to src/cpp/include/nodegui/QtWidgets/QLayout/qlayout_macro.h index 1a5caa716..3271e16d7 100644 --- a/src/cpp/QtWidgets/QLayout/qlayout_macro.h +++ b/src/cpp/include/nodegui/QtWidgets/QLayout/qlayout_macro.h @@ -1,6 +1,6 @@ #pragma once -#include "src/cpp/core/Component/component_macro.h" +#include "core/Component/component_macro.h" #include /* diff --git a/src/cpp/QtWidgets/QLayout/qlayout_wrap.h b/src/cpp/include/nodegui/QtWidgets/QLayout/qlayout_wrap.h similarity index 89% rename from src/cpp/QtWidgets/QLayout/qlayout_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QLayout/qlayout_wrap.h index 56638e5f2..a90b8a08f 100644 --- a/src/cpp/QtWidgets/QLayout/qlayout_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QLayout/qlayout_wrap.h @@ -4,7 +4,7 @@ #include #include -#include "src/cpp/QtWidgets/QLayout/qlayout_macro.h" +#include "QtWidgets/QLayout/qlayout_macro.h" //ABSTRACT CLASS class QLayoutWrap : public Napi::ObjectWrap{ diff --git a/src/cpp/QtWidgets/QLineEdit/nlineedit.hpp b/src/cpp/include/nodegui/QtWidgets/QLineEdit/nlineedit.hpp similarity index 97% rename from src/cpp/QtWidgets/QLineEdit/nlineedit.hpp rename to src/cpp/include/nodegui/QtWidgets/QLineEdit/nlineedit.hpp index c96a269ce..ebb1d16bd 100644 --- a/src/cpp/QtWidgets/QLineEdit/nlineedit.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QLineEdit/nlineedit.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "core/NodeWidget/nodewidget.h" class NLineEdit: public QLineEdit, public NodeWidget { diff --git a/src/cpp/QtWidgets/QLineEdit/qlineedit_wrap.h b/src/cpp/include/nodegui/QtWidgets/QLineEdit/qlineedit_wrap.h similarity index 93% rename from src/cpp/QtWidgets/QLineEdit/qlineedit_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QLineEdit/qlineedit_wrap.h index 66029a01d..fae100d89 100644 --- a/src/cpp/QtWidgets/QLineEdit/qlineedit_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QLineEdit/qlineedit_wrap.h @@ -3,7 +3,7 @@ #include #include #include "nlineedit.hpp" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QWidget/qwidget_macro.h" class QLineEditWrap : public Napi::ObjectWrap{ private: diff --git a/src/cpp/QtWidgets/QMainWindow/nmainwindow.hpp b/src/cpp/include/nodegui/QtWidgets/QMainWindow/nmainwindow.hpp similarity index 84% rename from src/cpp/QtWidgets/QMainWindow/nmainwindow.hpp rename to src/cpp/include/nodegui/QtWidgets/QMainWindow/nmainwindow.hpp index a60dde54c..68283bb01 100644 --- a/src/cpp/QtWidgets/QMainWindow/nmainwindow.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QMainWindow/nmainwindow.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "core/NodeWidget/nodewidget.h" #include class NMainWindow: public QMainWindow, public NodeWidget diff --git a/src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.h b/src/cpp/include/nodegui/QtWidgets/QMainWindow/qmainwindow_wrap.h similarity index 91% rename from src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QMainWindow/qmainwindow_wrap.h index 9d7d23215..9926986d5 100644 --- a/src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QMainWindow/qmainwindow_wrap.h @@ -3,7 +3,7 @@ #include #include #include "nmainwindow.hpp" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QWidget/qwidget_macro.h" class QMainWindowWrap : public Napi::ObjectWrap{ private: diff --git a/src/cpp/QtWidgets/QPlainTextEdit/nplaintextedit.hpp b/src/cpp/include/nodegui/QtWidgets/QPlainTextEdit/nplaintextedit.hpp similarity index 98% rename from src/cpp/QtWidgets/QPlainTextEdit/nplaintextedit.hpp rename to src/cpp/include/nodegui/QtWidgets/QPlainTextEdit/nplaintextedit.hpp index e4b6f8e47..b367d5252 100644 --- a/src/cpp/QtWidgets/QPlainTextEdit/nplaintextedit.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QPlainTextEdit/nplaintextedit.hpp @@ -1,8 +1,8 @@ #pragma once -#include "deps/spdlog/spdlog.h" #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "deps/spdlog/spdlog.h" +#include "core/NodeWidget/nodewidget.h" class NPlainTextEdit : public QPlainTextEdit, public NodeWidget { diff --git a/src/cpp/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.h b/src/cpp/include/nodegui/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.h similarity index 89% rename from src/cpp/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.h index 4a9f1acc2..5a63d59f1 100644 --- a/src/cpp/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.h @@ -3,8 +3,8 @@ #include #include #include "nplaintextedit.hpp" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" -#include "src/cpp/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h" +#include "QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h" class QPlainTextEditWrap : public Napi::ObjectWrap{ private: diff --git a/src/cpp/QtWidgets/QProgressBar/nprogressbar.hpp b/src/cpp/include/nodegui/QtWidgets/QProgressBar/nprogressbar.hpp similarity index 84% rename from src/cpp/QtWidgets/QProgressBar/nprogressbar.hpp rename to src/cpp/include/nodegui/QtWidgets/QProgressBar/nprogressbar.hpp index 06b3862ee..dd4521866 100644 --- a/src/cpp/QtWidgets/QProgressBar/nprogressbar.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QProgressBar/nprogressbar.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "core/NodeWidget/nodewidget.h" class NProgressBar: public QProgressBar, public NodeWidget { diff --git a/src/cpp/QtWidgets/QProgressBar/qprogressbar_wrap.h b/src/cpp/include/nodegui/QtWidgets/QProgressBar/qprogressbar_wrap.h similarity index 93% rename from src/cpp/QtWidgets/QProgressBar/qprogressbar_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QProgressBar/qprogressbar_wrap.h index 7a5d05d38..83929d513 100644 --- a/src/cpp/QtWidgets/QProgressBar/qprogressbar_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QProgressBar/qprogressbar_wrap.h @@ -3,7 +3,7 @@ #include #include #include "nprogressbar.hpp" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QWidget/qwidget_macro.h" class QProgressBarWrap : public Napi::ObjectWrap{ private: diff --git a/src/cpp/QtWidgets/QPushButton/npushbutton.hpp b/src/cpp/include/nodegui/QtWidgets/QPushButton/npushbutton.hpp similarity index 96% rename from src/cpp/QtWidgets/QPushButton/npushbutton.hpp rename to src/cpp/include/nodegui/QtWidgets/QPushButton/npushbutton.hpp index db6f240ef..9c2aa2618 100644 --- a/src/cpp/QtWidgets/QPushButton/npushbutton.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QPushButton/npushbutton.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "core/NodeWidget/nodewidget.h" #include "napi.h" class NPushButton: public QPushButton, public NodeWidget diff --git a/src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.h b/src/cpp/include/nodegui/QtWidgets/QPushButton/qpushbutton_wrap.h similarity index 87% rename from src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QPushButton/qpushbutton_wrap.h index 0dda9bb84..a0c104b95 100644 --- a/src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QPushButton/qpushbutton_wrap.h @@ -3,9 +3,9 @@ #include #include #include "npushbutton.hpp" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QWidget/qwidget_macro.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "Extras/Utils/nutils.h" class QPushButtonWrap : public Napi::ObjectWrap { private: diff --git a/src/cpp/QtWidgets/QRadioButton/nradiobutton.hpp b/src/cpp/include/nodegui/QtWidgets/QRadioButton/nradiobutton.hpp similarity index 84% rename from src/cpp/QtWidgets/QRadioButton/nradiobutton.hpp rename to src/cpp/include/nodegui/QtWidgets/QRadioButton/nradiobutton.hpp index 4e27777b2..8ba034f05 100644 --- a/src/cpp/QtWidgets/QRadioButton/nradiobutton.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QRadioButton/nradiobutton.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "core/NodeWidget/nodewidget.h" class NRadioButton: public QRadioButton, public NodeWidget { diff --git a/src/cpp/QtWidgets/QRadioButton/qradiobutton_wrap.h b/src/cpp/include/nodegui/QtWidgets/QRadioButton/qradiobutton_wrap.h similarity index 91% rename from src/cpp/QtWidgets/QRadioButton/qradiobutton_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QRadioButton/qradiobutton_wrap.h index 694b73cad..19fd3e39c 100644 --- a/src/cpp/QtWidgets/QRadioButton/qradiobutton_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QRadioButton/qradiobutton_wrap.h @@ -3,7 +3,7 @@ #include #include #include "nradiobutton.hpp" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QWidget/qwidget_macro.h" class QRadioButtonWrap : public Napi::ObjectWrap{ diff --git a/src/cpp/QtWidgets/QScrollArea/nscrollarea.hpp b/src/cpp/include/nodegui/QtWidgets/QScrollArea/nscrollarea.hpp similarity index 83% rename from src/cpp/QtWidgets/QScrollArea/nscrollarea.hpp rename to src/cpp/include/nodegui/QtWidgets/QScrollArea/nscrollarea.hpp index 8eba3d5c9..c1a44a4ca 100644 --- a/src/cpp/QtWidgets/QScrollArea/nscrollarea.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QScrollArea/nscrollarea.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "core/NodeWidget/nodewidget.h" class NScrollArea: public QScrollArea, public NodeWidget { diff --git a/src/cpp/QtWidgets/QScrollArea/qscrollarea_wrap.h b/src/cpp/include/nodegui/QtWidgets/QScrollArea/qscrollarea_wrap.h similarity index 89% rename from src/cpp/QtWidgets/QScrollArea/qscrollarea_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QScrollArea/qscrollarea_wrap.h index 764a98ccc..d6fa65e9e 100644 --- a/src/cpp/QtWidgets/QScrollArea/qscrollarea_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QScrollArea/qscrollarea_wrap.h @@ -3,7 +3,7 @@ #include #include #include "nscrollarea.hpp" -#include "src/cpp/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h" +#include "QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h" class QScrollAreaWrap : public Napi::ObjectWrap{ private: diff --git a/src/cpp/QtWidgets/QSpinBox/nspinbox.hpp b/src/cpp/include/nodegui/QtWidgets/QSpinBox/nspinbox.hpp similarity index 92% rename from src/cpp/QtWidgets/QSpinBox/nspinbox.hpp rename to src/cpp/include/nodegui/QtWidgets/QSpinBox/nspinbox.hpp index 54ec2de09..5b439ed1f 100644 --- a/src/cpp/QtWidgets/QSpinBox/nspinbox.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QSpinBox/nspinbox.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "core/NodeWidget/nodewidget.h" #include "napi.h" class NSpinBox: public QSpinBox, public NodeWidget diff --git a/src/cpp/QtWidgets/QSpinBox/qspinbox_wrap.h b/src/cpp/include/nodegui/QtWidgets/QSpinBox/qspinbox_wrap.h similarity index 91% rename from src/cpp/QtWidgets/QSpinBox/qspinbox_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QSpinBox/qspinbox_wrap.h index 9cb39733c..417709f17 100644 --- a/src/cpp/QtWidgets/QSpinBox/qspinbox_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QSpinBox/qspinbox_wrap.h @@ -3,9 +3,9 @@ #include #include #include "nspinbox.hpp" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QWidget/qwidget_macro.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "Extras/Utils/nutils.h" class QSpinBoxWrap : public Napi::ObjectWrap { private: diff --git a/src/cpp/QtWidgets/QTabWidget/ntabwidget.hpp b/src/cpp/include/nodegui/QtWidgets/QTabWidget/ntabwidget.hpp similarity index 97% rename from src/cpp/QtWidgets/QTabWidget/ntabwidget.hpp rename to src/cpp/include/nodegui/QtWidgets/QTabWidget/ntabwidget.hpp index b358d0801..0921d3f3c 100644 --- a/src/cpp/QtWidgets/QTabWidget/ntabwidget.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QTabWidget/ntabwidget.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "core/NodeWidget/nodewidget.h" #include "napi.h" class NTabWidget: public QTabWidget, public NodeWidget diff --git a/src/cpp/QtWidgets/QTabWidget/qtabwidget_wrap.h b/src/cpp/include/nodegui/QtWidgets/QTabWidget/qtabwidget_wrap.h similarity index 86% rename from src/cpp/QtWidgets/QTabWidget/qtabwidget_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QTabWidget/qtabwidget_wrap.h index 765bb076a..2c76eb9ee 100644 --- a/src/cpp/QtWidgets/QTabWidget/qtabwidget_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QTabWidget/qtabwidget_wrap.h @@ -1,9 +1,9 @@ #pragma once #include -#include "ntabwidget.hpp" -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QTabWidget/ntabwidget.hpp" +#include "QtWidgets/QWidget/qwidget_macro.h" +#include "Extras/Utils/nutils.h" class QTabWidgetWrap : public Napi::ObjectWrap { private: diff --git a/src/cpp/QtWidgets/QWidget/nwidget.hpp b/src/cpp/include/nodegui/QtWidgets/QWidget/nwidget.hpp similarity index 91% rename from src/cpp/QtWidgets/QWidget/nwidget.hpp rename to src/cpp/include/nodegui/QtWidgets/QWidget/nwidget.hpp index 6175ee0a4..ae1e56804 100644 --- a/src/cpp/QtWidgets/QWidget/nwidget.hpp +++ b/src/cpp/include/nodegui/QtWidgets/QWidget/nwidget.hpp @@ -3,7 +3,7 @@ #include #include #include -#include "src/cpp/core/NodeWidget/nodewidget.h" +#include "core/NodeWidget/nodewidget.h" class NWidget: public QWidget, public NodeWidget { diff --git a/src/cpp/QtWidgets/QWidget/qwidget_macro.h b/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_macro.h similarity index 97% rename from src/cpp/QtWidgets/QWidget/qwidget_macro.h rename to src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_macro.h index 7e3ae6d7b..7bbeb3568 100644 --- a/src/cpp/QtWidgets/QWidget/qwidget_macro.h +++ b/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_macro.h @@ -1,10 +1,10 @@ #pragma once -#include "src/cpp/QtWidgets/QLayout/qlayout_wrap.h" -#include "src/cpp/core/YogaWidget/yogawidget_macro.h" -#include "src/cpp/core/Events/eventwidget_macro.h" -#include "src/cpp/core/Component/component_macro.h" -#include "src/cpp/QtGui/QIcon/qicon_wrap.h" +#include "QtWidgets/QLayout/qlayout_wrap.h" +#include "core/YogaWidget/yogawidget_macro.h" +#include "core/Events/eventwidget_macro.h" +#include "core/Component/component_macro.h" +#include "QtGui/QIcon/qicon_wrap.h" #include /* diff --git a/src/cpp/QtWidgets/QWidget/qwidget_wrap.h b/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_wrap.h similarity index 90% rename from src/cpp/QtWidgets/QWidget/qwidget_wrap.h rename to src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_wrap.h index aeec327aa..32781bcd3 100644 --- a/src/cpp/QtWidgets/QWidget/qwidget_wrap.h +++ b/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_wrap.h @@ -1,6 +1,6 @@ #pragma once -#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h" +#include "QtWidgets/QWidget/qwidget_macro.h" #include #include #include "nwidget.hpp" diff --git a/src/cpp/core/Component/component_macro.h b/src/cpp/include/nodegui/core/Component/component_macro.h similarity index 100% rename from src/cpp/core/Component/component_macro.h rename to src/cpp/include/nodegui/core/Component/component_macro.h diff --git a/src/cpp/core/Events/eventsmap.h b/src/cpp/include/nodegui/core/Events/eventsmap.h similarity index 100% rename from src/cpp/core/Events/eventsmap.h rename to src/cpp/include/nodegui/core/Events/eventsmap.h diff --git a/src/cpp/core/Events/eventwidget.h b/src/cpp/include/nodegui/core/Events/eventwidget.h similarity index 89% rename from src/cpp/core/Events/eventwidget.h rename to src/cpp/include/nodegui/core/Events/eventwidget.h index 419b97640..1afbfaece 100644 --- a/src/cpp/core/Events/eventwidget.h +++ b/src/cpp/include/nodegui/core/Events/eventwidget.h @@ -1,7 +1,7 @@ #pragma once #include -#include "src/cpp/core/Events/eventsmap.h" +#include "core/Events/eventsmap.h" #include class EventWidget { diff --git a/src/cpp/core/Events/eventwidget_macro.h b/src/cpp/include/nodegui/core/Events/eventwidget_macro.h similarity index 100% rename from src/cpp/core/Events/eventwidget_macro.h rename to src/cpp/include/nodegui/core/Events/eventwidget_macro.h diff --git a/src/cpp/core/FlexLayout/flexitem.h b/src/cpp/include/nodegui/core/FlexLayout/flexitem.h similarity index 100% rename from src/cpp/core/FlexLayout/flexitem.h rename to src/cpp/include/nodegui/core/FlexLayout/flexitem.h diff --git a/src/cpp/core/FlexLayout/flexlayout.h b/src/cpp/include/nodegui/core/FlexLayout/flexlayout.h similarity index 100% rename from src/cpp/core/FlexLayout/flexlayout.h rename to src/cpp/include/nodegui/core/FlexLayout/flexlayout.h diff --git a/src/cpp/core/FlexLayout/flexlayout_wrap.h b/src/cpp/include/nodegui/core/FlexLayout/flexlayout_wrap.h similarity index 93% rename from src/cpp/core/FlexLayout/flexlayout_wrap.h rename to src/cpp/include/nodegui/core/FlexLayout/flexlayout_wrap.h index 28fac3104..0ba84eddd 100644 --- a/src/cpp/core/FlexLayout/flexlayout_wrap.h +++ b/src/cpp/include/nodegui/core/FlexLayout/flexlayout_wrap.h @@ -3,7 +3,7 @@ #include #include #include "flexlayout.h" -#include "src/cpp/QtWidgets/QLayout/qlayout_macro.h" +#include "QtWidgets/QLayout/qlayout_macro.h" class FlexLayoutWrap : public Napi::ObjectWrap{ private: diff --git a/src/cpp/core/NodeWidget/nodewidget.h b/src/cpp/include/nodegui/core/NodeWidget/nodewidget.h similarity index 78% rename from src/cpp/core/NodeWidget/nodewidget.h rename to src/cpp/include/nodegui/core/NodeWidget/nodewidget.h index 51e02697c..e4ca793f4 100644 --- a/src/cpp/core/NodeWidget/nodewidget.h +++ b/src/cpp/include/nodegui/core/NodeWidget/nodewidget.h @@ -1,6 +1,6 @@ #pragma once -#include "src/cpp/core/YogaWidget/yogawidget.h" -#include "src/cpp/core/Events/eventwidget_macro.h" +#include "core/YogaWidget/yogawidget.h" +#include "core/Events/eventwidget_macro.h" // class to unify all the custom features + add extra features if needed class NodeWidget : public YogaWidget, public EventWidget { diff --git a/src/cpp/core/YogaWidget/nodestyle.h b/src/cpp/include/nodegui/core/YogaWidget/nodestyle.h similarity index 100% rename from src/cpp/core/YogaWidget/nodestyle.h rename to src/cpp/include/nodegui/core/YogaWidget/nodestyle.h diff --git a/src/cpp/core/YogaWidget/yogawidget.h b/src/cpp/include/nodegui/core/YogaWidget/yogawidget.h similarity index 99% rename from src/cpp/core/YogaWidget/yogawidget.h rename to src/cpp/include/nodegui/core/YogaWidget/yogawidget.h index 49715fafe..090b7bf3c 100644 --- a/src/cpp/core/YogaWidget/yogawidget.h +++ b/src/cpp/include/nodegui/core/YogaWidget/yogawidget.h @@ -2,7 +2,7 @@ #include #include #include "nodestyle.h" -#include "src/cpp/core/FlexLayout/flexitem.h" +#include "core/FlexLayout/flexitem.h" /* YogaWidget class will be used to extend any regular Qt Widget class to give it Yoga Flex powers. diff --git a/src/cpp/core/YogaWidget/yogawidget_macro.h b/src/cpp/include/nodegui/core/YogaWidget/yogawidget_macro.h similarity index 100% rename from src/cpp/core/YogaWidget/yogawidget_macro.h rename to src/cpp/include/nodegui/core/YogaWidget/yogawidget_macro.h diff --git a/src/cpp/Extras/Utils/nutils.cpp b/src/cpp/lib/Extras/Utils/nutils.cpp similarity index 95% rename from src/cpp/Extras/Utils/nutils.cpp rename to src/cpp/lib/Extras/Utils/nutils.cpp index 8199ed9a1..41bc7bfef 100644 --- a/src/cpp/Extras/Utils/nutils.cpp +++ b/src/cpp/lib/Extras/Utils/nutils.cpp @@ -1,6 +1,6 @@ -#include "nutils.h" #include #include +#include "Extras/Utils/nutils.h" #include "deps/spdlog/spdlog.h" YGSize extrautils::measureQtWidget (YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode){ diff --git a/src/cpp/QtGui/QApplication/qapplication_wrap.cpp b/src/cpp/lib/QtGui/QApplication/qapplication_wrap.cpp similarity index 94% rename from src/cpp/QtGui/QApplication/qapplication_wrap.cpp rename to src/cpp/lib/QtGui/QApplication/qapplication_wrap.cpp index 7ea729e83..de6f23609 100644 --- a/src/cpp/QtGui/QApplication/qapplication_wrap.cpp +++ b/src/cpp/lib/QtGui/QApplication/qapplication_wrap.cpp @@ -1,7 +1,7 @@ -#include "qapplication_wrap.h" -#include "src/cpp/core/Component/component_macro.h" -#include "src/cpp/Extras/Utils/nutils.h" -#include "src/cpp/QtGui/QClipboard/qclipboard_wrap.h" +#include "QtGui/QApplication/qapplication_wrap.h" +#include "core/Component/component_macro.h" +#include "Extras/Utils/nutils.h" +#include "QtGui/QClipboard/qclipboard_wrap.h" Napi::FunctionReference QApplicationWrap::constructor; int QApplicationWrap::argc = 0; diff --git a/src/cpp/QtGui/QClipboard/qclipboard_wrap.cpp b/src/cpp/lib/QtGui/QClipboard/qclipboard_wrap.cpp similarity index 96% rename from src/cpp/QtGui/QClipboard/qclipboard_wrap.cpp rename to src/cpp/lib/QtGui/QClipboard/qclipboard_wrap.cpp index 48d56e993..2078b6a82 100644 --- a/src/cpp/QtGui/QClipboard/qclipboard_wrap.cpp +++ b/src/cpp/lib/QtGui/QClipboard/qclipboard_wrap.cpp @@ -1,5 +1,5 @@ -#include "qclipboard_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtGui/QClipboard/qclipboard_wrap.h" +#include "Extras/Utils/nutils.h" #include "deps/spdlog/spdlog.h" Napi::FunctionReference QClipboardWrap::constructor; diff --git a/src/cpp/QtGui/QCursor/qcursor_wrap.cpp b/src/cpp/lib/QtGui/QCursor/qcursor_wrap.cpp similarity index 94% rename from src/cpp/QtGui/QCursor/qcursor_wrap.cpp rename to src/cpp/lib/QtGui/QCursor/qcursor_wrap.cpp index ddbf05a1e..afbe47356 100644 --- a/src/cpp/QtGui/QCursor/qcursor_wrap.cpp +++ b/src/cpp/lib/QtGui/QCursor/qcursor_wrap.cpp @@ -1,7 +1,7 @@ -#include "qcursor_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtGui/QCursor/qcursor_wrap.h" +#include "Extras/Utils/nutils.h" #include "deps/spdlog/spdlog.h" -#include "src/cpp/QtGui/QPixmap/qpixmap_wrap.h" +#include "QtGui/QPixmap/qpixmap_wrap.h" Napi::FunctionReference QCursorWrap::constructor; diff --git a/src/cpp/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.cpp b/src/cpp/lib/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.cpp similarity index 91% rename from src/cpp/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.cpp rename to src/cpp/lib/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.cpp index 92c0d2bb3..cefb5160e 100644 --- a/src/cpp/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.cpp +++ b/src/cpp/lib/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.cpp @@ -1,8 +1,8 @@ -#include "qkeyevent_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" #include +#include "QtGui/QEvent/QKeyEvent/qkeyevent_wrap.h" +#include "Extras/Utils/nutils.h" #include "deps/spdlog/spdlog.h" -#include "src/cpp/core/Component/component_macro.h" +#include "core/Component/component_macro.h" Napi::FunctionReference QKeyEventWrap::constructor; diff --git a/src/cpp/QtGui/QIcon/qicon_wrap.cpp b/src/cpp/lib/QtGui/QIcon/qicon_wrap.cpp similarity index 94% rename from src/cpp/QtGui/QIcon/qicon_wrap.cpp rename to src/cpp/lib/QtGui/QIcon/qicon_wrap.cpp index 5185c6768..994f0eb73 100644 --- a/src/cpp/QtGui/QIcon/qicon_wrap.cpp +++ b/src/cpp/lib/QtGui/QIcon/qicon_wrap.cpp @@ -1,6 +1,6 @@ -#include "qicon_wrap.h" -#include "src/cpp/QtGui/QPixmap/qpixmap_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtGui/QIcon/qicon_wrap.h" +#include "QtGui/QPixmap/qpixmap_wrap.h" +#include "Extras/Utils/nutils.h" #include "deps/spdlog/spdlog.h" Napi::FunctionReference QIconWrap::constructor; diff --git a/src/cpp/QtGui/QPixmap/qpixmap_wrap.cpp b/src/cpp/lib/QtGui/QPixmap/qpixmap_wrap.cpp similarity index 97% rename from src/cpp/QtGui/QPixmap/qpixmap_wrap.cpp rename to src/cpp/lib/QtGui/QPixmap/qpixmap_wrap.cpp index 08a72a564..a3d506774 100644 --- a/src/cpp/QtGui/QPixmap/qpixmap_wrap.cpp +++ b/src/cpp/lib/QtGui/QPixmap/qpixmap_wrap.cpp @@ -1,5 +1,5 @@ -#include "qpixmap_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtGui/QPixmap/qpixmap_wrap.h" +#include "Extras/Utils/nutils.h" #include "deps/spdlog/spdlog.h" Napi::FunctionReference QPixmapWrap::constructor; diff --git a/src/cpp/QtWidgets/QCheckBox/qcheckbox_wrap.cpp b/src/cpp/lib/QtWidgets/QCheckBox/qcheckbox_wrap.cpp similarity index 94% rename from src/cpp/QtWidgets/QCheckBox/qcheckbox_wrap.cpp rename to src/cpp/lib/QtWidgets/QCheckBox/qcheckbox_wrap.cpp index 709537521..420140b92 100644 --- a/src/cpp/QtWidgets/QCheckBox/qcheckbox_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QCheckBox/qcheckbox_wrap.cpp @@ -1,6 +1,6 @@ -#include "qcheckbox_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QCheckBox/qcheckbox_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "Extras/Utils/nutils.h" #include Napi::FunctionReference QCheckBoxWrap::constructor; diff --git a/src/cpp/QtWidgets/QDial/qdial_wrap.cpp b/src/cpp/lib/QtWidgets/QDial/qdial_wrap.cpp similarity index 96% rename from src/cpp/QtWidgets/QDial/qdial_wrap.cpp rename to src/cpp/lib/QtWidgets/QDial/qdial_wrap.cpp index c38031472..09c04ddd1 100644 --- a/src/cpp/QtWidgets/QDial/qdial_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QDial/qdial_wrap.cpp @@ -1,7 +1,7 @@ -#include "qdial_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QDial/qdial_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "Extras/Utils/nutils.h" #include Napi::FunctionReference QDialWrap::constructor; diff --git a/src/cpp/QtWidgets/QGridLayout/qgridlayout_wrap.cpp b/src/cpp/lib/QtWidgets/QGridLayout/qgridlayout_wrap.cpp similarity index 94% rename from src/cpp/QtWidgets/QGridLayout/qgridlayout_wrap.cpp rename to src/cpp/lib/QtWidgets/QGridLayout/qgridlayout_wrap.cpp index ff43921bf..ca55ecc3c 100644 --- a/src/cpp/QtWidgets/QGridLayout/qgridlayout_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QGridLayout/qgridlayout_wrap.cpp @@ -1,6 +1,6 @@ -#include "qgridlayout_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QGridLayout/qgridlayout_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "Extras/Utils/nutils.h" Napi::FunctionReference QGridLayoutWrap::constructor; diff --git a/src/cpp/QtWidgets/QLabel/qlabel_wrap.cpp b/src/cpp/lib/QtWidgets/QLabel/qlabel_wrap.cpp similarity index 94% rename from src/cpp/QtWidgets/QLabel/qlabel_wrap.cpp rename to src/cpp/lib/QtWidgets/QLabel/qlabel_wrap.cpp index 38420b558..09fcf6462 100644 --- a/src/cpp/QtWidgets/QLabel/qlabel_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QLabel/qlabel_wrap.cpp @@ -1,7 +1,7 @@ -#include "qlabel_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/QtGui/QPixmap/qpixmap_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QLabel/qlabel_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "QtGui/QPixmap/qpixmap_wrap.h" +#include "Extras/Utils/nutils.h" #include Napi::FunctionReference QLabelWrap::constructor; diff --git a/src/cpp/QtWidgets/QLayout/qlayout_wrap.cpp b/src/cpp/lib/QtWidgets/QLayout/qlayout_wrap.cpp similarity index 93% rename from src/cpp/QtWidgets/QLayout/qlayout_wrap.cpp rename to src/cpp/lib/QtWidgets/QLayout/qlayout_wrap.cpp index 8e11f9766..667ad2726 100644 --- a/src/cpp/QtWidgets/QLayout/qlayout_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QLayout/qlayout_wrap.cpp @@ -1,4 +1,4 @@ -#include "qlayout_wrap.h" +#include "QtWidgets/QLayout/qlayout_wrap.h" Napi::FunctionReference QLayoutWrap::constructor; diff --git a/src/cpp/QtWidgets/QLineEdit/qlineedit_wrap.cpp b/src/cpp/lib/QtWidgets/QLineEdit/qlineedit_wrap.cpp similarity index 95% rename from src/cpp/QtWidgets/QLineEdit/qlineedit_wrap.cpp rename to src/cpp/lib/QtWidgets/QLineEdit/qlineedit_wrap.cpp index 127a7dd51..34f8b3c7a 100644 --- a/src/cpp/QtWidgets/QLineEdit/qlineedit_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QLineEdit/qlineedit_wrap.cpp @@ -1,7 +1,7 @@ -#include "qlineedit_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QLineEdit/qlineedit_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "Extras/Utils/nutils.h" #include Napi::FunctionReference QLineEditWrap::constructor; diff --git a/src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.cpp b/src/cpp/lib/QtWidgets/QMainWindow/qmainwindow_wrap.cpp similarity index 94% rename from src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.cpp rename to src/cpp/lib/QtWidgets/QMainWindow/qmainwindow_wrap.cpp index 84fffdb39..9ec846f0c 100644 --- a/src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QMainWindow/qmainwindow_wrap.cpp @@ -1,6 +1,6 @@ -#include "qmainwindow_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QMainWindow/qmainwindow_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "Extras/Utils/nutils.h" Napi::FunctionReference QMainWindowWrap::constructor; diff --git a/src/cpp/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.cpp b/src/cpp/lib/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.cpp similarity index 97% rename from src/cpp/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.cpp rename to src/cpp/lib/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.cpp index 93645f6b5..dad86a684 100644 --- a/src/cpp/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.cpp @@ -1,7 +1,7 @@ -#include "qplaintextedit_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QPlainTextEdit/qplaintextedit_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "Extras/Utils/nutils.h" #include diff --git a/src/cpp/QtWidgets/QProgressBar/qprogressbar_wrap.cpp b/src/cpp/lib/QtWidgets/QProgressBar/qprogressbar_wrap.cpp similarity index 95% rename from src/cpp/QtWidgets/QProgressBar/qprogressbar_wrap.cpp rename to src/cpp/lib/QtWidgets/QProgressBar/qprogressbar_wrap.cpp index 274473fb3..40276ca10 100644 --- a/src/cpp/QtWidgets/QProgressBar/qprogressbar_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QProgressBar/qprogressbar_wrap.cpp @@ -1,7 +1,7 @@ -#include "qprogressbar_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QProgressBar/qprogressbar_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "Extras/Utils/nutils.h" #include Napi::FunctionReference QProgressBarWrap::constructor; diff --git a/src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.cpp b/src/cpp/lib/QtWidgets/QPushButton/qpushbutton_wrap.cpp similarity index 93% rename from src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.cpp rename to src/cpp/lib/QtWidgets/QPushButton/qpushbutton_wrap.cpp index e45afb778..42f6a6379 100644 --- a/src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QPushButton/qpushbutton_wrap.cpp @@ -1,7 +1,7 @@ -#include "qpushbutton_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/QtGui/QIcon/qicon_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QPushButton/qpushbutton_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "QtGui/QIcon/qicon_wrap.h" +#include "Extras/Utils/nutils.h" Napi::FunctionReference QPushButtonWrap::constructor; diff --git a/src/cpp/QtWidgets/QRadioButton/qradiobutton_wrap.cpp b/src/cpp/lib/QtWidgets/QRadioButton/qradiobutton_wrap.cpp similarity index 93% rename from src/cpp/QtWidgets/QRadioButton/qradiobutton_wrap.cpp rename to src/cpp/lib/QtWidgets/QRadioButton/qradiobutton_wrap.cpp index 8a63ddf94..139343c5a 100644 --- a/src/cpp/QtWidgets/QRadioButton/qradiobutton_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QRadioButton/qradiobutton_wrap.cpp @@ -1,7 +1,7 @@ -#include "qradiobutton_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QRadioButton/qradiobutton_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "Extras/Utils/nutils.h" #include diff --git a/src/cpp/QtWidgets/QScrollArea/qscrollarea_wrap.cpp b/src/cpp/lib/QtWidgets/QScrollArea/qscrollarea_wrap.cpp similarity index 93% rename from src/cpp/QtWidgets/QScrollArea/qscrollarea_wrap.cpp rename to src/cpp/lib/QtWidgets/QScrollArea/qscrollarea_wrap.cpp index 2f6e5f910..e8c1539d9 100644 --- a/src/cpp/QtWidgets/QScrollArea/qscrollarea_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QScrollArea/qscrollarea_wrap.cpp @@ -1,6 +1,6 @@ -#include "qscrollarea_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QScrollArea/qscrollarea_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "Extras/Utils/nutils.h" Napi::FunctionReference QScrollAreaWrap::constructor; diff --git a/src/cpp/QtWidgets/QSpinBox/qspinbox_wrap.cpp b/src/cpp/lib/QtWidgets/QSpinBox/qspinbox_wrap.cpp similarity index 96% rename from src/cpp/QtWidgets/QSpinBox/qspinbox_wrap.cpp rename to src/cpp/lib/QtWidgets/QSpinBox/qspinbox_wrap.cpp index 61b08a46e..8ebe0fc91 100644 --- a/src/cpp/QtWidgets/QSpinBox/qspinbox_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QSpinBox/qspinbox_wrap.cpp @@ -1,7 +1,7 @@ -#include "qspinbox_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/QtGui/QIcon/qicon_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QSpinBox/qspinbox_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "QtGui/QIcon/qicon_wrap.h" +#include "Extras/Utils/nutils.h" Napi::FunctionReference QSpinBoxWrap::constructor; diff --git a/src/cpp/QtWidgets/QTabWidget/qtabwidget_wrap.cpp b/src/cpp/lib/QtWidgets/QTabWidget/qtabwidget_wrap.cpp similarity index 95% rename from src/cpp/QtWidgets/QTabWidget/qtabwidget_wrap.cpp rename to src/cpp/lib/QtWidgets/QTabWidget/qtabwidget_wrap.cpp index c7ac8f6a0..ea1bd8b4e 100644 --- a/src/cpp/QtWidgets/QTabWidget/qtabwidget_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QTabWidget/qtabwidget_wrap.cpp @@ -1,7 +1,7 @@ -#include "qtabwidget_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/QtGui/QIcon/qicon_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QTabWidget/qtabwidget_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "QtGui/QIcon/qicon_wrap.h" +#include "Extras/Utils/nutils.h" #include Napi::FunctionReference QTabWidgetWrap::constructor; diff --git a/src/cpp/QtWidgets/QWidget/qwidget_wrap.cpp b/src/cpp/lib/QtWidgets/QWidget/qwidget_wrap.cpp similarity index 91% rename from src/cpp/QtWidgets/QWidget/qwidget_wrap.cpp rename to src/cpp/lib/QtWidgets/QWidget/qwidget_wrap.cpp index 8e6254c36..d799e4395 100644 --- a/src/cpp/QtWidgets/QWidget/qwidget_wrap.cpp +++ b/src/cpp/lib/QtWidgets/QWidget/qwidget_wrap.cpp @@ -1,6 +1,6 @@ -#include "qwidget_wrap.h" -#include "src/cpp/QtWidgets/QLayout/qlayout_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "QtWidgets/QLayout/qlayout_wrap.h" +#include "Extras/Utils/nutils.h" Napi::FunctionReference QWidgetWrap::constructor; diff --git a/src/cpp/core/Events/eventsmap.cpp b/src/cpp/lib/core/Events/eventsmap.cpp similarity index 99% rename from src/cpp/core/Events/eventsmap.cpp rename to src/cpp/lib/core/Events/eventsmap.cpp index 018ba64da..fff935980 100644 --- a/src/cpp/core/Events/eventsmap.cpp +++ b/src/cpp/lib/core/Events/eventsmap.cpp @@ -1,4 +1,4 @@ -#include "eventsmap.h" +#include "core/Events/eventsmap.h" std::unordered_map EventsMap::eventTypes { { "None", QEvent::None }, diff --git a/src/cpp/core/Events/eventwidget.cpp b/src/cpp/lib/core/Events/eventwidget.cpp similarity index 98% rename from src/cpp/core/Events/eventwidget.cpp rename to src/cpp/lib/core/Events/eventwidget.cpp index f1b3a89d6..a92bc00c5 100644 --- a/src/cpp/core/Events/eventwidget.cpp +++ b/src/cpp/lib/core/Events/eventwidget.cpp @@ -1,4 +1,4 @@ -#include "eventwidget.h" +#include "core/Events/eventwidget.h" #include "deps/spdlog/spdlog.h" #include diff --git a/src/cpp/core/FlexLayout/flexitem.cpp b/src/cpp/lib/core/FlexLayout/flexitem.cpp similarity index 86% rename from src/cpp/core/FlexLayout/flexitem.cpp rename to src/cpp/lib/core/FlexLayout/flexitem.cpp index a6fa48172..3538c4ac9 100644 --- a/src/cpp/core/FlexLayout/flexitem.cpp +++ b/src/cpp/lib/core/FlexLayout/flexitem.cpp @@ -1,4 +1,4 @@ -#include "flexitem.h" +#include "core/FlexLayout/flexitem.h" FlexItem::FlexItem() { diff --git a/src/cpp/core/FlexLayout/flexlayout.cpp b/src/cpp/lib/core/FlexLayout/flexlayout.cpp similarity index 98% rename from src/cpp/core/FlexLayout/flexlayout.cpp rename to src/cpp/lib/core/FlexLayout/flexlayout.cpp index e2fd8363e..37d7a34f4 100644 --- a/src/cpp/core/FlexLayout/flexlayout.cpp +++ b/src/cpp/lib/core/FlexLayout/flexlayout.cpp @@ -1,8 +1,8 @@ -#include "flexlayout.h" #include #include #include "spdlog/spdlog.h" -#include "src/cpp/core/YogaWidget/yogawidget.h" +#include "core/FlexLayout/flexlayout.h" +#include "core/YogaWidget/yogawidget.h" FlexLayout::NodeContext* FlexLayout::getNodeContext(YGNodeRef node) { diff --git a/src/cpp/core/FlexLayout/flexlayout_wrap.cpp b/src/cpp/lib/core/FlexLayout/flexlayout_wrap.cpp similarity index 96% rename from src/cpp/core/FlexLayout/flexlayout_wrap.cpp rename to src/cpp/lib/core/FlexLayout/flexlayout_wrap.cpp index 6124f819a..e9f830996 100644 --- a/src/cpp/core/FlexLayout/flexlayout_wrap.cpp +++ b/src/cpp/lib/core/FlexLayout/flexlayout_wrap.cpp @@ -1,6 +1,6 @@ -#include "flexlayout_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/Extras/Utils/nutils.h" +#include "core/FlexLayout/flexlayout_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "Extras/Utils/nutils.h" Napi::FunctionReference FlexLayoutWrap::constructor; diff --git a/src/cpp/core/YogaWidget/nodestyle.cpp b/src/cpp/lib/core/YogaWidget/nodestyle.cpp similarity index 98% rename from src/cpp/core/YogaWidget/nodestyle.cpp rename to src/cpp/lib/core/YogaWidget/nodestyle.cpp index 702022113..94840d995 100644 --- a/src/cpp/core/YogaWidget/nodestyle.cpp +++ b/src/cpp/lib/core/YogaWidget/nodestyle.cpp @@ -1,4 +1,4 @@ -#include "nodestyle.h" +#include "core/YogaWidget/nodestyle.h" std::unordered_map NodeStyle::NodeAlign { {"auto",YGAlignAuto}, diff --git a/src/cpp/core/YogaWidget/yogawidget.cpp b/src/cpp/lib/core/YogaWidget/yogawidget.cpp similarity index 99% rename from src/cpp/core/YogaWidget/yogawidget.cpp rename to src/cpp/lib/core/YogaWidget/yogawidget.cpp index fde00f369..69e659dbd 100644 --- a/src/cpp/core/YogaWidget/yogawidget.cpp +++ b/src/cpp/lib/core/YogaWidget/yogawidget.cpp @@ -1,4 +1,4 @@ -#include "yogawidget.h" +#include "core/YogaWidget/yogawidget.h" #include "spdlog/spdlog.h" void YogaWidget::setYDisplay(QString rawValue){ diff --git a/src/cpp/main.cpp b/src/cpp/main.cpp index 2fc36e65d..9d440e09b 100644 --- a/src/cpp/main.cpp +++ b/src/cpp/main.cpp @@ -1,25 +1,25 @@ -#include "src/cpp/QtGui/QApplication/qapplication_wrap.h" -#include "src/cpp/QtGui/QClipboard/qclipboard_wrap.h" -#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h" -#include "src/cpp/QtGui/QPixmap/qpixmap_wrap.h" -#include "src/cpp/QtGui/QIcon/qicon_wrap.h" -#include "src/cpp/QtGui/QCursor/qcursor_wrap.h" -#include "src/cpp/QtWidgets/QGridLayout/qgridlayout_wrap.h" -#include "src/cpp/QtWidgets/QLayout/qlayout_wrap.h" -#include "src/cpp/QtWidgets/QDial/qdial_wrap.h" -#include "src/cpp/QtWidgets/QLabel/qlabel_wrap.h" -#include "src/cpp/QtWidgets/QMainWindow/qmainwindow_wrap.h" -#include "src/cpp/QtWidgets/QPushButton/qpushbutton_wrap.h" -#include "src/cpp/QtWidgets/QSpinBox/qspinbox_wrap.h" -#include "src/cpp/QtWidgets/QCheckBox/qcheckbox_wrap.h" -#include "src/cpp/QtWidgets/QProgressBar/qprogressbar_wrap.h" -#include "src/cpp/QtWidgets/QRadioButton/qradiobutton_wrap.h" -#include "src/cpp/QtWidgets/QTabWidget/qtabwidget_wrap.h" -#include "src/cpp/QtWidgets/QLineEdit/qlineedit_wrap.h" -#include "src/cpp/QtWidgets/QPlainTextEdit/qplaintextedit_wrap.h" -#include "src/cpp/core/FlexLayout/flexlayout_wrap.h" -#include "src/cpp/QtGui/QEvent/QKeyEvent/qkeyevent_wrap.h" -#include "src/cpp/QtWidgets/QScrollArea/qscrollarea_wrap.h" +#include "QtGui/QApplication/qapplication_wrap.h" +#include "QtGui/QClipboard/qclipboard_wrap.h" +#include "QtWidgets/QWidget/qwidget_wrap.h" +#include "QtGui/QPixmap/qpixmap_wrap.h" +#include "QtGui/QIcon/qicon_wrap.h" +#include "QtGui/QCursor/qcursor_wrap.h" +#include "QtWidgets/QGridLayout/qgridlayout_wrap.h" +#include "QtWidgets/QLayout/qlayout_wrap.h" +#include "QtWidgets/QDial/qdial_wrap.h" +#include "QtWidgets/QLabel/qlabel_wrap.h" +#include "QtWidgets/QMainWindow/qmainwindow_wrap.h" +#include "QtWidgets/QPushButton/qpushbutton_wrap.h" +#include "QtWidgets/QSpinBox/qspinbox_wrap.h" +#include "QtWidgets/QCheckBox/qcheckbox_wrap.h" +#include "QtWidgets/QProgressBar/qprogressbar_wrap.h" +#include "QtWidgets/QRadioButton/qradiobutton_wrap.h" +#include "QtWidgets/QTabWidget/qtabwidget_wrap.h" +#include "QtWidgets/QLineEdit/qlineedit_wrap.h" +#include "QtWidgets/QPlainTextEdit/qplaintextedit_wrap.h" +#include "core/FlexLayout/flexlayout_wrap.h" +#include "QtGui/QEvent/QKeyEvent/qkeyevent_wrap.h" +#include "QtWidgets/QScrollArea/qscrollarea_wrap.h" #include // These cant be instantiated in JS Side void InitPrivateHelpers(Napi::Env env){