MagicSmoke  $VERSION$
MTemplate Class Reference

this class wraps a single template More...

#include <templates.h>

Public Types

typedef std::function
< MTemplate(const QList
< MTemplate > &)> 
TemplateChoserFunction
 
enum  Type {
  UnknownTemplate =0, OdtTemplate =1, OdsTemplate =2, OdpTemplate =4,
  OdgTemplate =8, OdbTemplate =0x10, OdfTemplateMask =0xff, LabelTemplate =0x100,
  ZipTemplate =0x200, HtmlTemplate =0x400, MimeTemplate =0x800
}
 template type; currently only ODF and Labels are known More...
 

Public Member Functions

 MTemplate ()
 creates an invalid template More...
 
 MTemplate (QString fn)
 creates a temporary template by a physical file name More...
 
 MTemplate (const MTemplate &)=default
 copies a template More...
 
QString baseName () const
 returns the base name of the template (eg. More...
 
QString cacheFileName () const
 returns the name/path of the cache file, if it exists More...
 
QString checksum () const
 returns the checksum (calculated by the server) More...
 
QString completeFileName () const
 returns the complete encoded name of the template (eg. More...
 
QString description () const
 returns the description More...
 
QString extension () const
 returns the extension of the template (eg. More...
 
QString fileName () const
 returns the file name of the template (eg. More...
 
QString flags () const
 returns the flags of this template More...
 
bool isHtml () const
 returns whether this is a HTML template More...
 
bool isLabel () const
 returns whether this is a label template More...
 
bool isOdf () const
 returns whether this is an ODF template More...
 
bool isValid () const
 returns whether this is a valid template More...
 
bool isZip () const
 returns whether this is a ZipTemplate More...
 
MTemplateoperator= (const MTemplate &)=default
 copies a template More...
 
void setFile (const QString &)
 reinitializes the template from the given file name More...
 
QString targetExtension () const
 returns the extension of the target document if it is saved (empty if the template cannot be saved) More...
 
Type type () const
 returns the template type More...
 
QString variantID () const
 returns the variant ID of the template (warning: it has no meaning outside the template storage system More...
 

Static Public Member Functions

static QStringList legalBaseNames ()
 returns the currently known (by the client) template base names More...
 
static QStringList legalSuffixes (QString)
 returns the legal template file suffixes (as understood by the client) for a template base name; returns empty if none is legal More...
 
static Types legalTypes (QString)
 returns the legal file types (as understood by the client) for a template base name; returns UnknownTemplate if none is legal More...
 
static void setTemplateChoiceFunction (const TemplateChoserFunction &)
 set a function to handle multiple template choices, the default is a function that choses the first one More...
 

Protected Member Functions

 MTemplate (QString fn, QString chk, QString dsc, QString flg)
 creates a template wrapper from a cache file name; this constructor is used internally in the storage system More...
 

Friends

class MTemplateChoice
 
class MTemplateStore
 

Detailed Description

this class wraps a single template

Member Typedef Documentation

typedef std::function<MTemplate(const QList<MTemplate>&)> MTemplate::TemplateChoserFunction

Member Enumeration Documentation

template type; currently only ODF and Labels are known

Enumerator
UnknownTemplate 

uninitialized or unknown label type

OdtTemplate 

ODF Text template.

OdsTemplate 

ODF SpreadSheet template.

OdpTemplate 

ODF Presentation.

OdgTemplate 

ODF Drawing.

OdbTemplate 

ODF DataBase.

OdfTemplateMask 

ODF template.

LabelTemplate 

Label template.

ZipTemplate 

Script-Zip template.

HtmlTemplate 

HTML patterns.

MimeTemplate 

MIME patterns.

Constructor & Destructor Documentation

MTemplate::MTemplate ( )

creates an invalid template

MTemplate::MTemplate ( QString  fn)

creates a temporary template by a physical file name

MTemplate::MTemplate ( const MTemplate )
default

copies a template

MTemplate::MTemplate ( QString  fn,
QString  chk,
QString  dsc,
QString  flg 
)
protected

creates a template wrapper from a cache file name; this constructor is used internally in the storage system

Parameters
fnphysical file name of the template
chkserver side check sum of the template
dscdescription of the template
flgflags of the template

Member Function Documentation

QString MTemplate::baseName ( ) const

returns the base name of the template (eg.

mytemplate for mytemplate.odtt)

QString MTemplate::cacheFileName ( ) const

returns the name/path of the cache file, if it exists

Referenced by MLabelRenderer::MLabelRenderer(), MOdtRenderer::MOdtRenderer(), and MEventView::resetPattern().

QString MTemplate::checksum ( ) const

returns the checksum (calculated by the server)

Referenced by MPServerConfig::validateConfig().

QString MTemplate::completeFileName ( ) const

returns the complete encoded name of the template (eg.

mytemplate.odtt,v1)

QString MTemplate::description ( ) const

returns the description

QString MTemplate::extension ( ) const

returns the extension of the template (eg.

odtt for mytemplate.odtt)

Referenced by targetExtension(), and type().

QString MTemplate::fileName ( ) const

returns the file name of the template (eg.

mytemplate.odtt)

QString MTemplate::flags ( ) const
inline

returns the flags of this template

bool MTemplate::isHtml ( ) const

returns whether this is a HTML template

References HtmlTemplate, and type().

Referenced by MEventView::resetPattern().

bool MTemplate::isLabel ( ) const

returns whether this is a label template

References LabelTemplate, and type().

bool MTemplate::isOdf ( ) const

returns whether this is an ODF template

References OdfTemplateMask, and type().

bool MTemplate::isValid ( ) const

returns whether this is a valid template

Referenced by MEventView::resetPattern(), and MPServerConfig::validateConfig().

bool MTemplate::isZip ( ) const

returns whether this is a ZipTemplate

References type(), and ZipTemplate.

QStringList MTemplate::legalBaseNames ( )
static

returns the currently known (by the client) template base names

References tempBaseNames.

QStringList MTemplate::legalSuffixes ( QString  bn)
static

returns the legal template file suffixes (as understood by the client) for a template base name; returns empty if none is legal

References HtmlTemplate, LabelTemplate, legalTypes(), MimeTemplate, OdfTemplateMask, and ZipTemplate.

MTemplate::Types MTemplate::legalTypes ( QString  bn)
static

returns the legal file types (as understood by the client) for a template base name; returns UnknownTemplate if none is legal

References HtmlTemplate, LabelTemplate, MimeTemplate, OdfTemplateMask, UnknownTemplate, and ZipTemplate.

Referenced by legalSuffixes().

MTemplate& MTemplate::operator= ( const MTemplate )
default

copies a template

void MTemplate::setFile ( const QString &  s)

reinitializes the template from the given file name

void MTemplate::setTemplateChoiceFunction ( const TemplateChoserFunction f)
static

set a function to handle multiple template choices, the default is a function that choses the first one

References templaceChoser().

Referenced by initTemplateChoser().

QString MTemplate::targetExtension ( ) const

returns the extension of the target document if it is saved (empty if the template cannot be saved)

References extension().

Referenced by MOdtRenderer::MOdtRenderer().

MTemplate::Type MTemplate::type ( ) const
QString MTemplate::variantID ( ) const

returns the variant ID of the template (warning: it has no meaning outside the template storage system

Friends And Related Function Documentation

friend class MTemplateChoice
friend
friend class MTemplateStore
friend

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