From cbaa413cd03b38ea3826b0e78d92a63f9d1045a1 Mon Sep 17 00:00:00 2001 From: Booklordofthedings Date: Thu, 26 Sep 2024 14:43:46 +0200 Subject: [PATCH] Update README.md --- README.md | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fdba396..68de314 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ a Array ## Index - How to install -- Changelog - The Bofa notation - Parser notes - Bofa parser API usage @@ -35,12 +34,6 @@ a Array - Add the Bofa namespace to the files you want to use Bofa with - Use Bofa -## Changelog -- Version 1.0.0 - - Initial Version - - Fast parsing - - Add automated serialization generation - ## The Bofa notation The notation itself is pretty simple. Every line contains one Bofa "Entry", but empty lines and comments are also allowed. @@ -134,6 +127,26 @@ class ExampleClass } ``` +## Bofa serialization API usage +Serialization can be used to map types from and to Bofa with only minimal work required. +The interface IBofaParseable indicates wether a specific type can be parsed. +You can manually add it to your class and its also available on some corelib types by default. +There is also an attribute you can use to make Bofa attempt to generate the interface at compile time. +```cs +[BofaSerialize(Strict = false)] //false by default. If set to true it will fail when it cant find/parse a field +class Serialization +{ + //It attempts to parse all public fields + //[BofaInclue(Name = "FieldName")] + //Can be used to include private fields and to rename fields with whatever name you want + + public int anInteger = 1; + public String aString = new .("Value") ~ delete _; + public List listOfStrings = new .() ~ DeleteContainerAndItems!(_); //As long as the T can be parsed it will also parse lists and dictionaries + [BofaRequired] public int anotherOne = 0; //Parsing will fail if this field isnt present, since its marked as required +} +``` + ## Potential improvements - There is still alot of speed left on the table - Reduce the amount of allocations