Files
DFTE/include/TemplateEngine.h
T
alex 73fdd28f74 Harden DFTE rendering and placeholder registration to fail safely under stalled and invalid inputs.
Add regression coverage and docs updates so these edge cases stay stable across board test runs.
2026-04-16 13:48:25 +10:00

49 lines
1.6 KiB
C

#ifndef TEMPLATE_ENGINE_H
#define TEMPLATE_ENGINE_H
/**
* DeviceFramework Template Engine
* Main public API header - include this in your projects
*
* Memory-efficient streaming template renderer for ESP8266/ESP32
* Supports chunked rendering with PROGMEM templates and nested template support
*
* Usage:
* 1. Create a PlaceholderRegistry and register your placeholders
* 2. Create a TemplateContext
* 3. Set the registry on the context
* 4. Initialize with your template
* 5. Call renderNextChunk() repeatedly until complete
*
* Example:
* DeviceFrameworkPlaceholderRegistry registry;
* registry.registerProgmemData("%CSS%", my_css);
*
* DeviceFrameworkTemplateContext ctx;
* ctx.setRegistry(&registry);
* DeviceFrameworkTemplateRenderer::initializeContext(ctx, my_template);
*
* uint8_t buffer[512];
* while (!DeviceFrameworkTemplateRenderer::isComplete(ctx)) {
* size_t written = DeviceFrameworkTemplateRenderer::renderNextChunk(ctx, buffer, sizeof(buffer));
* server->sendContent((const char*)buffer, written);
* }
*/
// Type definitions first
#include "DeviceFrameworkTemplateTypes.h"
// Core components
#include "DeviceFrameworkTemplateRenderer.h"
#include "DeviceFrameworkTemplateContext.h"
#include "DeviceFrameworkPlaceholderRegistry.h"
#include "DeviceFrameworkTemplateEngineDebug.h"
// Type aliases for convenience
using TemplateRenderer = DeviceFrameworkTemplateRenderer;
using TemplateContext = DeviceFrameworkTemplateContext;
using PlaceholderRegistry = DeviceFrameworkPlaceholderRegistry;
#endif // TEMPLATE_ENGINE_H