An official website of the United States government
Here’s how you know
Official websites use .gov
A
.gov website belongs to an official government
organization in the United States.
Secure .gov websites use HTTPS
A
lock
( ) or https:// means you’ve safely connected to
the .gov website. Share sensitive information only on official,
secure websites.
Isis Developer Reference
|
Extends TextFile to handle Cassini ISS calibration files. More...
#include <CisscalFile.h>
Public Member Functions | |
CisscalFile (const QString &filename, const char *openmode="input", const char *extension="") | |
Constructs a CisscalFile object and opens the specified file (including path). | |
~CisscalFile () | |
bool | GetLine (QString &line) |
Get next line of valid data. | |
void | Open (const QString &filename, const char *openmode="input", const char *extension="") |
Opens a text file. | |
void | Open (const char *filename, const char *openmode="input", const char *extension="") |
bool | OpenChk (bool bailIfNotOpen=false) |
void | Rewind () |
Sets Read / Write pointer to begining of opened file. | |
void | Close () |
Closes file. Called automatically by TextFile destructor. | |
void | GetFile (std::vector< QString > &lines, const int &maxLinesToRead=0, const bool skipComments=true) |
void | GetFile (QString *lines, const int &maxLinesToRead, const bool skipComments=true) |
void | PutFile (std::vector< QString > &lines, const int &maxLinesToWrite=0) |
void | PutFile (const QString *lines, const int &maxLinesToWrite) |
bool | GetLine (QString &line, const bool skipComments=true) |
Gets next line from file. | |
bool | GetLine (const bool skipComments=true) |
Gets next line from file. | |
bool | GetLineNoFilter (QString &line) |
Gets next NON-COMMENT line from file. | |
bool | GetLineNoFilter () |
Gets next NON-COMMENT line from file. | |
void | PutLine (const QString &line) |
Writes string to file and appends a 'newline' string. | |
void | PutLine (const char *line="") |
Writes char string to file and appends a 'newline' string. | |
void | PutLineComment (const QString &line) |
Writes string to file, prepends a 'comment' string and appends a 'newline' string. | |
void | PutLineComment (const char *line="") |
Writes char string to file, prepends a 'comment' string and appends a 'newline' string. | |
QString | GetComment () |
QString | GetNewLine () |
void | SetComment (const char *commentString="#") |
Sets the 'comment' string. | |
void | SetNewLine (const char *newLineString="\n") |
Sets the 'newline' string. | |
int | LineCount (const int &maxLinesToRead=0) |
Counts number of lines in file. | |
std::streamsize | Size () |
Counts number of bytes in file. | |
Protected Member Functions | |
bool | p_GetLine (QString &line) |
Get next line of valid data, protected. | |
bool | p_GetLine (QString &line, bool chkComment) |
Gets next line from file. | |
Protected Attributes | |
bool | p_begindataFound |
std::fstream | p_stream |
File stream handle. | |
int | p_openmode |
openmode of file: Input, Output, Overwrite, Append | |
QString | p_filename |
FileName of the opened file. | |
QString | p_commentString |
'comment' string used by GetLine and PutLineComment | |
QString | p_newLineString |
'newline' string used by PutLine and PutLineComment | |
Extends TextFile to handle Cassini ISS calibration files.
This class was created as an extension of TextFile to be able to read in Cassini ISS calibration files used by the Isis ciss2isis and cisscal applications. It is able to read PDS style text files and skip all header info that exists before the tag "\begindata"
.
Isis::CisscalFile::CisscalFile | ( | const QString & | filename, |
const char * | openmode = "input", | ||
const char * | extension = "" ) |
Constructs a CisscalFile object and opens the specified file (including path).
filename | FileName (including path) to be opened by TextFile object. |
openmode | Open Mode of file opened by TextFile object.
"input" . |
extension | Extension to be added to filename (added only if not already on filename). Defaults to "" |
References p_begindataFound, and Isis::TextFile::TextFile().
|
inline |
Destructor closes the text file.
References Isis::TextFile::Close().
|
inherited |
Closes file. Called automatically by TextFile destructor.
References p_stream.
Referenced by Isis::CisscalFile::~CisscalFile(), and ~TextFile().
|
inherited |
References p_commentString.
|
inherited |
|
inherited |
References GetLine(), and OpenChk().
Referenced by TextFile(), and TextFile().
bool Isis::CisscalFile::GetLine | ( | QString & | line | ) |
Get next line of valid data.
This protected method overrides the base class method from TextFile of the same name. It finds the next line of valid data. If the "\begindata"
tag has not been already found, it searches for that tag. Once found, every line beyond that is considered data and the method will retrieve the next line. Returns True if read a line, False if End Of File.
line | String to be rewritten with contents of the next line read from file |
Isis::iException::Io | "Error reading text file" |
References p_GetLine().
|
inherited |
Gets next line from file.
Returns True if read a line, False if End Of File.
skipComments | Controls whether comments lines are filtered; true=filter, false=return any line read from fileDefaults to true |
References p_GetLine().
|
inherited |
Gets next line from file.
Returns True if read a line, False if End Of File.
line | Line read from file, with newline removed. |
skipComments | Controls whether comments lines are filtered; true=filter, false=return any line read from fileDefaults to true |
References p_GetLine().
Referenced by Isis::Environment::aleVersion(), GetFile(), GetFile(), Isis::Environment::isisVersion(), Isis::MosaicMainWindow::MosaicMainWindow(), Isis::MosaicMainWindow::openList(), Isis::ImportImagesWorkOrder::setupExecution(), and Isis::ImportShapesWorkOrder::setupExecution().
|
inherited |
Gets next NON-COMMENT line from file.
Returns True if read a line, False if End Of File. See SetComment method.
References p_GetLine().
|
inherited |
Gets next NON-COMMENT line from file.
Returns True if read a line, False if End Of File. See SetComment method.
line | Line read from file, with newline removed. |
References p_GetLine().
|
inherited |
References p_newLineString.
|
inherited |
|
inherited |
|
inherited |
Opens a text file.
filename | FileName (including path) to be opened. |
openmode | Open Mode of file to be opened. There are four options, "input", "output", "overwrite", and "append". "input" opens with in fstream option, "output" opens with in, out, and trunc fstream options and verifies the file does not exist, "overwrite" opens with in, out, and trunc fstream options, and "append" opens with in, out, and ate(at end) fstream options, "append" will open with in and out options if the file does not exist. |
extension | Extension to be added to filename (added only if not already on filename). Defaults to "" |
Isis::IException::Programmer | |
Isis::IException::Io | - output file already exists |
Isis::IException::Io | - unable to open file |
References _FILEINFO_, Isis::FileName::addExtension(), Isis::IString::DownCase(), Isis::FileName::expanded(), Isis::FileName::fileExists(), Isis::IException::Io, p_filename, p_openmode, p_stream, Isis::IException::Programmer, and Isis::FileName::toString().
Referenced by TextFile(), TextFile(), and TextFile().
|
inherited |
References _FILEINFO_, p_filename, p_stream, and Isis::IException::Programmer.
Referenced by GetFile(), GetFile(), LineCount(), Isis::CisscalFile::p_GetLine(), p_GetLine(), PutFile(), PutFile(), PutLine(), Rewind(), and Size().
|
protected |
Get next line of valid data, protected.
Flag variable indicates whether the tag
"\begindata"
has been found.
This method overwrites TextFile's protected method of the same name. It is called by the public overwritten method GetLine(), as in the parent class.
line | String to be rewritten with contents of the next line read from file |
Isis::iException::Io | "Error reading text file" |
References _FILEINFO_, Isis::IException::Io, Isis::TextFile::OpenChk(), p_begindataFound, Isis::TextFile::p_filename, p_GetLine(), and Isis::TextFile::p_stream.
Referenced by GetLine(), and p_GetLine().
|
protectedinherited |
Gets next line from file.
Returns True if read a line, False if End Of File.
line | Line read from file, with newline removed. |
chkComment | True=Skip Comment Lines, False=Return All Lines. |
Isis::IException::Io | - error reading text file |
References _FILEINFO_, Isis::IException::Io, OpenChk(), p_commentString, p_filename, p_GetLine(), and p_stream.
Referenced by GetLine(), GetLine(), GetLineNoFilter(), GetLineNoFilter(), and p_GetLine().
|
inherited |
|
inherited |
References OpenChk(), and PutLine().
Referenced by TextFile(), and TextFile().
|
inherited |
Writes char string to file and appends a 'newline' string.
See SetNewLine method.
line | Char string to be written to file.Defaults to "" |
Isis::IException::Io | - error writing text to file |
Isis::IException::Programmer | - input is read only text file, cannot write to file |
References _FILEINFO_, Isis::IException::Io, OpenChk(), p_filename, p_newLineString, p_openmode, p_stream, and Isis::IException::Programmer.
|
inherited |
Writes string to file and appends a 'newline' string.
See SetNewLine method.
line | IString to be written to file. Defaults to "" |
References PutLine().
Referenced by PutFile(), PutFile(), PutLine(), PutLineComment(), and PutLineComment().
|
inherited |
Writes char string to file, prepends a 'comment' string and appends a 'newline' string.
See SetComment method and SetNewLine method.
line | Char string to be written to file.Defaults to "" |
References p_commentString, and PutLine().
|
inherited |
Writes string to file, prepends a 'comment' string and appends a 'newline' string.
See SetComment method and SetNewLine method.
line | IString to be written to file.Defaults to "" |
References p_commentString, and PutLine().
|
inherited |
|
inherited |
Sets the 'comment' string.
Default = '#' See ReadFilter method. Skips lines that begin with this string. See PutLineComment method. Prepends 'comment' string to output line.
commentString | The string of characters to be used for 'comment' lines. Defaults to "#" |
References p_commentString.
Referenced by TextFile(), TextFile(), and TextFile().
|
inherited |
Sets the 'newline' string.
Default = '
'. See PutLine and PutLineComment methods. Appends 'newline' string to output line.
newLineString | The string of characters to be used for 'comment' lines. Defaults to "\n" |
References p_newLineString.
Referenced by TextFile(), TextFile(), and TextFile().
|
inherited |
|
protected |
Referenced by CisscalFile(), and p_GetLine().
|
protectedinherited |
'comment' string used by GetLine and PutLineComment
Referenced by GetComment(), p_GetLine(), PutLineComment(), PutLineComment(), and SetComment().
|
protectedinherited |
FileName of the opened file.
Referenced by Open(), OpenChk(), Isis::CisscalFile::p_GetLine(), p_GetLine(), and PutLine().
|
protectedinherited |
'newline' string used by PutLine and PutLineComment
Referenced by GetNewLine(), PutLine(), and SetNewLine().
|
protectedinherited |
openmode of file: Input, Output, Overwrite, Append
Referenced by Open(), PutLine(), TextFile(), and TextFile().
|
protectedinherited |
File stream handle.
Referenced by Close(), LineCount(), Open(), OpenChk(), Isis::CisscalFile::p_GetLine(), p_GetLine(), PutLine(), Rewind(), and Size().