KTextTemplate::Exception

Search for usage in LXR

KTextTemplate::Exception Class Reference

#include <KTextTemplate/Exception>

Public Member Functions

 Exception (Error errorCode, const QString &what)
 

Detailed Description

An exception for use when implementing template tags.

The Exception class can be used when implementing AbstractNodeFactory::getNode. An exception can be thrown to indicate that the syntax of a particular tag is invalid.

For example, the following template markup should throw an error because the include tag should have exactly one argument:

<div>
{% include %}
</div>

The corresponding implementation of IncludeNodeFactory::getNode is

QStringList tagContents = smartSplit( tagContent );
if ( tagContents.size() != 2 )
throw KTextTemplate::Exception( TagSyntaxError,
"Error: Include tag takes exactly one argument" );
// The item at index 0 in the list is the tag name, "include"
QString includeName = tagContents.at( 1 );
Author
Stephen Kelly steve[email protected][email protected][email protected]gmail[email protected].com

Definition at line 84 of file exception.h.

Constructor & Destructor Documentation

◆ Exception()

KTextTemplate::Exception::Exception ( Error  errorCode,
const QString what 
)
inline

Creates an exception for the error errorCode and the verbose message what.

Definition at line 91 of file exception.h.


The documentation for this class was generated from the following file:
int size() const const
const T & at(int i) const const
An exception for use when implementing template tags.
Definition: exception.h:84
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 04:01:03 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.