Logo Pico-Framework A web-first embedded framework for C++
Loading...
Searching...
No Matches
StaticView Class Reference

StaticView sends a fixed HTML string with no template substitution. More...

#include <StaticView.h>

+ Inheritance diagram for StaticView:
+ Collaboration diagram for StaticView:

Public Member Functions

 StaticView (const char *html)
 
std::string render (const std::map< std::string, std::string > &={}) const override
 Render the view body.
 
std::string getContentType () const override
 Return the MIME content type for this view.
 
- Public Member Functions inherited from FrameworkView
virtual ~FrameworkView ()=default
 
virtual void applyHeaders (HttpResponse &response) const
 Optional hook to set response headers (e.g., Content-Disposition).
 
virtual std::string render (const nlohmann::json &context) const
 Optional JSON context hook (used by JsonView or convenience).
 

Private Attributes

const char * html_
 

Detailed Description

Definition at line 12 of file StaticView.h.

Constructor & Destructor Documentation

◆ StaticView()

StaticView::StaticView ( const char *  html)
inlineexplicit

Definition at line 15 of file StaticView.h.

15: html_(html) {}
const char * html_
Definition StaticView.h:28

Member Function Documentation

◆ getContentType()

std::string StaticView::getContentType ( ) const
inlineoverridevirtual

Implements FrameworkView.

Definition at line 22 of file StaticView.h.

23 {
24 return "text/html";
25 }

◆ render()

std::string StaticView::render ( const std::map< std::string, std::string > &  context = {}) const
inlineoverridevirtual

Optional context (used by templates).

Implements FrameworkView.

Definition at line 17 of file StaticView.h.

17 {}) const override
18 {
19 return html_;
20 }

Member Data Documentation

◆ html_

const char* StaticView::html_
private

Definition at line 28 of file StaticView.h.


The documentation for this class was generated from the following file: