Isis 3 Developer Reference
TemplateList.h
Go to the documentation of this file.
1 #ifndef TemplateList_H
2 #define TemplateList_H
3 
26 #include <QDebug>
27 #include <QList>
28 #include <QMetaType>
29 #include <QObject>
30 
31 #include "Project.h"
32 #include "Template.h"
33 
34 
35  namespace Isis {
36 
49  class TemplateList : public QObject, public QList<Template *> {
50  Q_OBJECT
51 
52  public:
53  TemplateList(QString name, QString type, QString path, QObject *parent = NULL);
54  explicit TemplateList(QObject *parent = NULL);
55  explicit TemplateList(Project *project, XmlStackedHandlerReader *xmlReader,
56  QObject *parent = NULL);
57  TemplateList(const TemplateList &);
58  ~TemplateList();
59 
60  QString name() const;
61  QString type() const;
62  QString path() const;
63 
64  void setName(QString newName);
65  void setType(QString newType);
66  void setPath(QString newPath);
67 
68  void deleteFromDisk(Project *project);
69  void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
70 
71  private:
72  QString m_path;
73  QString m_name;
74  QString m_type;
75 
84  class XmlHandler : public XmlStackedHandler {
85 
86  public:
87  XmlHandler(TemplateList *templateList, Project *project);
88 
89  virtual bool startElement(const QString &namespaceURI, const QString &localName,
90  const QString &qName, const QXmlAttributes &atts);
91  virtual bool endElement(const QString &namespaceURI, const QString &localName,
92  const QString &qName);
93 
94  private:
95  Q_DISABLE_COPY(XmlHandler);
96 
97  TemplateList *m_templateList;
98  Project *m_project;
99  };
100 
101  };
102  }
103 
104 #endif
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Convert this TemplateList into XML format for saving/restoring capabilities.
Definition: TemplateList.cpp:195
The main project for ipce.
Definition: Project.h:289
File name manipulation and expansion.
Definition: FileName.h:116
Definition: TemplateList.h:49
QString path() const
Get the path to these Templates in the TemplateList (relative to project root).
Definition: TemplateList.cpp:116
void deleteFromDisk(Project *project)
Delete all of the contained Templates from disk.
Definition: TemplateList.cpp:158
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:112
~TemplateList()
Destructor.
Definition: TemplateList.cpp:86
TemplateList(QString name, QString type, QString path, QObject *parent=NULL)
Create a template from a file name, type, and path.
Definition: TemplateList.cpp:41
QString name() const
Get the human-readable name of this TemplateList.
Definition: TemplateList.cpp:96
QString type() const
Get the type of template in this TemplateList.
Definition: TemplateList.cpp:106
Definition: BoxcarCachingAlgorithm.h:29
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
void setType(QString newType)
Set the type of template for of this TemplateList.
Definition: TemplateList.cpp:136
void setPath(QString newPath)
Set the relative path (from the project root) to this TemplateList&#39;s folder.
Definition: TemplateList.cpp:146
void setName(QString newName)
Set the human-readable name of this TemplateList.
Definition: TemplateList.cpp:126
Manage a stack of content handlers for reading XML files.
Definition: XmlStackedHandlerReader.h:25