USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::FileName Class Reference
[Parsing]

File name manipulation and expansion. More...

#include <FileName.h>

Collaboration diagram for Isis::FileName:
Collaboration graph
[legend]

List of all members.

Classes

class  Data
 This is the reference-counted data for FileName. More...

Public Member Functions

 FileName ()
 Constructs an empty FileName object.
 FileName (const char *fileName)
 FileName (const QString &fileName)
 FileName (const FileName &other)
 ~FileName ()
 Destroys the FileName object.
QString originalPath () const
QString path () const
 Returns the path.
QString attributes () const
QString baseName () const
QString name () const
QString extension () const
QString expanded () const
QString original () const
FileName addExtension (const QString &extension) const
FileName removeExtension () const
FileName setExtension (const QString &extension) const
bool isVersioned () const
bool isNumericallyVersioned () const
bool isDateVersioned () const
FileName highestVersion () const
FileName newVersion () const
FileName version (long versionNumber) const
FileName version (QDate versionDate) const
bool fileExists () const
QDir dir () const
QString toString () const
FileNameoperator= (const FileName &rhs)
 Clears the current contents of the FileName object and reinitializes it with the argument.
bool operator== (const FileName &rhs)
bool operator!= (const FileName &rhs)

Static Public Member Functions

static FileName createTempFile (FileName templateFileName="$TEMPORARY/temp")

Private Member Functions

QDate highestVersionDate () const
long highestVersionNum () const
void validateVersioningState () const
 This verifies the class invariant when using versioning - that the FileName is in an acceptable state to find file version numbers.
QString fileNameQDatePattern () const
QPair< QString, QString > splitNameAroundVersionNum () const

Private Attributes

QSharedDataPointer< Datam_d

Detailed Description

File name manipulation and expansion.

This class is used for manipulating filenames. It allows access to the path, extension, base name and Isis attributes. A standard Isis filename takes the form of

 /path/base.extension:attribute

For example:

 /work1/mars.cub:5
Author:
2002-06-11 Jeff Anderson

For internal use only.

Todo:
This class needs an example.
History:
2002-11-27 Stuart Sides - added capability to expand environment variables within a filename.
History:
2003-01-27 Jeff Anderson - added a method to allow full file specification to be extracted (includes the attributes).
History:
2002-02-12 Stuart Sides - fixed bug with incorrect parsing when filename did not have a path.
History:
2003-05-16 Stuart Sides - modified schema from astrogeology...isis.astrogeology.
History:
2003-07-21 Stuart Sides - modified to use "+" as the attribute delimiter instead of a ":".
History:
2003-10-17 ?????? - Added default constructor, operator "=" and temporary members.
History:
2003-10-30 ?????? - Added new members: HighestVersion and Exists.
History:
2003-12-03 ?????? - Added capability to expand Preferences in the DataDirectory group only.
History:
2004-01-14 ?????? - Added new member OriginalPath.
History:
2004-01-22 ?????? - Added new member Name. Name returns the filename only without any path, extension or attributes.
History:
2004-01-27 ?????? - Tool all references to attributes out. IsisFileName now ignores all cube attributes.
History:
2004-01-27 ?????? - Removed the member FullSpecification, because FullSpecification without the cube attributes now does the same thing as FileName.
History:
2004-01-27 ?????? - Added a new constructor with two parameters. This new constructor will create a temporary filename using the path from the Preference DataDirectory/Temporary the filename from argument one appended with a number from 100000 to 199999 and the extension of argument two.
History:
2004-05-17 ?????? - Added new member MakeDirectory.
History:
2005-07-28 Drew Davidson - added new member NewVersion.
History:
2007-10-03 Steven Koechle - Fixed Temporary() so if a path was specified it will have the cwd put on in front of it.
History:
2009-01-07 Steven Lambright - expanded() no longer behaves differently for unit tests
History:
2011-08-19 Jeannie Backer - Modified unitTest to use $temporary variable instead of /tmp directory. Added some documentation to methods.
History:
2011-08-24 Steven Lambright and Tracie Sucharski - Uses QString instead of QString for simplicity when used with our GUI applications. Removed extra includes and cleaned up code a little.
History:
2012-04-14 Steven Lambright - Renamed FileName to FileName. No longer inherits QFileInfo, paired down functionality to file name related functionality. Fixed temporary file naming to guarantee unique, unpredictable (safe) names.
History:
2012-06-04 Steven Lambright and Stuart Sides - Added operator!= and improved unit test to include tests of operator== and operator!=. Fixes #903.

Definition at line 109 of file FileName.h.


Constructor & Destructor Documentation

Isis::FileName::FileName (  ) 

Constructs an empty FileName object.

Definition at line 44 of file FileName.cpp.

References m_d.

Referenced by validateVersioningState().

Isis::FileName::~FileName (  ) 

Destroys the FileName object.

Definition at line 66 of file FileName.cpp.


Member Function Documentation

FileName & Isis::FileName::operator= ( const FileName rhs  ) 

Clears the current contents of the FileName object and reinitializes it with the argument.

Parameters:
file File name to replace the current contents of the object.

Definition at line 340 of file FileName.cpp.

References m_d.

QString Isis::FileName::path (  )  const

Returns the path.

Returns:
the path portion of a filename. For *nix operating systems this includes everything upto but not including the last slash "/". For file names created without any slashes the current working directory will be returned.
   for a full file specification of:
   "/home/me/img/picture.jpg"
   path() gives:
   "/home/me/img"
 

Definition at line 88 of file FileName.cpp.

Referenced by Isis::ProcessPolygons::AppendOutputCube(), Isis::ImportPdsTable::load(), Isis::Cube::open(), Isis::ProcessImportPds::ProcessDataFilePointer(), Isis::ProcessPolygons::SetOutputCube(), Isis::ProcessGroundPolygons::SetOutputCube(), Isis::ProcessImportPds::SetPdsFile(), Isis::MeasureTool::updateDist(), and Isis::AdvancedTrackTool::updateRow().

void Isis::FileName::validateVersioningState (  )  const [private]

This verifies the class invariant when using versioning - that the FileName is in an acceptable state to find file version numbers.

Definition at line 471 of file FileName.cpp.

References _FILEINFO_, FileName(), and Isis::IException::Unknown.


Member Data Documentation

QSharedDataPointer<Data> Isis::FileName::m_d [private]
See also:
QSharedDataPointer

Definition at line 191 of file FileName.h.

Referenced by FileName(), and operator=().


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