master ohmu/fastfetch-openbsd / src / common / format.h
ohmu  ·  2026-10-15
 1#pragma once
 2
 3#include "common/argType.h"
 4
 5typedef struct FFformatarg {
 6    FFArgType type;
 7    const void* value;
 8    const char* name; // argument name, must start with an alphabet
 9} FFformatarg;
10
11void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
12bool ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
13#define FF_PARSE_FORMAT_STRING_CHECKED(buffer, formatstr, arguments) \
14    ffParseFormatString((buffer), (formatstr), sizeof(arguments) / sizeof(*arguments), (arguments));