[Qgis-developer] 8. Re: allowing comments in delimited text layer plugin?

Christian Gunning icos.atropa at gmail.com
Sun Apr 5 21:43:11 EDT 2009


Does anyone have any thoughts on the relative merits of skipping the
first n lines, versus skipping all lines that start with "x"?

>In Excel and openoffice, comments are
> handled by specifying the line number to start at.  In R, a comment
> character can be specified, defaulting to #.

If I understand correctly, the work would happen here, by passing in
either n or x, and skipping the appropriate lines:
( https://svn.osgeo.org/qgis/trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp
)

QString QgsDelimitedTextPluginGui::readLine( QTextStream & stream )
{
  QString buffer( "" );
  QString c;

  // Strip leading newlines

  c = stream.read( 1 );
  if ( c == NULL || c.size() == 0 )
  {
    // Reach end of file
    return buffer;
  }
  while ( c == ( char * )"\r" || c == ( char * )"\n" )
  {
    c = stream.read( 1 );
    if ( c == NULL || c.size() == 0 )
    {
      // Reach end of file
      return buffer;
    }
  }

-christian


More information about the Qgis-developer mailing list