Isis 3 Programmer Reference
Isis::Template Class Reference

#include <Template.h>

Inheritance diagram for Isis::Template:
Inheritance graph
Collaboration diagram for Isis::Template:
Collaboration graph

Classes

class  XmlHandler
 

Public Slots

void updateFileName (Project *project)
 Change the file name for this template to be where it now is with the given project.
 

Public Member Functions

 Template (QString fileName, QString templateType, QString importName, QObject *parent=0)
 Create a Template from template file's name.
 
 Template (FileName templateFolder, XmlStackedHandlerReader *xmlReader, QObject *parent=0)
 Construct this template from XML.
 
 ~Template ()
 Destroys Template object.
 
QString importName () const
 Get the name of the TemplateList this file was imported under.
 
QString fileName () const
 Get the file name that this Template represents.
 
QString templateType () const
 Get the type of template.
 
void deleteFromDisk ()
 Delete the template from disk.
 
void save (QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
 Method to write this Template object's member data to an XML stream.
 

Private Attributes

QString m_fileName
 
QString m_templateType
 
QString m_importName
 

Detailed Description

Author
2017-11-01 Christopher Combs
History
2017-11-01 Christopher Combs - This represents an ISIS template in a project-based GUI interface. This encapsulates ideas about a template such as it's filename and import name.

Definition at line 30 of file Template.h.

Constructor & Destructor Documentation

◆ Template() [1/2]

Isis::Template::Template ( QString fileName,
QString templateType,
QString importName,
QObject * parent = 0 )
explicit

Create a Template from template file's name.

Parameters
fileNameThe name of the template file on disk
templateTypeThe type of template being imported (Options are maps or registrations)
importNameThe name of the TemplateList this Template is imported in
parentThe Qt-relationship parent

Definition at line 19 of file Template.cpp.

References fileName(), importName(), and templateType().

◆ Template() [2/2]

Isis::Template::Template ( FileName templateFolder,
XmlStackedHandlerReader * xmlReader,
QObject * parent = 0 )

Construct this template from XML.

Parameters
templateFolderLocation of template xml
xmlReaderAn XML reader that's up to an <template> tag.
parentThe Qt-relationship parent

Definition at line 33 of file Template.cpp.

◆ ~Template()

Isis::Template::~Template ( )

Destroys Template object.

Definition at line 42 of file Template.cpp.

Member Function Documentation

◆ deleteFromDisk()

void Isis::Template::deleteFromDisk ( )

Delete the template from disk.

Exceptions
IException::Io"Could not remove file."

Definition at line 88 of file Template.cpp.

References Isis::IException::Io.

◆ fileName()

QString Isis::Template::fileName ( ) const

Get the file name that this Template represents.

Returns
QString A string containing the path to the template file associated.

Definition at line 50 of file Template.cpp.

Referenced by Isis::TemplateEditViewWorkOrder::setupExecution(), Isis::Template::XmlHandler::startElement(), and Template().

◆ importName()

QString Isis::Template::importName ( ) const

Get the name of the TemplateList this file was imported under.

Returns
QString A string containing TemplateList's name.

Definition at line 68 of file Template.cpp.

Referenced by Isis::Template::XmlHandler::startElement(), and Template().

◆ save()

void Isis::Template::save ( QXmlStreamWriter & stream,
const Project * project,
FileName newProjectRoot ) const

Method to write this Template object's member data to an XML stream.

Parameters
streamThe stream to which the Template will be saved.
projectThe Project to which this Template will be added.
newProjectRootThe location of the project root directory.

Definition at line 105 of file Template.cpp.

◆ templateType()

QString Isis::Template::templateType ( ) const

Get the type of template.

Returns
QString The name of the directory to find this file under "templates".

Definition at line 59 of file Template.cpp.

Referenced by Isis::Template::XmlHandler::startElement(), and Template().

◆ updateFileName

void Isis::Template::updateFileName ( Project * project)
slot

Change the file name for this template to be where it now is with the given project.

Parameters
projectThe project that this file is stored in.

Definition at line 78 of file Template.cpp.

References Isis::FileName::name(), and Isis::Project::templateRoot().

Member Data Documentation

◆ m_fileName

QString Isis::Template::m_fileName
private

Definition at line 73 of file Template.h.

◆ m_importName

QString Isis::Template::m_importName
private

Definition at line 75 of file Template.h.

◆ m_templateType

QString Isis::Template::m_templateType
private

Definition at line 74 of file Template.h.


The documentation for this class was generated from the following files: