2022-04-21 20:01:59 +00:00
|
|
|
#ifndef APFL_FORMAT_H
|
|
|
|
|
#define APFL_FORMAT_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
#include "apfl.h"
|
|
|
|
|
|
|
|
|
|
struct apfl_format_writer {
|
|
|
|
|
bool (*write)(void *, const char *buf, size_t len);
|
|
|
|
|
void *opaque;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct apfl_format_writer apfl_format_file_writer(FILE *f);
|
|
|
|
|
|
2022-04-21 20:40:27 +00:00
|
|
|
struct apfl_format_writer apfl_format_string_writer(struct apfl_string_builder *sb);
|
|
|
|
|
|
2022-04-21 20:01:59 +00:00
|
|
|
bool apfl_format_put_string_view(struct apfl_format_writer, struct apfl_string_view);
|
|
|
|
|
#define apfl_format_put_string(w, s) apfl_format_put_string_view((w), apfl_string_view_from(s))
|
|
|
|
|
bool apfl_format_put_int(struct apfl_format_writer, int);
|
|
|
|
|
bool apfl_format_put_char(struct apfl_format_writer, char);
|
|
|
|
|
bool apfl_format_put_hexbyte(struct apfl_format_writer, unsigned char);
|
2022-04-22 20:52:53 +00:00
|
|
|
bool apfl_format_put_pos(struct apfl_format_writer, struct apfl_position);
|
|
|
|
|
bool apfl_format_put_indent(struct apfl_format_writer, unsigned);
|
|
|
|
|
bool apfl_format_put_number(struct apfl_format_writer, apfl_number);
|
2022-04-21 20:01:59 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|