aboutsummaryrefslogtreecommitdiff
path: root/src/format.h
blob: e5173debf67f00aefc733ecf5335c91b6a887b4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef COMET_FORMAT_H
#define COMET_FORMAT_H

#include <stdint.h>
#include <stdbool.h>

typedef int format_mark_t;

typedef struct {
    char *string;
    format_mark_t mark;
} format_pair_t;

typedef struct {
    format_pair_t *parts;
    size_t length;
} format_t;

typedef struct {
    format_pair_t option;
    format_pair_t *prefixes;
    format_pair_t *suffixes;
} format_option_t;

bool format_init(format_t *format, const char *string, char delim);

int format_remark(format_t *format, const char *label, const format_option_t *options);

void format_free(format_t *format);

#endif