Isis 3 Programmer Reference
TemplateList.h
1 #ifndef TemplateList_H
2 #define TemplateList_H
3 
10 /* SPDX-License-Identifier: CC0-1.0 */
11 
12 #include <QDebug>
13 #include <QList>
14 #include <QMetaType>
15 #include <QObject>
16 
17 #include "Project.h"
18 #include "Template.h"
19 
20 
21  namespace Isis {
22 
35  class TemplateList : public QObject, public QList<Template *> {
36  Q_OBJECT
37 
38  public:
39  TemplateList(QString name, QString type, QString path, QObject *parent = NULL);
40  explicit TemplateList(QObject *parent = NULL);
41  explicit TemplateList(Project *project, XmlStackedHandlerReader *xmlReader,
42  QObject *parent = NULL);
43  TemplateList(const TemplateList &);
44  ~TemplateList();
45 
46  QString name() const;
47  QString type() const;
48  QString path() const;
49 
50  void setName(QString newName);
51  void setType(QString newType);
52  void setPath(QString newPath);
53 
54  void deleteFromDisk(Project *project);
55  void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
56 
57  private:
58  QString m_path;
59  QString m_name;
60  QString m_type;
61 
70  class XmlHandler : public XmlStackedHandler {
71 
72  public:
73  XmlHandler(TemplateList *templateList, Project *project);
74 
75  virtual bool startElement(const QString &namespaceURI, const QString &localName,
76  const QString &qName, const QXmlAttributes &atts);
77  virtual bool endElement(const QString &namespaceURI, const QString &localName,
78  const QString &qName);
79 
80  private:
81  Q_DISABLE_COPY(XmlHandler);
82 
85  };
86 
87  };
88  }
89 
90 #endif
Isis::TemplateList::save
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Convert this TemplateList into XML format for saving/restoring capabilities.
Definition: TemplateList.cpp:180
Isis::TemplateList::XmlHandler
Definition: TemplateList.h:70
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Project.h
Isis::TemplateList::XmlHandler::startElement
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
Definition: TemplateList.cpp:265
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::TemplateList::XmlHandler::endElement
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Handle an XML end element.
Definition: TemplateList.cpp:307
Isis::TemplateList
Definition: TemplateList.h:35
Isis::TemplateList::path
QString path() const
Get the path to these Templates in the TemplateList (relative to project root).
Definition: TemplateList.cpp:101
Isis::XmlStackedHandlerReader
Manage a stack of content handlers for reading XML files.
Definition: XmlStackedHandlerReader.h:30
Isis::Project
The main project for ipce.
Definition: Project.h:289
Isis::TemplateList::deleteFromDisk
void deleteFromDisk(Project *project)
Delete all of the contained Templates from disk.
Definition: TemplateList.cpp:143
Isis::TemplateList::~TemplateList
~TemplateList()
Destructor.
Definition: TemplateList.cpp:71
Isis::TemplateList::TemplateList
TemplateList(QString name, QString type, QString path, QObject *parent=NULL)
Create a template from a file name, type, and path.
Definition: TemplateList.cpp:26
Isis::TemplateList::XmlHandler::m_templateList
TemplateList * m_templateList
TemplateList to be read or written.
Definition: TemplateList.h:83
Isis::TemplateList::name
QString name() const
Get the human-readable name of this TemplateList.
Definition: TemplateList.cpp:81
Isis::TemplateList::type
QString type() const
Get the type of template in this TemplateList.
Definition: TemplateList.cpp:91
Isis::XmlStackedHandler
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:118
Isis::TemplateList::XmlHandler::XmlHandler
XmlHandler(TemplateList *templateList, Project *project)
Create an XML Handler (reader/writer) that can populate the TemplateList class data.
Definition: TemplateList.cpp:248
Isis::TemplateList::setType
void setType(QString newType)
Set the type of template for of this TemplateList.
Definition: TemplateList.cpp:121
Isis::TemplateList::setPath
void setPath(QString newPath)
Set the relative path (from the project root) to this TemplateList's folder.
Definition: TemplateList.cpp:131
QObject
Isis::TemplateList::XmlHandler::m_project
Project * m_project
Project that contains the template list.
Definition: TemplateList.h:84
Isis::TemplateList::setName
void setName(QString newName)
Set the human-readable name of this TemplateList.
Definition: TemplateList.cpp:111
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16