<commit_before>#pragma once

#include "halley/file_formats/config_file.h"
#include "halley/data_structures/maybe.h"
#include "halley/maths/colour.h"
#include "halley/maths/rect.h"
#include "config_node_serializer_base.h"
#include <set>
#include <unordered_set>


#include "halley/core/resources/resource_reference.h"

namespace Halley {
	template <>
	class ConfigNodeSerializer<bool> {
	public:
		ConfigNode serialize(bool value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value);
		}
		
		int deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
		{
			return node.asBool(false);
		}
	};

	template <>
    class ConfigNodeSerializer<int> {
    public:
        ConfigNode serialize(int value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value);
		}
		
		int deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
        {
			return node.asInt(0);
        }
    };

	template <>
    class ConfigNodeSerializer<float> {
    public:
        ConfigNode serialize(float value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value);
		}
		
		float deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
        {
			return node.asFloat(0);
        }
    };

	template <>
    class ConfigNodeSerializer<Vector2i> {
    public:
        ConfigNode serialize(Vector2i value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value);
		}
		
		Vector2i deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
        {
			return node.asVector2i(Vector2i());
        }
    };

	template <>
    class ConfigNodeSerializer<Vector2f> {
    public:
        ConfigNode serialize(Vector2f value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value);
		}
		
		Vector2f deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
        {
			return node.asVector2f(Vector2f());
        }
    };

	template <>
    class ConfigNodeSerializer<Angle1f> {
    public:
        ConfigNode serialize(Angle1f value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value.toRadians());
		}
		
		Angle1f deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
        {
			return Angle1f::fromRadians(node.asFloat(0.0f));
        }
    };

	template <>
    class ConfigNodeSerializer<Colour4f> {
    public:
        ConfigNode serialize(Colour4f value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value.toString());
		}
		
		Colour4f deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
        {
			return Colour4f::fromString(node.asString("#000000"));
        }
    };

	template <>
    class ConfigNodeSerializer<Rect4i> {
    public:<commit_msg>Serialize angles as degrees, not radians<commit_after>#pragma once

#include "halley/file_formats/config_file.h"
#include "halley/data_structures/maybe.h"
#include "halley/maths/colour.h"
#include "halley/maths/rect.h"
#include "config_node_serializer_base.h"
#include <set>
#include <unordered_set>


#include "halley/core/resources/resource_reference.h"

namespace Halley {
	template <>
	class ConfigNodeSerializer<bool> {
	public:
		ConfigNode serialize(bool value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value);
		}
		
		int deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
		{
			return node.asBool(false);
		}
	};

	template <>
    class ConfigNodeSerializer<int> {
    public:
        ConfigNode serialize(int value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value);
		}
		
		int deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
        {
			return node.asInt(0);
        }
    };

	template <>
    class ConfigNodeSerializer<float> {
    public:
        ConfigNode serialize(float value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value);
		}
		
		float deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
        {
			return node.asFloat(0);
        }
    };

	template <>
    class ConfigNodeSerializer<Vector2i> {
    public:
        ConfigNode serialize(Vector2i value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value);
		}
		
		Vector2i deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
        {
			return node.asVector2i(Vector2i());
        }
    };

	template <>
    class ConfigNodeSerializer<Vector2f> {
    public:
        ConfigNode serialize(Vector2f value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value);
		}
		
		Vector2f deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
        {
			return node.asVector2f(Vector2f());
        }
    };

	template <>
    class ConfigNodeSerializer<Angle1f> {
    public:
        ConfigNode serialize(Angle1f value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value.toDegrees());
		}
		
		Angle1f deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
        {
			return Angle1f::fromDegrees(node.asFloat(0.0f));
        }
    };

	template <>
    class ConfigNodeSerializer<Colour4f> {
    public:
        ConfigNode serialize(Colour4f value, const ConfigNodeSerializationContext& context)
		{
			return ConfigNode(value.toString());
		}
		
		Colour4f deserialize(const ConfigNodeSerializationContext&, const ConfigNode& node)
        {
			return Colour4f::fromString(node.asString("#000000"));
        }
    };

	template <>
    class ConfigNodeSerializer<Rect4i> {
    public:
{'fraction_non_alphanumeric': 0.09486235314746624, 'fraction_numerical': 0.010170085919691391, 'mean_word_length': 3.737541528239203, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, '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': '6035364', 'n_tokens_mistral': 1850, 'n_tokens_neox': 1684, 'n_words': 332}