labplot  2.8.2
About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.
  Fossies Dox: labplot-2.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

AsciiFilter Class Reference

Manages the import/export of data organized as columns (vectors) from/to an ASCII-file. More...

#include <AsciiFilter.h>

Inheritance diagram for AsciiFilter:
[legend]
Collaboration diagram for AsciiFilter:
[legend]

Public Member Functions

 AsciiFilter ()
 
 ~AsciiFilter () override
 
size_t lineNumber (QIODevice &) const
 
void readDataFromDevice (QIODevice &device, AbstractDataSource *, AbstractFileFilter::ImportMode=AbstractFileFilter::ImportMode::Replace, int lines=-1)
 
void readFromLiveDeviceNotFile (QIODevice &device, AbstractDataSource *dataSource)
 
qint64 readFromLiveDevice (QIODevice &device, AbstractDataSource *, qint64 from=-1)
 
void readDataFromFile (const QString &fileName, AbstractDataSource *=nullptr, AbstractFileFilter::ImportMode=AbstractFileFilter::ImportMode::Replace) override
 
void write (const QString &fileName, AbstractDataSource *) override
 
QVector< QStringList > preview (const QString &fileName, int lines)
 
QVector< QStringList > preview (QIODevice &device)
 
void loadFilterSettings (const QString &) override
 
void saveFilterSettings (const QString &) const override
 
QString separator () const
 
void setCommentCharacter (const QString &)
 
QString commentCharacter () const
 
void setSeparatingCharacter (const QString &)
 
QString separatingCharacter () const
 
void setDateTimeFormat (const QString &)
 
QString dateTimeFormat () const
 
void setNumberFormat (QLocale::Language)
 
QLocale::Language numberFormat () const
 
void setAutoModeEnabled (const bool)
 
bool isAutoModeEnabled () const
 
void setHeaderEnabled (const bool)
 
bool isHeaderEnabled () const
 
void setSkipEmptyParts (const bool)
 
bool skipEmptyParts () const
 
void setSimplifyWhitespacesEnabled (const bool)
 
bool simplifyWhitespacesEnabled () const
 
void setNaNValueToZero (const bool)
 
bool NaNValueToZeroEnabled () const
 
void setRemoveQuotesEnabled (const bool)
 
bool removeQuotesEnabled () const
 
void setCreateIndexEnabled (const bool)
 
bool createIndexEnabled () const
 
void setCreateTimestampEnabled (const bool)
 
bool createTimestampEnabled () const
 
void setVectorNames (const QString &)
 
void setVectorNames (const QStringList &)
 
QStringList vectorNames () const
 
QVector< AbstractColumn::ColumnModecolumnModes ()
 
void setStartRow (const int)
 
int startRow () const
 
void setEndRow (const int)
 
int endRow () const
 
void setStartColumn (const int)
 
int startColumn () const
 
void setEndColumn (const int)
 
int endColumn () const
 
void save (QXmlStreamWriter *) const override
 
bool load (XmlStreamReader *) override
 
int isPrepared ()
 
- Public Member Functions inherited from AbstractFileFilter
 AbstractFileFilter (FileType type)
 
 ~AbstractFileFilter () override=default
 
FileType type () const
 

Static Public Member Functions

static QStringList separatorCharacters ()
 
static QStringList commentCharacters ()
 
static QStringList dataTypes ()
 
static QStringList predefinedFilters ()
 
static QString fileInfoString (const QString &)
 
static int columnNumber (const QString &fileName, const QString &separator=QString())
 
static size_t lineNumber (const QString &fileName)
 
- Static Public Member Functions inherited from AbstractFileFilter
static bool isNan (const QString &)
 
static AbstractColumn::ColumnMode columnMode (const QString &valueString, const QString &dateTimeFormat, QLocale::Language)
 
static AbstractColumn::ColumnMode columnMode (const QString &valueString, const QString &dateTimeFormat, const QLocale &=QLocale())
 
static QString dateTimeFormat (const QString &valueString)
 
static QStringList numberFormats ()
 
static AbstractFileFilter::FileType fileType (const QString &)
 
static QStringList fileTypes ()
 

Private Attributes

std::unique_ptr< AsciiFilterPrivate > const d
 

Friends

class AsciiFilterPrivate
 

Additional Inherited Members

- Public Types inherited from AbstractFileFilter
enum class  FileType {
  Ascii , Binary , Image , HDF5 ,
  NETCDF , FITS , JSON , ROOT ,
  NgspiceRawAscii , NgspiceRawBinary
}
 
enum class  ImportMode { Append , Prepend , Replace }
 
- Signals inherited from AbstractFileFilter
void completed (int) const
 int ranging from 0 to 100 notifies about the status of a read/write process More...
 
- Protected Attributes inherited from AbstractFileFilter
const FileType m_type
 

Detailed Description

Manages the import/export of data organized as columns (vectors) from/to an ASCII-file.

File : AsciiFilter.cpp Project : LabPlot

Description : ASCII I/O-filter

Copyright : (C) 2009-2020 Stefan Gerlach (stefa.nosp@m.n.ge.nosp@m.rlach.nosp@m.@uni.nosp@m..kn) Copyright : (C) 2009-2019 Alexander Semke (alexa.nosp@m.nder.nosp@m..semk.nosp@m.e@we.nosp@m.b.de)

  • This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. *
  • This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. *
  • You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA *

Definition at line 42 of file AsciiFilter.h.

Constructor & Destructor Documentation

◆ AsciiFilter()

AsciiFilter::AsciiFilter ( )

Definition at line 61 of file AsciiFilter.cpp.

◆ ~AsciiFilter()

AsciiFilter::~AsciiFilter ( )
overridedefault

Member Function Documentation

◆ columnModes()

QVector< AbstractColumn::ColumnMode > AsciiFilter::columnModes ( )

Definition at line 378 of file AsciiFilter.cpp.

References d.

◆ columnNumber()

int AsciiFilter::columnNumber ( const QString &  fileName,
const QString &  separator = QString() 
)
static

returns the number of columns in the file fileName.

Definition at line 196 of file AsciiFilter.cpp.

References DEBUG, separator(), and STDSTRING.

Referenced by fileInfoString().

◆ commentCharacter()

QString AsciiFilter::commentCharacter ( ) const

Definition at line 279 of file AsciiFilter.cpp.

References d.

Referenced by load().

◆ commentCharacters()

QStringList AsciiFilter::commentCharacters ( )
static

returns the list of all predefined comment characters.

Definition at line 169 of file AsciiFilter.cpp.

Referenced by AsciiOptionsWidget::AsciiOptionsWidget(), and DatasetMetadataManagerWidget::DatasetMetadataManagerWidget().

◆ createIndexEnabled()

bool AsciiFilter::createIndexEnabled ( ) const

Definition at line 330 of file AsciiFilter.cpp.

References d.

Referenced by load().

◆ createTimestampEnabled()

bool AsciiFilter::createTimestampEnabled ( ) const

Definition at line 338 of file AsciiFilter.cpp.

References d.

Referenced by load().

◆ dataTypes()

QStringList AsciiFilter::dataTypes ( )
static

returns the list of all predefined data types.

Definition at line 176 of file AsciiFilter.cpp.

◆ dateTimeFormat()

QString AsciiFilter::dateTimeFormat ( ) const

Definition at line 293 of file AsciiFilter.cpp.

References d.

◆ endColumn()

int AsciiFilter::endColumn ( ) const

Definition at line 406 of file AsciiFilter.cpp.

References d.

Referenced by load().

◆ endRow()

int AsciiFilter::endRow ( ) const

Definition at line 392 of file AsciiFilter.cpp.

References d.

Referenced by load().

◆ fileInfoString()

QString AsciiFilter::fileInfoString ( const QString &  fileName)
static

Definition at line 186 of file AsciiFilter.cpp.

References columnNumber(), i18n, and lineNumber().

Referenced by FileInfoDialog::fileInfoString().

◆ isAutoModeEnabled()

bool AsciiFilter::isAutoModeEnabled ( ) const

Definition at line 308 of file AsciiFilter.cpp.

References d.

◆ isHeaderEnabled()

bool AsciiFilter::isHeaderEnabled ( ) const

Definition at line 315 of file AsciiFilter.cpp.

References d.

◆ isPrepared()

int AsciiFilter::isPrepared ( )

returns the separator used by the filter.

Definition at line 110 of file AsciiFilter.cpp.

References d.

Referenced by MQTTTopic::save().

◆ lineNumber() [1/2]

size_t AsciiFilter::lineNumber ( const QString &  fileName)
static

Definition at line 216 of file AsciiFilter.cpp.

References DEBUG, Origin::None, and STDSTRING.

Referenced by fileInfoString(), lineNumber(), and AsciiFilterPrivate::prepareDeviceToRead().

◆ lineNumber() [2/2]

size_t AsciiFilter::lineNumber ( QIODevice &  device) const

returns the number of lines in the device device and 0 if sequential. resets the position to 0!

Definition at line 255 of file AsciiFilter.cpp.

References d, and lineNumber().

◆ load()

◆ loadFilterSettings()

void AsciiFilter::loadFilterSettings ( const QString &  filterName)
overridevirtual

loads the predefined filter settings for filterName

Implements AbstractFileFilter.

Definition at line 139 of file AsciiFilter.cpp.

◆ NaNValueToZeroEnabled()

bool AsciiFilter::NaNValueToZeroEnabled ( ) const

Definition at line 355 of file AsciiFilter.cpp.

References d.

◆ numberFormat()

QLocale::Language AsciiFilter::numberFormat ( ) const

Definition at line 301 of file AsciiFilter.cpp.

References d.

◆ predefinedFilters()

QStringList AsciiFilter::predefinedFilters ( )
static

returns the list with the names of all saved (system wide or user defined) filter settings.

Definition at line 154 of file AsciiFilter.cpp.

◆ preview() [1/2]

QVector< QStringList > AsciiFilter::preview ( const QString &  fileName,
int  lines 
)

Definition at line 121 of file AsciiFilter.cpp.

References d.

◆ preview() [2/2]

QVector< QStringList > AsciiFilter::preview ( QIODevice &  device)

Definition at line 125 of file AsciiFilter.cpp.

References d.

◆ readDataFromDevice()

void AsciiFilter::readDataFromDevice ( QIODevice &  device,
AbstractDataSource dataSource,
AbstractFileFilter::ImportMode  importMode = AbstractFileFilter::ImportMode::Replace,
int  lines = -1 
)

reads the content of the device device.

Definition at line 68 of file AsciiFilter.cpp.

References d.

◆ readDataFromFile()

void AsciiFilter::readDataFromFile ( const QString &  fileName,
AbstractDataSource dataSource = nullptr,
AbstractFileFilter::ImportMode  importMode = AbstractFileFilter::ImportMode::Replace 
)
overridevirtual

reads the content of the file fileName.

Implements AbstractFileFilter.

Definition at line 117 of file AsciiFilter.cpp.

References d.

Referenced by DatasetHandler::processDataset().

◆ readFromLiveDevice()

qint64 AsciiFilter::readFromLiveDevice ( QIODevice &  device,
AbstractDataSource dataSource,
qint64  from = -1 
)

Definition at line 76 of file AsciiFilter.cpp.

References d.

◆ readFromLiveDeviceNotFile()

void AsciiFilter::readFromLiveDeviceNotFile ( QIODevice &  device,
AbstractDataSource dataSource 
)

Definition at line 72 of file AsciiFilter.cpp.

References d.

◆ removeQuotesEnabled()

bool AsciiFilter::removeQuotesEnabled ( ) const

Definition at line 362 of file AsciiFilter.cpp.

References d.

Referenced by load().

◆ save()

void AsciiFilter::save ( QXmlStreamWriter *  writer) const
overridevirtual

Saves as XML.

Implements AbstractFileFilter.

Definition at line 1743 of file AsciiFilter.cpp.

References d.

Referenced by MQTTClient::save(), and MQTTTopic::save().

◆ saveFilterSettings()

void AsciiFilter::saveFilterSettings ( const QString &  filterName) const
overridevirtual

saves the current settings as a new filter with the name filterName

Implements AbstractFileFilter.

Definition at line 146 of file AsciiFilter.cpp.

◆ separatingCharacter()

QString AsciiFilter::separatingCharacter ( ) const

Definition at line 286 of file AsciiFilter.cpp.

References d.

Referenced by load().

◆ separator()

QString AsciiFilter::separator ( ) const

returns the separator used by the filter.

Definition at line 103 of file AsciiFilter.cpp.

References d.

Referenced by columnNumber(), and MQTTTopic::save().

◆ separatorCharacters()

QStringList AsciiFilter::separatorCharacters ( )
static

returns the list of all predefined separator characters.

Definition at line 161 of file AsciiFilter.cpp.

Referenced by AsciiOptionsWidget::AsciiOptionsWidget(), DatasetMetadataManagerWidget::DatasetMetadataManagerWidget(), and ExportSpreadsheetDialog::ExportSpreadsheetDialog().

◆ setAutoModeEnabled()

void AsciiFilter::setAutoModeEnabled ( const bool  b)

Definition at line 305 of file AsciiFilter.cpp.

References d.

Referenced by ImportFileWidget::currentFileFilter(), and MQTTTopic::MQTTTopic().

◆ setCommentCharacter()

void AsciiFilter::setCommentCharacter ( const QString &  s)

◆ setCreateIndexEnabled()

void AsciiFilter::setCreateIndexEnabled ( const bool  b)

◆ setCreateTimestampEnabled()

void AsciiFilter::setCreateTimestampEnabled ( const bool  b)

Definition at line 334 of file AsciiFilter.cpp.

References d.

Referenced by AsciiOptionsWidget::applyFilterSettings(), and MQTTTopic::MQTTTopic().

◆ setDateTimeFormat()

void AsciiFilter::setDateTimeFormat ( const QString &  f)

◆ setEndColumn()

void AsciiFilter::setEndColumn ( const int  c)

Definition at line 403 of file AsciiFilter.cpp.

References d.

Referenced by MQTTTopic::MQTTTopic().

◆ setEndRow()

void AsciiFilter::setEndRow ( const int  r)

Definition at line 389 of file AsciiFilter.cpp.

References d.

Referenced by MQTTTopic::MQTTTopic().

◆ setHeaderEnabled()

void AsciiFilter::setHeaderEnabled ( const bool  b)

◆ setNaNValueToZero()

void AsciiFilter::setNaNValueToZero ( const bool  b)

Definition at line 349 of file AsciiFilter.cpp.

References d.

Referenced by AsciiOptionsWidget::applyFilterSettings(), and MQTTTopic::MQTTTopic().

◆ setNumberFormat()

void AsciiFilter::setNumberFormat ( QLocale::Language  lang)

Definition at line 297 of file AsciiFilter.cpp.

References d.

Referenced by AsciiOptionsWidget::applyFilterSettings(), and DatasetHandler::configureFilter().

◆ setRemoveQuotesEnabled()

void AsciiFilter::setRemoveQuotesEnabled ( const bool  b)

◆ setSeparatingCharacter()

void AsciiFilter::setSeparatingCharacter ( const QString &  s)

◆ setSimplifyWhitespacesEnabled()

void AsciiFilter::setSimplifyWhitespacesEnabled ( const bool  b)

◆ setSkipEmptyParts()

void AsciiFilter::setSkipEmptyParts ( const bool  b)

◆ setStartColumn()

void AsciiFilter::setStartColumn ( const int  c)

Definition at line 396 of file AsciiFilter.cpp.

References d.

Referenced by MQTTTopic::MQTTTopic().

◆ setStartRow()

void AsciiFilter::setStartRow ( const int  r)

Definition at line 382 of file AsciiFilter.cpp.

References d.

Referenced by MQTTTopic::MQTTTopic().

◆ setVectorNames() [1/2]

void AsciiFilter::setVectorNames ( const QString &  s)

◆ setVectorNames() [2/2]

void AsciiFilter::setVectorNames ( const QStringList &  list)

Definition at line 371 of file AsciiFilter.cpp.

References d.

◆ simplifyWhitespacesEnabled()

bool AsciiFilter::simplifyWhitespacesEnabled ( ) const

Definition at line 345 of file AsciiFilter.cpp.

References d.

Referenced by load().

◆ skipEmptyParts()

bool AsciiFilter::skipEmptyParts ( ) const

Definition at line 322 of file AsciiFilter.cpp.

References d.

Referenced by load().

◆ startColumn()

int AsciiFilter::startColumn ( ) const

Definition at line 399 of file AsciiFilter.cpp.

References d.

Referenced by load().

◆ startRow()

int AsciiFilter::startRow ( ) const

Definition at line 385 of file AsciiFilter.cpp.

References d.

Referenced by load().

◆ vectorNames()

QStringList AsciiFilter::vectorNames ( ) const

Definition at line 374 of file AsciiFilter.cpp.

References d.

◆ write()

void AsciiFilter::write ( const QString &  fileName,
AbstractDataSource dataSource 
)
overridevirtual

writes the content of the data source dataSource to the file fileName.

Implements AbstractFileFilter.

Definition at line 132 of file AsciiFilter.cpp.

References d.

Friends And Related Function Documentation

◆ AsciiFilterPrivate

friend class AsciiFilterPrivate
friend

Definition at line 129 of file AsciiFilter.h.

Member Data Documentation

◆ d


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