mirror of
https://github.com/rzeldent/esp32cam-rtsp.git
synced 2025-11-14 12:08:02 +00:00
Work in progress
This commit is contained in:
19
lib/template_render/template_render.h
Normal file
19
lib/template_render/template_render.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <Wstring.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *key;
|
||||
const String value;
|
||||
} template_substitution_t;
|
||||
|
||||
template<typename T, size_t n>
|
||||
inline String template_render(const char *format, T (&values)[n])
|
||||
{
|
||||
auto s = String(format);
|
||||
for (size_t i=0; i<n; i++)
|
||||
s.replace("{{" + String(values[n].key) + "}}", values[n].value);
|
||||
|
||||
return s;
|
||||
}
|
||||
Reference in New Issue
Block a user