server/src/util/order_parser.h

32 lines
758 B
C
Raw Normal View History

2018-09-29 18:13:32 +02:00
#ifndef UTIL_ORDER_PARSER_H
#define UTIL_ORDER_PARSER_H
#include <stddef.h>
#include <stdbool.h>
struct OrderParserStruct;
typedef struct OrderParserStruct *OP_Parser;
enum OP_Status {
OP_STATUS_ERROR = 0,
OP_STATUS_OK = 1
};
2018-09-30 13:45:19 +02:00
enum OP_Error {
OP_ERROR_NONE,
OP_ERROR_NO_MEMORY,
OP_ERROR_SYNTAX
};
typedef void(*OP_OrderHandler) (void *userData, const char *str);
2018-09-29 18:13:32 +02:00
OP_Parser OP_ParserCreate(void);
void OP_ParserFree(OP_Parser parser);
void OP_ParserReset(OP_Parser parser);
enum OP_Status OP_Parse(OP_Parser parser, const char *s, int len, int isFinal);
void OP_SetOrderHandler(OP_Parser parser, OP_OrderHandler handler);
void OP_SetUserData(OP_Parser parser, void *userData);
2018-10-02 21:40:14 +02:00
enum OP_Error OP_GetErrorCode(OP_Parser parser);
2018-09-29 18:13:32 +02:00
#endif