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

#include <FrameworkView.h>

+ Inheritance diagram for FrameworkView:
+ Collaboration diagram for FrameworkView:

Public Member Functions

virtual ~FrameworkView ()=default
 
virtual std::string render (const std::map< std::string, std::string > &context={}) const =0
 Render the view body.
 
virtual std::string getContentType () const =0
 Return the MIME content type for this view.
 
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).
 

Detailed Description

Definition at line 21 of file FrameworkView.h.

Constructor & Destructor Documentation

◆ ~FrameworkView()

virtual FrameworkView::~FrameworkView ( )
virtualdefault

Member Function Documentation

◆ applyHeaders()

virtual void FrameworkView::applyHeaders ( HttpResponse response) const
inlinevirtual

Definition at line 38 of file FrameworkView.h.

38{}

Referenced by HttpResponse::send().

+ Here is the caller graph for this function:

◆ getContentType()

virtual std::string FrameworkView::getContentType ( ) const
pure virtual

Implemented in FileView, HtmlTemplateView, JsonView, and StaticView.

Referenced by HttpResponse::send().

+ Here is the caller graph for this function:

◆ render() [1/2]

virtual std::string FrameworkView::render ( const nlohmann::json &  context) const
inlinevirtual

Definition at line 43 of file FrameworkView.h.

43 {
44 return render(); // fallback ignores json
45 }
virtual std::string render(const std::map< std::string, std::string > &context={}) const =0
Render the view body.

References render().

+ Here is the call graph for this function:

◆ render() [2/2]

virtual std::string FrameworkView::render ( const std::map< std::string, std::string > &  context = {}) const
pure virtual

Optional context (used by templates).

Implemented in StaticView, FileView, HtmlTemplateView, and JsonView.

Referenced by render(), and HttpResponse::send().

+ Here is the caller graph for this function:

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