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. More...
 

Public Member Functions

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

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().

Referenced by Isis::TemplateEditorWidget::saveAsText().

◆ 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.

References Isis::XmlStackedHandlerReader::pushContentHandler().

◆ ~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.

Referenced by Isis::TemplateList::deleteFromDisk().

◆ fileName()

QString Isis::Template::fileName ( ) const

◆ 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::ControlPointEditWidget::createPointEditor(), 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.

Referenced by Isis::TemplateList::save(), and Isis::TemplateEditorWidget::saveOption().

◆ 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().


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