NuriaProject Framework  0.1
The NuriaProject Framework
Public Types | Public Member Functions | List of all members
Nuria::MemoryTemplateLoader Class Reference

A template loader which stores templates in-memory. More...

#include <memorytemplateloader.hpp>

Inheritance diagram for Nuria::MemoryTemplateLoader:
Nuria::TemplateLoader

Public Types

typedef QMap< QString, QByteArray > Map
 

Public Member Functions

 MemoryTemplateLoader (QObject *parent=0)
 
 MemoryTemplateLoader (Map map, QObject *parent=0)
 
 ~MemoryTemplateLoader () override
 
void addTemplate (const QString &name, const QByteArray &data)
 
bool hasTemplate (const QString &name) override
 
QByteArray load (const QString &name) override
 
Map map () const
 
void removeTemplate (const QString &name)
 
void setMap (const Map &map)
 
- Public Member Functions inherited from Nuria::TemplateLoader
 TemplateLoader (QObject *parent=0)
 
 ~TemplateLoader () override
 
virtual bool hasTemplateChanged (const QString &name, const QDateTime &since)
 

Additional Inherited Members

- Signals inherited from Nuria::TemplateLoader
void allTemplatesChanged ()
 
void templateChanged (const QString &name)
 

Detailed Description

A template loader which stores templates in-memory.

This template loader is essentially a wraper around a associative array, as in a QMap, storing templates completely in-memory.

Note
Template names are case-sensitive

Member Typedef Documentation

typedef QMap< QString, QByteArray > Nuria::MemoryTemplateLoader::Map

The storage type for templates. The key is the template name and the corresponding value the template data.

Constructor & Destructor Documentation

Nuria::MemoryTemplateLoader::MemoryTemplateLoader ( QObject *  parent = 0)
explicit

Default constructor. The template map is empty.

See also
addTemplate setMap
Nuria::MemoryTemplateLoader::MemoryTemplateLoader ( Map  map,
QObject *  parent = 0 
)
explicit

Constructor which uses map as template storage.

Nuria::MemoryTemplateLoader::~MemoryTemplateLoader ( )
override

Destructor.

Member Function Documentation

void Nuria::MemoryTemplateLoader::addTemplate ( const QString &  name,
const QByteArray &  data 
)

Adds a template called name with data. If there's already a template with this name, the old one will be overridden.

bool Nuria::MemoryTemplateLoader::hasTemplate ( const QString &  name)
overridevirtual

Returns true if a template name is known to the template loader. The default implementation returns true if name is not empty.

Reimplemented from Nuria::TemplateLoader.

QByteArray Nuria::MemoryTemplateLoader::load ( const QString &  name)
overridevirtual

Returns the data of template name.

See also
addTemplate setMap

Reimplemented from Nuria::TemplateLoader.

Map Nuria::MemoryTemplateLoader::map ( ) const

Returns the template map.

void Nuria::MemoryTemplateLoader::removeTemplate ( const QString &  name)

Removes the template called name.

void Nuria::MemoryTemplateLoader::setMap ( const Map map)

Sets the template map.


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