Isis 3 Programmer Reference
Template.h
Go to the documentation of this file.
1 #ifndef Template_H
2 #define Template_H
3 
26  #include <QObject>
27  #include <QString>
28  #include <QXmlStreamWriter>
29 
30  #include "FileName.h"
31  #include "XmlStackedHandler.h"
32 
33  namespace Isis {
34  class FileName;
35  class Project;
36 
44  class Template : public QObject {
45  Q_OBJECT
46 
47  public:
48  explicit Template(QString fileName, QString templateType, QString importName, QObject *parent = 0);
49  Template(FileName templateFolder, XmlStackedHandlerReader *xmlReader, QObject *parent = 0);
50  ~Template();
51 
52  QString importName() const;
53  QString fileName() const;
54  QString templateType() const;
55 
56  void deleteFromDisk();
57  void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
58 
59  public slots:
60  void updateFileName(Project * project);
61 
62  private:
71  class XmlHandler : public XmlStackedHandler {
72  public:
73  XmlHandler(Template *currentTemplate, FileName templateFolder);
74 
75  virtual bool startElement(const QString &namespaceURI, const QString &localName,
76  const QString &qName, const QXmlAttributes &atts);
77 
78  private:
79  Q_DISABLE_COPY(XmlHandler);
80 
84  };
85 
86  private:
87  QString m_fileName; // File name of the template associated with this object
88  QString m_templateType; // Type of template (maps/registrations)
89  QString m_importName; // Name of TemplateList this was imported in
90 
91  };
92  }
93 
95 
96  #endif
void deleteFromDisk()
Delete the template from disk.
Definition: Template.cpp:88
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.
Definition: Template.cpp:141
Template * m_xmlHandlerTemplate
A pointer to the Template object to be read or written.
Definition: Template.h:81
The main project for ipce.
Definition: Project.h:289
void updateFileName(Project *project)
Change the file name for this template to be where it now is with the given project.
Definition: Template.cpp:78
File name manipulation and expansion.
Definition: FileName.h:116
XmlHandler(Template *currentTemplate, FileName templateFolder)
Constructor for the Template object&#39;s XmlHandler.
Definition: Template.cpp:123
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Method to write this Template object&#39;s member data to an XML stream.
Definition: Template.cpp:105
QString fileName() const
Get the file name that this Template represents.
Definition: Template.cpp:50
Template(QString fileName, QString templateType, QString importName, QObject *parent=0)
Create a Template from template file&#39;s name.
Definition: Template.cpp:19
Q_DECLARE_METATYPE(Isis::Cube *)
This allows Cube *&#39;s to be stored in a QVariant.
QString importName() const
Get the name of the TemplateList this file was imported under.
Definition: Template.cpp:68
FileName m_xmlHandlerTemplateFolderName
The name of the folder for the template xml.
Definition: Template.h:83
XML Handler that parses XMLs in a stack-oriented way.
QString templateType() const
Get the type of template.
Definition: Template.cpp:59
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
~Template()
Destroys Template object.
Definition: Template.cpp:42
Manage a stack of content handlers for reading XML files.