<commit_before>#include "sani/resource/compiler/resource_writer.hpp"
#include "sani/platform/platform_config.hpp"
#include "sani/platform/file/file_stream.hpp"
#include "sani/resource/compiler/resource_compiler.hpp"

namespace sani {
	using namespace io;
	namespace resource {
		namespace compiler {
			// DO NOT CHANGE THESE, THEY ARE FOLLOWING THE PLATFORM CONFIG
			const char ResourceWriter::Platforms[] = {
				'w', // win32
				'l', // linux
				'X', // MAC
				'a', // android
				'W', // windows phone
				'i' // iOS
				// TODO emscripte, ps4, xbox
			};

			ResourceWriter::ResourceWriter(const FileStream* stream, const ResourceCompiler* compiler) 
				: BinaryWriter(stream), compiler(compiler) {

			}
			ResourceWriter::~ResourceWriter() {}

			void ResourceWriter::writeHeader() {
#if SANI_TARGET_PLATFORM == SANI_PLATFORM_UNKOWN
#error "Couldnt determine the platform"
#endif
				// magic 3 bytes
				write('S');
				write('N');
				write('B');

				// platform
				write(Platforms[SANI_TARGET_PLATFORM]);
				// version, is this needed?
				write(Version);
			}

			void ResourceWriter::writeTypeWriters() {
				write7BitEncodedInt(writers.size());
				for (auto& kv : writers) {
					write(kv.second->getRuntimeReader());
				}
			}

			ResourceTypeWriter* ResourceWriter::getWriter(const std::type_index& info) {
				// we dont have writer yet lets add it<commit_msg>Write bytes instead of int32's<commit_after>#include "sani/resource/compiler/resource_writer.hpp"
#include "sani/platform/platform_config.hpp"
#include "sani/platform/file/file_stream.hpp"
#include "sani/resource/compiler/resource_compiler.hpp"

namespace sani {
	using namespace io;
	namespace resource {
		namespace compiler {
			// DO NOT CHANGE THESE, THEY ARE FOLLOWING THE PLATFORM CONFIG
			const char ResourceWriter::Platforms[] = {
				'w', // win32
				'l', // linux
				'X', // MAC
				'a', // android
				'W', // windows phone
				'i' // iOS
				// TODO emscripte, ps4, xbox
			};

			ResourceWriter::ResourceWriter(const FileStream* stream, const ResourceCompiler* compiler) 
				: BinaryWriter(stream), compiler(compiler) {

			}
			ResourceWriter::~ResourceWriter() {}

			void ResourceWriter::writeHeader() {
#if SANI_TARGET_PLATFORM == SANI_PLATFORM_UNKOWN
#error "Couldnt determine the platform"
#endif
				// magic 3 bytes
				write((uint8)'S');
				write((uint8)'N');
				write((uint8)'B');

				// platform
				write(Platforms[SANI_TARGET_PLATFORM]);
				// version, is this needed?
				write(Version);
			}

			void ResourceWriter::writeTypeWriters() {
				write7BitEncodedInt(writers.size());
				for (auto& kv : writers) {
					write(kv.second->getRuntimeReader());
				}
			}

			ResourceTypeWriter* ResourceWriter::getWriter(const std::type_index& info) {
				// we dont have writer yet lets add it
{'fraction_non_alphanumeric': 0.13131672597864769, 'fraction_numerical': 0.005338078291814947, 'mean_word_length': 3.6157635467980294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5702500', 'n_tokens_mistral': 1080, 'n_tokens_neox': 871, 'n_words': 203}