Isis 3 Developer 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 
81  Template *m_xmlHandlerTemplate;
83  FileName m_xmlHandlerTemplateFolderName;
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
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
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
Definition: Template.h:44
QString importName() const
Get the name of the TemplateList this file was imported under.
Definition: Template.cpp:68
Q_DECLARE_METATYPE(Isis::Template *)
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:112
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.
Definition: XmlStackedHandlerReader.h:25