BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
QREDataLoader::ImportSettings Struct Reference

Description

Settings for importing the file.

Definition at line 69 of file QREDataLoader.h.

Public Member Functions

void deserialize (const QByteArray &data)
 
bool operator!= (const ImportSettings &other) const
 
QByteArray serialize () const
 

Public Attributes

bool allowValuesGreaterOne = true
 always true for now (see ##94); could be made configurable later on More...
 
QMap< DataType, ColumnDefinitioncolumnDefinitions
 
QString headerPrefix
 prefix denoting header line More...
 
QString linesToSkip
 pattern denoting line to skip (i.e. '1,10-12,42') More...
 
QString separator
 column separator More...
 

Member Function Documentation

◆ deserialize()

void QREDataLoader::ImportSettings::deserialize ( const QByteArray &  data)

Definition at line 684 of file QREDataLoader.cpp.

685 {
686  columnDefinitions.clear();
687 
688  QDataStream s(data);
689  s.setVersion(QDataStream::Qt_5_12);
690 
691  quint8 version;
692  s >> version;
693 
694  if (version == 1) {
695  s >> separator;
696  s >> headerPrefix;
697  s >> linesToSkip;
698 
699  quint8 nDefs;
700  s >> nDefs;
701  for (int i = 0; i < nDefs; i++) {
702  quint8 dataType;
703  s >> dataType;
704  auto& colDef = columnDefinitions[(DataType)dataType];
705  s >> colDef.enabled;
706  s >> colDef.column;
707  quint8 unit;
708  s >> unit;
709  colDef.unit = UnitInFile(unit);
710  s >> colDef.factor;
711  }
712  } else
714 
715  if (s.status() != QDataStream::Ok)
717 }
static DeserializationException streamError()
static DeserializationException tooNew()
QString separator
column separator
Definition: QREDataLoader.h:70
QMap< DataType, ColumnDefinition > columnDefinitions
Definition: QREDataLoader.h:75
QString headerPrefix
prefix denoting header line
Definition: QREDataLoader.h:71
QString linesToSkip
pattern denoting line to skip (i.e. '1,10-12,42')
Definition: QREDataLoader.h:72

References DeserializationException::streamError(), and DeserializationException::tooNew().

Here is the call graph for this function:

◆ operator!=()

bool QREDataLoader::ImportSettings::operator!= ( const ImportSettings other) const

Definition at line 656 of file QREDataLoader.cpp.

657 {
658  return serialize() != other.serialize();
659 }
@ other
The unit has no enum value defined in here (e.g. when defined as an explicit string)

References other, and QREDataLoader::serialize().

Here is the call graph for this function:

◆ serialize()

QByteArray QREDataLoader::ImportSettings::serialize ( ) const

Definition at line 661 of file QREDataLoader.cpp.

662 {
663  QByteArray a;
664  QDataStream s(&a, QIODevice::WriteOnly);
665  s.setVersion(QDataStream::Qt_5_12);
666 
667  s << (quint8)1; // version
668  s << separator;
669  s << headerPrefix;
670  s << linesToSkip;
671 
672  s << (quint8)columnDefinitions.count();
673  for (const auto dataType : columnDefinitions.keys()) {
674  s << (quint8)dataType;
675  s << columnDefinitions[dataType].enabled;
676  s << columnDefinitions[dataType].column;
677  s << (quint8)columnDefinitions[dataType].unit;
678  s << columnDefinitions[dataType].factor;
679  }
680 
681  return a;
682 }

Member Data Documentation

◆ allowValuesGreaterOne

bool QREDataLoader::ImportSettings::allowValuesGreaterOne = true

always true for now (see ##94); could be made configurable later on

Definition at line 73 of file QREDataLoader.h.

Referenced by QREDataLoader::calculateFromParseResult().

◆ columnDefinitions

◆ headerPrefix

◆ linesToSkip

QString QREDataLoader::ImportSettings::linesToSkip

◆ separator


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