<commit_before>//
// Created by <NAME> aka Gelldur on 02/11/16.
//

#pragma once

#include <crosslayout/NodeWrapper.h>

namespace CrossLayout
{

/**
 * Sample usage
 *
 * Composer composer;
 *
 * composer.center(bar).in(foo);
 * composer.center(bar).inParent();
 *
 * composer.leftEdge(foo).moveTo().leftEdge(bar);
 * composer.leftEdge(foo).moveTo().leftEdge(bar, 10);
 *
 * composer.topEdge(foo).moveTo().bottomEdge(bar);
 *
 * composer.leftEdge(foo).moveTo().rightEdge(bar);
 * composer.leftEdge(foo).moveTo().parentLeftEdge();
 * composer.topEdge(foo).moveTo().parentBottomEdge();
 *
 * composer.center(foo).inParent().horizontally();
 * composer.center(foo).in(bar).horizontally();
 * composer.center(foo).in(bar).vertically(5);
 *
 * composer.center(foo).in(bar);
 * composer.center(foo).in(bar).horizontally();
 * TODO composer can check parent and when they do not match try to convert to global space ?
 */
template<class T>
class Composer
{
	using Rect = CrossLayout::Rect<float>;
	using Point = CrossLayout::Point<float>;

	struct In;
	struct Orientation;
	struct WhereVertical;
	struct WhereHorizontal;
	struct MoveHorizontal;
	struct MoveVertical;
	struct Move;
	struct AnchorMove;
	struct AnchorMoveX;
	struct AnchorMoveY;

public:
	using Wrap = NodeWrapper<T>;

	constexpr MoveHorizontal leftEdge(NodeWrapper<T> node) const
	{
		return Composer::MoveHorizontal(node, {0, 0});
	}

	constexpr MoveHorizontal rightEdge(NodeWrapper<T> node) const
	{
		return Composer::MoveHorizontal(node, {1, 0});
	}

	constexpr MoveVertical topEdge(NodeWrapper<T> node) const
	{
		return Composer::MoveVertical(node, {0, 1});
	}

	constexpr MoveVertical bottomEdge(NodeWrapper<T> node) const
	{
		return Composer::MoveVertical(node, {0, 0});
	}

	constexpr In center(NodeWrapper<T> node) const
	{
		return Composer::In(node);
	}

	constexpr AnchorMove grabAnchor(NodeWrapper<T> node, Point point) const
	{
		return Composer::AnchorMove(node, point);
	}

	constexpr AnchorMoveX grabAnchorX(NodeWrapper<T> node, float anchor) const
	{
		return Composer::AnchorMoveX(node, anchor);
	}

	constexpr AnchorMoveY grabAnchorY(NodeWrapper<T> node, float anchor) const
	{
		return Composer::AnchorMoveY(node, anchor);
	}

	constexpr Move move(NodeWrapper<T> node) const
	{
		return Composer::Move(this, node);
	}

	static void moveBy(NodeWrapper<T>& node, Point moveBy)
	{
		node.setPosition(moveBy + node.getPosition());
	}

	void moveBy(NodeWrapper<T> node, Point moveBy)<commit_msg>Fix ambiguous call of Composer::moveBy<commit_after>//
// Created by <NAME> aka Gelldur on 02/11/16.
//

#pragma once

#include <crosslayout/NodeWrapper.h>

namespace CrossLayout
{

/**
 * Sample usage
 *
 * Composer composer;
 *
 * composer.center(bar).in(foo);
 * composer.center(bar).inParent();
 *
 * composer.leftEdge(foo).moveTo().leftEdge(bar);
 * composer.leftEdge(foo).moveTo().leftEdge(bar, 10);
 *
 * composer.topEdge(foo).moveTo().bottomEdge(bar);
 *
 * composer.leftEdge(foo).moveTo().rightEdge(bar);
 * composer.leftEdge(foo).moveTo().parentLeftEdge();
 * composer.topEdge(foo).moveTo().parentBottomEdge();
 *
 * composer.center(foo).inParent().horizontally();
 * composer.center(foo).in(bar).horizontally();
 * composer.center(foo).in(bar).vertically(5);
 *
 * composer.center(foo).in(bar);
 * composer.center(foo).in(bar).horizontally();
 * TODO composer can check parent and when they do not match try to convert to global space ?
 */
template<class T>
class Composer
{
	using Rect = CrossLayout::Rect<float>;
	using Point = CrossLayout::Point<float>;

	struct In;
	struct Orientation;
	struct WhereVertical;
	struct WhereHorizontal;
	struct MoveHorizontal;
	struct MoveVertical;
	struct Move;
	struct AnchorMove;
	struct AnchorMoveX;
	struct AnchorMoveY;

public:
	using Wrap = NodeWrapper<T>;

	constexpr MoveHorizontal leftEdge(NodeWrapper<T> node) const
	{
		return Composer::MoveHorizontal(node, {0, 0});
	}

	constexpr MoveHorizontal rightEdge(NodeWrapper<T> node) const
	{
		return Composer::MoveHorizontal(node, {1, 0});
	}

	constexpr MoveVertical topEdge(NodeWrapper<T> node) const
	{
		return Composer::MoveVertical(node, {0, 1});
	}

	constexpr MoveVertical bottomEdge(NodeWrapper<T> node) const
	{
		return Composer::MoveVertical(node, {0, 0});
	}

	constexpr In center(NodeWrapper<T> node) const
	{
		return Composer::In(node);
	}

	constexpr AnchorMove grabAnchor(NodeWrapper<T> node, Point point) const
	{
		return Composer::AnchorMove(node, point);
	}

	constexpr AnchorMoveX grabAnchorX(NodeWrapper<T> node, float anchor) const
	{
		return Composer::AnchorMoveX(node, anchor);
	}

	constexpr AnchorMoveY grabAnchorY(NodeWrapper<T> node, float anchor) const
	{
		return Composer::AnchorMoveY(node, anchor);
	}

	constexpr Move move(NodeWrapper<T> node) const
	{
		return Composer::Move(this, node);
	}

	static void moveBy(NodeWrapper<T>& node, Point moveBy)
	{
		node.setPosition(moveBy + node.getPosition());
	}

	static void moveByOffset(NodeWrapper<T> node, Point moveBy)
{'fraction_non_alphanumeric': 0.1393574297188755, 'fraction_numerical': 0.006827309236947791, 'mean_word_length': 5.402313624678663, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2458036', 'n_tokens_mistral': 1720, 'n_tokens_neox': 1649, 'n_words': 358}