moved doxygen to doc folder and still working on csv

This commit is contained in:
herbglitch 2024-12-08 22:19:43 -07:00
parent ca6a9c118f
commit 280a70c6e8
24 changed files with 282 additions and 105 deletions

View file

@ -11,9 +11,10 @@ extern "C" {
#include <stdint.h>
/*
<line> -> <data> NEWLINE <line> | <data> | NEWLINE <line> | LAMBDA
<data> -> <string> COMMA <data> | <string>
<string> -> COMMON_CHAR <string> | COMON_CHAR
<line> -> <data> NEWLINE <line> | <data> | NEWLINE <line> | LAMBDA
<data> -> <string> COMMA <data> | <string>
<string> -> <nonCommaChar> <string> | <nonCommaChar>
<nonCommaChar> -> CHAR_BEFORE_COMMA | CHAR_AFTER_COMMA
*/
/**
@ -24,7 +25,7 @@ extern "C" {
* @param[in/out] data the csv data casted into the users type
* @param[in] string an value of the csv as a string
*/
typedef uint32_t (* ARC_ParserCSV_CastTypeFn)(void **data, ARC_String *string);
typedef void (* ARC_ParserCSV_CastTypeFn)(void **data, ARC_String *string);
/**
* @brief a callback for the csv parser to use to free csv data
@ -33,13 +34,12 @@ typedef uint32_t (* ARC_ParserCSV_CastTypeFn)(void **data, ARC_String *string);
*
* @param[in] data the csv data to free
*/
typedef uint32_t (* ARC_ParserCSV_DestroyTypeFn)(void *data);
typedef void (* ARC_ParserCSV_DestroyTypeFn)(void *data);
/**
* @brief defines a csv data type, data is set by the callback passed in when createing a parserCSV as parser
*
* @note this data can be retieved after parsing by calling get data, check arc/std/parser.h for more information
* @note destroyTypeFn is stored here (for clearing as userdata is not passed in then) but should not be used by anything but the parser
*/
typedef struct ARC_ParserCSVData {
ARC_Bool hasHeader;
@ -47,9 +47,7 @@ typedef struct ARC_ParserCSVData {
uint32_t width;
uint32_t height;
void **data;
ARC_ParserCSV_DestroyTypeFn destroyTypeFn;
void ***data;
} ARC_ParserCSVData;
/**
@ -62,6 +60,15 @@ typedef struct ARC_ParserCSVData {
*/
void ARC_ParserCSV_CreateAsParser(ARC_Parser **parser, ARC_Bool header, ARC_ParserCSV_CastTypeFn castTypeFn, ARC_ParserCSV_DestroyTypeFn destroyTypeFn);
#define ARC_PARSER_CSV_CHAR_COMMA 1
#define ARC_PARSER_CSV_CHAR_NEWLINE 2
#define ARC_PARSER_CSV_CHAR_BEFORE_COMMA 3
#define ARC_PARSER_CSV_CHAR_AFTER_COMMA 4
#define ARC_PARSER_CSV_LINE 5
#define ARC_PARSER_CSV_DATA 6
#define ARC_PARSER_CSV_STRING 7
#define ARC_PARSER_CSV_NON_COMMA_CHAR 8
#ifdef __cplusplus
}
#endif