USGS

Isis 3.0 Application Source Code Reference

Home

WriteTabular.h

Go to the documentation of this file.
00001 #ifndef NewClass_h
00002 #define NewClass_h
00003 /**
00004  * @file
00005  * $Revision: 1.1 $
00006  * $Date: 2007/08/09 18:24:24 $
00007  *
00008  *   Unless noted otherwise, the portions of Isis written by the USGS are public
00009  *   domain. See individual third-party library and package descriptions for
00010  *   intellectual property information,user agreements, and related information.
00011  *
00012  *   Although Isis has been used by the USGS, no warranty, expressed or implied,
00013  *   is made by the USGS as to the accuracy and functioning of such software
00014  *   and related material nor shall the fact of distribution constitute any such
00015  *   warranty, and no responsibility is assumed by the USGS in connection
00016  *   therewith.
00017  *
00018  *   For additional information, launch
00019  *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html in a browser or see
00020  *   the Privacy & Disclaimers page on the Isis website,
00021  *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
00022  *   http://www.usgs.gov/privacy.html.
00023  */
00024 
00025 #include <ostream>
00026 
00027 #include "Column.h"
00028 
00029 namespace Isis {
00030   /**
00031    * @brief Format ascii tables
00032    *
00033    * This class takes in a series of string vectors and writes them out to a
00034    * file as a table. Formatting options are up to the user.
00035    *
00036    * @ingroup Utility
00037    *
00038    * @author 2007-05-01 Brendan George
00039    *
00040    * @internal
00041    */
00042   class WriteTabular {
00043     public:
00044       // Constructor and Destructor
00045       WriteTabular(std::ostream &strm, std::vector <Column> cols);
00046       WriteTabular(std::ostream &strm);
00047 
00048       void SetColumns(std::vector <Column> cols);
00049       void Write();
00050       void Write(int item);
00051       void Write(const char *item);
00052       void Write(double item);
00053       void SetDelimiter(QString delim);
00054 
00055       int Columns() {
00056         return p_cols.size();
00057       };
00058       int Rows() {
00059         return p_rows;
00060       };
00061 
00062     private:
00063       QString p_delimiter;
00064       std::ostream &p_outfile;
00065       unsigned int p_rows;
00066       std::vector <Column> p_cols;
00067       unsigned int p_curCol;
00068 
00069   };
00070 }
00071 #endif