Isis 3 Programmer Reference
Isis::Column Class Reference

Format ascii tables. More...

#include <Column.h>

Collaboration diagram for Isis::Column:
Collaboration graph

Public Types

enum  Align { NoAlign = 0, Right = 1, Left = 2, Decimal = 3 }
 Alignment of data in the Column. More...
 
enum  Type {
  NoType = 0, Integer = 1, Real = 2, String = 3,
  Pixel = 4
}
 Type of data in the Column. More...
 

Public Member Functions

 Column ()
 Constructor. More...
 
 Column (QString name, int width, Column::Type type, Column::Align align=Right)
 Constructor with parameter. More...
 
void SetName (QString name)
 Sets the Column name, or header. More...
 
void SetWidth (unsigned int width)
 Sets the width of the Column, in text columns. More...
 
void SetType (Column::Type type)
 Sets the data type of the Column. More...
 
void SetAlignment (Column::Align alignment)
 Sets the alignment of the Column. More...
 
void SetPrecision (unsigned int precision)
 Sets the precision of the Column, for real number values. More...
 
QString Name () const
 Get the Column's name. More...
 
unsigned int Width () const
 Get the Column's width. More...
 
Column::Type DataType () const
 Returns the type of data this column will contain. More...
 
Column::Align Alignment () const
 Get the Column's alignment. More...
 
unsigned int Precision () const
 Get the Column's precision. More...
 

Private Attributes

QString p_name
 Name of the Column. More...
 
unsigned int p_width
 Width of the Column. More...
 
Column::Type p_type
 Type of the data in the Column. More...
 
Column::Align p_align
 Alignment of the data in the Column. More...
 
unsigned int p_precision
 Precision of the data in the Column. More...
 

Detailed Description

Format ascii tables.

This class takes in a series of string vectors and writes them out to a file as a table. Formatting options are up to the user. This was developed for cubediff's table output option, and is being utilized by the WriteTabular class (which currently resides in the cubediff folder).

Author
2007-05-01 Brendan George
History:

2007-06-18 Brendan George Fixed error message outputs and unitTest

2009-10-14 Eric Hyer Added documentation; Moved from base/apps/cubediff to base/objs;

2012-09-20 Steven Lambright - Improved unit test, fixed bug where uninitialized member variables were causing errors to be thrown sometimes. Fixes #1125.

2017-08-30 Summer Stapleton - Updated documentation. References #4807.

Definition at line 54 of file Column.h.

Member Enumeration Documentation

◆ Align

Alignment of data in the Column.

Enumerator
NoAlign 

no alignment

Right 

right alignment

Left 

left alignment

Decimal 

decimal alignment

Definition at line 60 of file Column.h.

◆ Type

Type of data in the Column.

Enumerator
Integer 

No data type.

Real 

Integer data type.

String 

Real data type.

Pixel 

String data type.

Definition at line 70 of file Column.h.

Constructor & Destructor Documentation

◆ Column() [1/2]

Isis::Column::Column ( )

Constructor.

Sets the precision for decimal-aligned columns to 4

Definition at line 35 of file Column.cpp.

References NoAlign, p_align, p_name, p_precision, p_type, and p_width.

◆ Column() [2/2]

Isis::Column::Column ( QString  name,
int  width,
Column::Type  type,
Column::Align  align = Right 
)

Constructor with parameter.

Parameters
nameThe name of the column, used as the header
widthThe width (in characters) to make the column
typeThe type of information the column is to represent
alignThe alignment, within the column, the data is to conform to

Definition at line 51 of file Column.cpp.

References NoAlign, p_align, p_name, p_precision, p_type, p_width, SetAlignment(), SetName(), SetType(), and SetWidth().

Member Function Documentation

◆ Alignment()

Column::Align Isis::Column::Alignment ( ) const

Get the Column's alignment.

Returns
The column's alignment

Definition at line 177 of file Column.cpp.

References p_align.

◆ DataType()

Column::Type Isis::Column::DataType ( ) const

Returns the type of data this column will contain.

Returns
Column::Type The data type of this column

Definition at line 167 of file Column.cpp.

References p_type.

Referenced by SetPrecision().

◆ Name()

QString Isis::Column::Name ( ) const

Get the Column's name.

Returns
The column's name

Definition at line 148 of file Column.cpp.

References p_name.

◆ Precision()

unsigned int Isis::Column::Precision ( ) const

Get the Column's precision.

Returns
The column's presicion

Definition at line 187 of file Column.cpp.

References p_precision.

◆ SetAlignment()

void Isis::Column::SetAlignment ( Column::Align  alignment)

Sets the alignment of the Column.

The text in the Column will be aligned according to this parameter, which is Right, Left, or, possible only with real-number values, aligned by the decimal point

Parameters
alignmentThe alignment of the text in the Column

Definition at line 116 of file Column.cpp.

References _FILEINFO_, Decimal, Integer, p_align, p_type, Isis::IException::Programmer, and String.

Referenced by Column().

◆ SetName()

void Isis::Column::SetName ( QString  name)

Sets the Column name, or header.

Parameters
nameThe name of the Column

Definition at line 70 of file Column.cpp.

References _FILEINFO_, p_name, p_width, and Isis::IException::User.

Referenced by Column().

◆ SetPrecision()

void Isis::Column::SetPrecision ( unsigned int  precision)

Sets the precision of the Column, for real number values.

This sets the number of digits after the decimal point, for decimal aligned values. If the Column's alignment is anything else, an error is thrown.

Parameters
precisionThe number of digits after the decimal point to be shown

Definition at line 134 of file Column.cpp.

References _FILEINFO_, DataType(), p_precision, Pixel, Real, and Isis::IException::User.

◆ SetType()

void Isis::Column::SetType ( Column::Type  type)

Sets the data type of the Column.

Parameters
typeThe data type for the Column

Definition at line 97 of file Column.cpp.

References _FILEINFO_, Decimal, Integer, p_align, p_type, String, and Isis::IException::User.

Referenced by Column().

◆ SetWidth()

void Isis::Column::SetWidth ( unsigned int  width)

Sets the width of the Column, in text columns.

Parameters
widthThe number of text columns the Column will hold

Definition at line 83 of file Column.cpp.

References _FILEINFO_, p_name, p_width, and Isis::IException::User.

Referenced by Column().

◆ Width()

unsigned int Isis::Column::Width ( ) const

Get the Column's width.

Returns
The column's width

Definition at line 157 of file Column.cpp.

References p_width.

Member Data Documentation

◆ p_align

Column::Align Isis::Column::p_align
private

Alignment of the data in the Column.

Definition at line 104 of file Column.h.

Referenced by Alignment(), Column(), SetAlignment(), and SetType().

◆ p_name

QString Isis::Column::p_name
private

Name of the Column.

Definition at line 95 of file Column.h.

Referenced by Column(), Name(), SetName(), and SetWidth().

◆ p_precision

unsigned int Isis::Column::p_precision
private

Precision of the data in the Column.

Definition at line 107 of file Column.h.

Referenced by Column(), Precision(), and SetPrecision().

◆ p_type

Column::Type Isis::Column::p_type
private

Type of the data in the Column.

Definition at line 101 of file Column.h.

Referenced by Column(), DataType(), SetAlignment(), and SetType().

◆ p_width

unsigned int Isis::Column::p_width
private

Width of the Column.

Definition at line 98 of file Column.h.

Referenced by Column(), SetName(), SetWidth(), and Width().


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