My Project
|
Internal class representing the implementation of a template context. More...
Public Member Functions | |
TemplateContextImpl (const TemplateEngine *e) | |
virtual | ~TemplateContextImpl () |
void | push () |
void | pop () |
void | set (const char *name, const TemplateVariant &v) |
TemplateVariant | get (const QCString &name) const |
const TemplateVariant * | getRef (const QCString &name) const |
void | setOutputDirectory (const QCString &dir) |
void | setEscapeIntf (const QCString &ext, TemplateEscapeIntf *intf) |
void | selectEscapeIntf (const QCString &ext) |
void | setActiveEscapeIntf (TemplateEscapeIntf *intf) |
void | setSpacelessIntf (TemplateSpacelessIntf *intf) |
TemplateBlockContext * | blockContext () |
TemplateVariant | getPrimary (const QCString &name) const |
void | setLocation (const QCString &templateName, int line) |
QCString | templateName () const |
int | line () const |
QCString | outputDirectory () const |
TemplateEscapeIntf * | escapeIntf () const |
TemplateSpacelessIntf * | spacelessIntf () const |
void | enableSpaceless (bool b) |
bool | spacelessEnabled () const |
void | enableTabbing (bool b) |
bool | tabbingEnabled () const |
bool | needsRecoding () const |
QCString | encoding () const |
void | setEncoding (const QCString &file, int line, const QCString &enc) |
QCString | recode (const QCString &s) |
void | warn (const char *fileName, int line, const char *fmt,...) const |
void | openSubIndex (const QCString &indexName) |
void | closeSubIndex (const QCString &indexName) |
void | addIndexEntry (const QCString &indexName, const QValueList< TemplateKeyValue > &arguments) |
Public Member Functions inherited from TemplateContext | |
virtual | ~TemplateContext () |
Private Attributes | |
const TemplateEngine * | m_engine |
QCString | m_templateName |
int | m_line |
QCString | m_outputDir |
QList< QDict< TemplateVariant > > | m_contextStack |
TemplateBlockContext | m_blockContext |
QDict< TemplateEscapeIntf * > | m_escapeIntfDict |
TemplateEscapeIntf * | m_activeEscapeIntf |
TemplateSpacelessIntf * | m_spacelessIntf |
bool | m_spacelessEnabled |
bool | m_tabbingEnabled |
TemplateAutoRef< TemplateStruct > | m_indices |
QDict< QStack< TemplateVariant > > | m_indexStacks |
QCString | m_encoding |
void * | m_fromUtf8 |
Internal class representing the implementation of a template context.
Definition at line 512 of file template.cpp.
TemplateContextImpl::TemplateContextImpl | ( | const TemplateEngine * | e | ) |
Definition at line 2367 of file template.cpp.
References TemplateAutoRef< T >::get(), m_contextStack, m_escapeIntfDict, m_fromUtf8, m_indexStacks, m_indices, and push().
|
virtual |
void TemplateContextImpl::addIndexEntry | ( | const QCString & | indexName, |
const QValueList< TemplateKeyValue > & | arguments | ||
) |
Definition at line 2619 of file template.cpp.
References TemplateList::alloc(), TemplateStruct::alloc(), TemplateList::append(), TemplateList::at(), TemplateList::count(), TemplateVariant::Delegate::fromFunction(), getPathFunc(), TemplateVariant::List, m_indexStacks, m_indices, TemplateStruct::set(), TemplateVariant::Struct, languages::tmp, and TemplateVariant::type().
Referenced by TemplateNodeIndexEntry::render().
TemplateBlockContext * TemplateContextImpl::blockContext | ( | ) |
Definition at line 2538 of file template.cpp.
References m_blockContext.
Referenced by TemplateImpl::render(), TemplateNodeBlock::render(), and TemplateNodeExtend::render().
void TemplateContextImpl::closeSubIndex | ( | const QCString & | indexName | ) |
Definition at line 2573 of file template.cpp.
References m_indexStacks, m_line, m_templateName, TemplateStruct::set(), TemplateVariant::Struct, and warn().
Referenced by TemplateNodeCloseSubIndex::render().
|
inline |
Definition at line 548 of file template.cpp.
References m_spacelessEnabled, m_spacelessIntf, and TemplateSpacelessIntf::reset().
Referenced by TemplateNodeMsg::render(), TemplateNodeSpaceless::render(), and TemplateNodeMarkers::render().
|
inline |
Definition at line 552 of file template.cpp.
References TemplateEscapeIntf::enableTabbing(), m_activeEscapeIntf, and m_tabbingEnabled.
Referenced by TemplateNodeTabbing::render().
|
inline |
Definition at line 557 of file template.cpp.
References m_encoding.
Referenced by TemplateNodeEncoding::render().
|
inline |
Definition at line 546 of file template.cpp.
References m_activeEscapeIntf.
Referenced by TemplateNodeVariable::render(), TemplateNodeMsg::render(), TemplateNodeCreate::render(), and TemplateNodeCycle::render().
|
virtual |
Gets the value for a given key
[in] | name | The name of key. |
Implements TemplateContext.
Definition at line 2437 of file template.cpp.
References TemplateListIntf::at(), TemplateStructIntf::get(), getPrimary(), TemplateVariant::isValid(), TemplateVariant::List, m_line, m_templateName, TemplateVariant::Struct, TemplateVariant::toList(), TemplateVariant::toStruct(), TemplateVariant::type(), and warn().
TemplateVariant TemplateContextImpl::getPrimary | ( | const QCString & | name | ) | const |
|
virtual |
Returns a pointer to the value corresponding to a given key.
[in] | name | The name of key. |
Implements TemplateContext.
Definition at line 2505 of file template.cpp.
References m_contextStack.
Referenced by getPrimary().
|
inline |
Definition at line 544 of file template.cpp.
References m_line.
Referenced by ExprAstFilter::apply(), ExprAstVariable::resolve(), ExprAstBinary::resolve(), and setLocation().
|
inline |
Definition at line 556 of file template.cpp.
References m_encoding.
Referenced by TemplateNodeText::render(), TemplateNodeVariable::render(), TemplateNodeCycle::render(), and TemplateNodeMarkers::render().
void TemplateContextImpl::openSubIndex | ( | const QCString & | indexName | ) |
Definition at line 2552 of file template.cpp.
References TemplateList::alloc(), TemplateVariant::List, m_indexStacks, m_line, m_templateName, TemplateStruct::set(), and warn().
Referenced by TemplateNodeOpenSubIndex::render().
|
inline |
Definition at line 545 of file template.cpp.
References m_outputDir.
Referenced by TemplateNodeCreator< TemplateNodeBlock >::mkpath(), TemplateNodeCreate::render(), and TemplateNodeResource::render().
|
virtual |
Pop the current scope from the stack.
Implements TemplateContext.
Definition at line 2530 of file template.cpp.
References m_contextStack, m_line, m_templateName, and warn().
Referenced by TemplateNodeBlock::render(), and ~TemplateContextImpl().
|
virtual |
Push a new scope on the stack.
Implements TemplateContext.
Definition at line 2523 of file template.cpp.
References m_contextStack.
Referenced by TemplateNodeBlock::render(), and TemplateContextImpl().
QCString TemplateContextImpl::recode | ( | const QCString & | s | ) |
Definition at line 2404 of file template.cpp.
References m_fromUtf8, and portable_iconv().
Referenced by TemplateNodeText::render(), TemplateNodeVariable::render(), TemplateNodeCycle::render(), and TemplateNodeMarkers::render().
|
inline |
Definition at line 531 of file template.cpp.
References m_activeEscapeIntf, and m_escapeIntfDict.
Referenced by TemplateNodeCreate::render().
|
virtual |
Sets a value in the current scope.
[in] | name | The name of the value; the key in the dictionary. |
[in] | v | The value associated with the key. |
Implements TemplateContext.
Definition at line 2427 of file template.cpp.
References m_contextStack.
Referenced by TemplateNodeBlock::render(), TemplateNodeWith::render(), and TemplateNodeSet::render().
|
inline |
Definition at line 535 of file template.cpp.
References m_activeEscapeIntf.
Referenced by TemplateNodeMsg::render(), and TemplateNodeCreate::render().
void TemplateContextImpl::setEncoding | ( | const QCString & | file, |
int | line, | ||
const QCString & | enc | ||
) |
Definition at line 2384 of file template.cpp.
References m_encoding, m_fromUtf8, portable_iconv_close(), portable_iconv_open(), and warn().
Referenced by TemplateNodeEncoding::render().
|
inlinevirtual |
Sets the interface that will be used for escaping the result of variable expansion before writing it to the output.
Implements TemplateContext.
Definition at line 526 of file template.cpp.
References m_escapeIntfDict.
|
inline |
Definition at line 541 of file template.cpp.
References line(), m_line, m_templateName, and templateName().
Referenced by TemplateNodeVariable::render(), TemplateNodeIf::render(), TemplateNodeRepeat::render(), TemplateNodeRange::render(), TemplateNodeFor::render(), TemplateNodeMsg::render(), TemplateNodeBlock::render(), TemplateNodeExtend::render(), TemplateNodeInclude::render(), TemplateNodeCreate::render(), TemplateNodeTree::render(), TemplateNodeIndexEntry::render(), TemplateNodeOpenSubIndex::render(), TemplateNodeCloseSubIndex::render(), TemplateNodeWith::render(), TemplateNodeCycle::render(), TemplateNodeSet::render(), TemplateNodeSpaceless::render(), TemplateNodeMarkers::render(), TemplateNodeTabbing::render(), TemplateNodeResource::render(), and TemplateNodeEncoding::render().
|
inlinevirtual |
When files are created (i.e. by {% create ... %}) they written to the directory dir.
Implements TemplateContext.
Definition at line 524 of file template.cpp.
References m_outputDir.
|
inlinevirtual |
Sets the interface that will be used inside a spaceless block to remove any redundant whitespace.
Implements TemplateContext.
Definition at line 536 of file template.cpp.
References m_spacelessIntf.
|
inline |
Definition at line 551 of file template.cpp.
References m_spacelessEnabled, and m_spacelessIntf.
Referenced by TemplateNodeText::render(), TemplateNodeMsg::render(), TemplateNodeSpaceless::render(), and TemplateNodeMarkers::render().
|
inline |
Definition at line 547 of file template.cpp.
References m_spacelessIntf.
Referenced by TemplateNodeText::render().
|
inline |
Definition at line 555 of file template.cpp.
References m_tabbingEnabled.
Referenced by TemplateNodeTabbing::render().
|
inline |
Definition at line 543 of file template.cpp.
References m_templateName.
Referenced by ExprAstFilter::apply(), ExprAstVariable::resolve(), ExprAstBinary::resolve(), and setLocation().
void TemplateContextImpl::warn | ( | const char * | fileName, |
int | line, | ||
const char * | fmt, | ||
... | |||
) | const |
Definition at line 2543 of file template.cpp.
References m_engine, TemplateEngine::printIncludeContext(), and va_warn().
Referenced by ExprAstFilter::apply(), closeSubIndex(), get(), openSubIndex(), pop(), TemplateNodeIf::render(), TemplateNodeRepeat::render(), TemplateNodeRange::render(), TemplateNodeFor::render(), TemplateNodeExtend::render(), TemplateNodeInclude::render(), TemplateNodeCreate::render(), TemplateNodeTree::render(), TemplateNodeMarkers::render(), TemplateNodeResource::render(), TemplateNodeTree::renderChildren(), ExprAstVariable::resolve(), ExprAstBinary::resolve(), and setEncoding().
|
private |
Definition at line 575 of file template.cpp.
Referenced by enableTabbing(), escapeIntf(), selectEscapeIntf(), and setActiveEscapeIntf().
|
private |
Definition at line 573 of file template.cpp.
Referenced by blockContext().
|
private |
Definition at line 572 of file template.cpp.
Referenced by getRef(), pop(), push(), set(), and TemplateContextImpl().
|
private |
Definition at line 581 of file template.cpp.
Referenced by encoding(), needsRecoding(), and setEncoding().
|
private |
Definition at line 568 of file template.cpp.
Referenced by warn().
|
private |
Definition at line 574 of file template.cpp.
Referenced by selectEscapeIntf(), setEscapeIntf(), and TemplateContextImpl().
|
private |
Definition at line 582 of file template.cpp.
Referenced by recode(), setEncoding(), and TemplateContextImpl().
|
private |
Definition at line 580 of file template.cpp.
Referenced by addIndexEntry(), closeSubIndex(), openSubIndex(), and TemplateContextImpl().
|
private |
Definition at line 579 of file template.cpp.
Referenced by addIndexEntry(), and TemplateContextImpl().
|
private |
Definition at line 570 of file template.cpp.
Referenced by closeSubIndex(), get(), line(), openSubIndex(), pop(), and setLocation().
|
private |
Definition at line 571 of file template.cpp.
Referenced by outputDirectory(), and setOutputDirectory().
|
private |
Definition at line 577 of file template.cpp.
Referenced by enableSpaceless(), and spacelessEnabled().
|
private |
Definition at line 576 of file template.cpp.
Referenced by enableSpaceless(), setSpacelessIntf(), spacelessEnabled(), and spacelessIntf().
|
private |
Definition at line 578 of file template.cpp.
Referenced by enableTabbing(), and tabbingEnabled().
|
private |
Definition at line 569 of file template.cpp.
Referenced by closeSubIndex(), get(), openSubIndex(), pop(), setLocation(), and templateName().