8 #include "XmlStackedHandlerReader.h" 60 return m_templateType;
89 if (!QFile::remove(m_fileName)) {
91 tr(
"Could not remove file [%1]").arg(m_fileName),
107 stream.writeStartElement(
"template");
108 stream.writeAttribute(
"fileName",
FileName(m_fileName).name());
109 stream.writeAttribute(
"templateType", m_templateType);
110 stream.writeAttribute(
"importName", m_importName);
111 stream.writeEndElement();
142 const QString &qName,
const QXmlAttributes &atts) {
143 if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
144 if (localName ==
"template") {
145 QString
fileName = atts.value(
"fileName");
147 QString
importName = atts.value(
"importName");
150 m_xmlHandlerTemplate->m_fileName = m_xmlHandlerTemplateFolderName.expanded()
161 m_xmlHandlerTemplate->m_importName =
importName;
static QString templateRoot(QString projectRoot)
Appends the root directory name 'templates' to the project .
void deleteFromDisk()
Delete the template from disk.
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Method to read the given XML formatted attribute for a Template object into the XmlHandler.
Template * m_xmlHandlerTemplate
A pointer to the Template object to be read or written.
The main project for ipce.
void updateFileName(Project *project)
Change the file name for this template to be where it now is with the given project.
File name manipulation and expansion.
XmlHandler(Template *currentTemplate, FileName templateFolder)
Constructor for the Template object's XmlHandler.
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Method to write this Template object's member data to an XML stream.
QString fileName() const
Get the file name that this Template represents.
Template(QString fileName, QString templateType, QString importName, QObject *parent=0)
Create a Template from template file's name.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
A type of error that occurred when performing an actual I/O operation.
QString importName() const
Get the name of the TemplateList this file was imported under.
FileName m_xmlHandlerTemplateFolderName
The name of the folder for the template xml.
#define _FILEINFO_
Macro for the filename and line number.
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
QString templateType() const
Get the type of template.
Namespace for ISIS/Bullet specific routines.
~Template()
Destroys Template object.
Manage a stack of content handlers for reading XML files.