isis/src/base/apps/isisminer/PdsTableFormatStrategy.cpp
int PdsTableFormatStrategy::apply(ResourceList &resources, 
                                    const ResourceList &globals) {
  
    QString fmtfile = translateKeywordArgs("PdsFormatFile", 
                                           getGlobals(m_parameters, globals));

    QString keyfmt = translateKeywordArgs("KeywordFormatFile", 
                                          getGlobals(m_parameters, globals),
                                          "$ISISROOT/appdata/translations/pdsExportRootGen.typ");


    // Remake new columns each time
    m_columns.clear();
    makeColumns(m_parameters);
  
    int pos = 1;
    QString separator("");

    Pvl fmtpvl;
    // Apply only if provided
    if ( !keyfmt.isEmpty() ) {
      fmtpvl.setFormat(new PvlFormatPds(keyfmt)); 
    }
    fmtpvl.setTerminator("END");

    for (int c = 0 ; c < m_columns.size() ; c++) {
      PdsColumn *column = PdsColumn::promote(m_columns[c]);
    
      // Get the size of the column
      int datalen = column->bytes();
      if ( 0 <= datalen ) {
        datalen = column->bytes(resources); 
        column->setBytes(datalen);
      }
  
      // Determine formatted data size
      int nquotes = column->isQuoted();
      pos += (separator.size() + nquotes);
      column->setStartByte(pos);
  
      // Update for size
      pos += (datalen + nquotes);
      separator = m_delimiter;
  
      fmtpvl.addObject(column->toPvl());
    }
  
    // Now write the Pvl column file
    fmtpvl.write(fmtfile);
  
    return (resources.size());
  }
/**
   * @brief Creates columns according to the byte size of the 
   *        resources and saves that data to a PDS table format
   *        file.
   *
   * Creates columns according to the byte size of the resources 
   * and saves the format to the PDS table format file. Column 
   * entries are delimited by the delimiter. 
   *
   * @author 2012-07-15 Kris Becker
   *
   * @param resources The list of Resources that determine column 
   *                  size.
   * @param globals   List of global keywords to use in argument substitutions
   *  
   * @return int The size of the Resources written to the PDS 
   *         table 
   */
@brief Creates columns according to the byte size of the
resources and saves that data to a PDS table format
file.

Creates columns according to the byte size of the resources
and saves the format to the PDS table format file. Column
entries are delimited by the delimiter.



@param resources The list of Resources that determine column
size.
@param globals   List of global keywords to use in argument substitutions

@return int The size of the Resources written to the PDS
table
@brief Creates columns according to the byte size of the resources and saves that data to a PDS table format file . Creates columns according to the byte size of the resources and saves the format to the PDS table format file . Column entries are delimited by the delimiter . @param resources The list of Resources that determine column size . @param globals List of global keywords to use in argument substitutions @return int The size of the Resources written to the PDS table
int PdsTableFormatStrategy::apply(ResourceList &resources, 
                                    const ResourceList &globals) {
    QString fmtfile = translateKeywordArgs("PdsFormatFile", 
                                           getGlobals(m_parameters, globals));
    QString keyfmt = translateKeywordArgs("KeywordFormatFile", 
                                          getGlobals(m_parameters, globals),
                                          "$ISISROOT/appdata/translations/pdsExportRootGen.typ");
    m_columns.clear();
    makeColumns(m_parameters);
    int pos = 1;
    QString separator("");
    Pvl fmtpvl;
    if ( !keyfmt.isEmpty() ) {
      fmtpvl.setFormat(new PvlFormatPds(keyfmt)); 
    }
    fmtpvl.setTerminator("END");
    for (int c = 0 ; c < m_columns.size() ; c++) {
      PdsColumn *column = PdsColumn::promote(m_columns[c]);
      int datalen = column->bytes();
      if ( 0 <= datalen ) {
        datalen = column->bytes(resources); 
        column->setBytes(datalen);
      }
      int nquotes = column->isQuoted();
      pos += (separator.size() + nquotes);
      column->setStartByte(pos);
      pos += (datalen + nquotes);
      separator = m_delimiter;
      fmtpvl.addObject(column->toPvl());
    }
    fmtpvl.write(fmtfile);
    return (resources.size());
  }
int PdsTableFormatStrategy :: apply ( ResourceList & resources , const ResourceList & globals ) { QString fmtfile = translateKeywordArgs ( " " , getGlobals ( m_parameters , globals ) ) ; QString keyfmt = translateKeywordArgs ( " " , getGlobals ( m_parameters , globals ) , " " ) ; m_columns . clear ( ) ; makeColumns ( m_parameters ) ; int pos = 1 ; QString separator ( " " ) ; Pvl fmtpvl ; if ( ! keyfmt . isEmpty ( ) ) { fmtpvl . setFormat ( new PvlFormatPds ( keyfmt ) ) ; } fmtpvl . setTerminator ( " " ) ; for ( int c = 0 ; c < m_columns . size ( ) ; c ++ ) { PdsColumn * column = PdsColumn :: promote ( m_columns [ c ] ) ; int datalen = column -> bytes ( ) ; if ( 0 <= datalen ) { datalen = column -> bytes ( resources ) ; column -> setBytes ( datalen ) ; } int nquotes = column -> isQuoted ( ) ; pos += ( separator . size ( ) + nquotes ) ; column -> setStartByte ( pos ) ; pos += ( datalen + nquotes ) ; separator = m_delimiter ; fmtpvl . addObject ( column -> toPvl ( ) ) ; } fmtpvl . write ( fmtfile ) ; return ( resources . size ( ) ) ; }
@brief Creates columns according to the byte size of the
        resources and saves that data to a PDS table format
        file.
@brief Creates columns according to the byte size of the resources and saves that data to a PDS table format file .
// Remake new columns each time // Apply only if provided // Get the size of the column // Determine formatted data size // Update for size // Now write the Pvl column file