Crow  1.1
A C++ microframework for the web
 
Loading...
Searching...
No Matches
mustache.h File Reference

This file includes the definition of the crow::mustache namespace and its members. More...

#include <string>
#include <vector>
#include <fstream>
#include <iterator>
#include <functional>
#include "crow/json.h"
#include "crow/logging.h"
#include "crow/returnable.h"
#include "crow/utility.h"

Go to the source code of this file.

Classes

class  crow::mustache::invalid_template_exception
 Represents compilation error of an template. Throwed specially at mustache compile time. More...
 
struct  crow::mustache::rendered_template
 Returned object after call the template_t::render() method. Its intended to be returned during a rule declaration. More...
 
struct  crow::mustache::Action
 Used during mustache template compilation to represent parsing actions. More...
 
class  crow::mustache::template_t
 Compiled mustache template object. More...
 

Namespaces

namespace  crow
 The main namespace of the library. In this namespace is defined the most important classes and functions of the library.
 
namespace  crow::mustache
 In this namespace is defined most of the functions and classes related to template rendering.
 

Typedefs

using crow::mustache::context = json::wvalue
 

Enumerations

enum class  crow::mustache::ActionType {
  Ignore , Tag , UnescapeTag , OpenBlock ,
  CloseBlock , ElseBlock , Partial
}
 Used in Action to represent different parsing behaviors. More...
 

Functions

template_t crow::mustache::load (const std::string &filename)
 Open, read and renders a file using a mustache compiler. It also sanitize the input before compilation.
 
template_t crow::mustache::compile (const std::string &body)
 The function that compiles a source into a mustache template.
 
std::string crow::mustache::default_loader (const std::string &filename)
 The default way that load, load_unsafe, load_text and load_text_unsafe use to read the contents of a file.
 
void crow::mustache::set_base (const std::string &path)
 Defines the templates directory path at route level. By default is templates/.
 
void crow::mustache::set_global_base (const std::string &path)
 Defines the templates directory path at global level. By default is templates/.
 
void crow::mustache::set_loader (std::function< std::string(std::string)> loader)
 Change the way that load, load_unsafe, load_text and load_text_unsafe reads a file.
 
std::string crow::mustache::load_text (const std::string &filename)
 Open, read and sanitize a file but returns a std::string without a previous rendering process.
 
std::string crow::mustache::load_text_unsafe (const std::string &filename)
 Open and read a file but returns a std::string without a previous rendering process.
 
template_t crow::mustache::load_unsafe (const std::string &filename)
 Open, read and renders a file using a mustache compiler. But it do not sanitize the input before compilation.
 

Detailed Description

This file includes the definition of the crow::mustache namespace and its members.