24 lines
897 B
C
24 lines
897 B
C
// Copyright (c) 2021 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#pragma once
|
|
#include <dawn/dawn.h>
|
|
|
|
/**
|
|
* Replaces handlebars within the string with items from the list of variables.
|
|
* Output of replacement is stored in the buffer provided. Handlebars within the
|
|
* string should be in the format of; "{{ key }}", spaces within the bars will
|
|
* be skipped. Variable keys cannot exceed STRING_HANDLEBAR_KEY_MAXLENGTH in
|
|
* length.
|
|
*
|
|
* @param string String to parse.
|
|
* @param variables Variables to use in the parsing.
|
|
* @param variableCount How many variables in the array.
|
|
* @param buffer Buffer to write characters in to.
|
|
* @return The count of characters that were written to the buffer.
|
|
*/
|
|
int32_t stringHandlebarsBuffer(char *source,
|
|
stringhandlebarvariable_t *variables, int32_t variableCount, char *buffer
|
|
); |