Isis 3 Programmer 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 
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.
The main project for ipce.
Definition: Project.h:289
File name manipulation and expansion.
Definition: FileName.h:116
QString path() const
Get the path to these Templates in the TemplateList (relative to project root).
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Handle an XML end element.
void deleteFromDisk(Project *project)
Delete all of the contained Templates from disk.
XML Handler that parses XMLs in a stack-oriented way.
XmlHandler(TemplateList *templateList, Project *project)
Create an XML Handler (reader/writer) that can populate the TemplateList class data.
~TemplateList()
Destructor.
TemplateList(QString name, QString type, QString path, QObject *parent=NULL)
Create a template from a file name, type, and path.
QString name() const
Get the human-readable name of this TemplateList.
Project * m_project
Project that contains the template list.
Definition: TemplateList.h:98
TemplateList * m_templateList
TemplateList to be read or written.
Definition: TemplateList.h:97
QString type() const
Get the type of template in this TemplateList.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
void setType(QString newType)
Set the type of template for of this TemplateList.
void setPath(QString newPath)
Set the relative path (from the project root) to this TemplateList&#39;s folder.
void setName(QString newName)
Set the human-readable name of this TemplateList.
Manage a stack of content handlers for reading XML files.