Isis 3 Programmer Reference
|
Formats a Pvl name value pair to Isis standards. More...
#include <PvlFormat.h>
Public Member Functions | |
PvlFormat (const QString &file) | |
PvlFormat (Pvl &keymap) | |
void | add (const QString &file) |
void | add (Pvl &keymap) |
void | setCharLimit (const unsigned int limit) |
Sets the maximum number of characters in a keyword value that can be printed to a line before it wraps to the next line. More... | |
unsigned int | charLimit () const |
Retrieves the maximum number of characters in a keyword value that can be printed to a line before it wraps to the next line. More... | |
virtual QString | formatValue (const PvlKeyword &keyword, int valueIndex=0) |
virtual QString | formatName (const PvlKeyword &keyword) |
virtual QString | formatEnd (const QString name, const PvlKeyword &keyword) |
virtual QString | formatEOL () |
virtual KeywordType | type (const PvlKeyword &keyword) |
virtual int | accuracy (const PvlKeyword &keyword) |
Protected Member Functions | |
virtual QString | addQuotes (const QString value) |
bool | isSingleUnit (const PvlKeyword &keyword) |
Returns true if the units are the same for all value in the keyword otherwise it returns false. More... | |
Protected Attributes | |
QString | m_keywordMapFile |
Pvl | m_keywordMap |
unsigned int | m_charLimit |
Maximum number of characters on a single line of a keyword value. More... | |
Private Member Functions | |
void | init () |
Clears all PvlFormat data. More... | |
Formats a Pvl name value pair to Isis standards.
This class is used to format a single PVL keyword-value pair using normal Isis formatting. The class serves as a base class for others to override and implement their own formatting.
This class uses a Pvl or Pvl formatted file to populate its internal data structure. This structure is used to lookup the type of a keyword and/or other information for another Pvl{Object|Group|Keyword}. The format of the file or Pvl is:
Example:
Where NAME is the name of a keyword in the Pvl to be formatted. TYPE is the type of keyword (STRING,BOOL,INTEGER,REAL,OCTAL,HEX,BINARY,ENUM) (see ToKeywordType). PLACES is the number of digits to the right of the decimal place for a keyword of TYPE REAL.
NOTE: The capabilities to use this Pvl are not implemented in this base class. They are provided as a convience for child classes only. This class only implements the normal Isis foramatting, which is not dependent on the type of the keyword. It is dependent on value of the keyword.
2006-09-05 Stuart Sides - Original version
2008-09-30 Christopher Austin - added FormatEOL()
2009-12-17 Steven Lambright - {} are now treated the same as ()
2010-02-04 Travis Addair - Added SetCharLimit method allowing users to set the point at which a keyword value is output to the next line down.
2010-12-09 Steven Lambright - Values ending in '-' no longer fail to be quoted properly
2013-03-11 Steven Lambright and Mathew Eis - Brought method names and member variable names up to the current Isis 3 coding standards. Fixes #1533.
2013-06-03 Tracie Sucharski and Jeannie Backer - Fixed the addQuotes method to better handle multi-dimensional arrays vs equations with multiple sets of parens. Fixes #569.
Definition at line 124 of file PvlFormat.h.
|
inline |
Retrieves the maximum number of characters in a keyword value that can be printed to a line before it wraps to the next line.
By default, the limit is set to 80 characters.
Definition at line 154 of file PvlFormat.h.
References m_charLimit.
Referenced by Isis::PvlKeyword::writeWithWrap().
|
private |
Clears all PvlFormat data.
Definition at line 72 of file PvlFormat.cpp.
|
protected |
Returns true if the units are the same for all value in the keyword otherwise it returns false.
keyword | The PvlKeyword to be formatted |
Definition at line 323 of file PvlFormat.cpp.
References Isis::PvlKeyword::size(), Isis::PvlKeyword::stringEqual(), and Isis::PvlKeyword::unit().
|
inline |
Sets the maximum number of characters in a keyword value that can be printed to a line before it wraps to the next line.
By default, the limit is set to 80 characters.
limit | The new character limit. |
Definition at line 143 of file PvlFormat.h.
References m_charLimit.
|
protected |
Maximum number of characters on a single line of a keyword value.
Definition at line 179 of file PvlFormat.h.
Referenced by charLimit(), and setCharLimit().