summaryrefslogtreecommitdiffstats
path: root/src/common/format.h
blob: 5be5dffae745ed3e62582f4230f45689a22ce07f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#pragma once

#include "common/argType.h"

typedef struct FFformatarg {
    FFArgType type;
    const void* value;
    const char* name; // argument name, must start with an alphabet
} FFformatarg;

void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
bool ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
#define FF_PARSE_FORMAT_STRING_CHECKED(buffer, formatstr, arguments) \
    ffParseFormatString((buffer), (formatstr), sizeof(arguments) / sizeof(*arguments), (arguments));