SciDAVis  1.D4
Signals | Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | Friends
String2DateTimeFilter Class Reference

Conversion filter QString -> QDateTime. More...

#include <String2DateTimeFilter.h>

Inheritance diagram for String2DateTimeFilter:
AbstractSimpleFilter AbstractFilter AbstractAspect

List of all members.

Signals

void formatChanged ()

Public Member Functions

virtual SciDAVis::ColumnDataType dataType () const
 Return the data type of the column.
virtual QDate dateAt (int row) const
 Return the date part of row 'row'.
virtual QDateTime dateTimeAt (int row) const
 Set the content of row 'row'.
QString format () const
 Return the format string.
virtual QList< Interval< int > > invalidIntervals () const
 Return all intervals of invalid rows.
virtual bool isInvalid (int row) const
 Return whether a certain row contains an invalid value.
virtual bool isInvalid (Interval< int > i) const
 Return whether a certain interval of rows contains only invalid values.
void setFormat (const QString &format)
 Set the format string to be used for conversion.
 String2DateTimeFilter (QString format="yyyy-MM-dd hh:mm:ss.zzz")
 Standard constructor.
virtual QTime timeAt (int row) const
 Return the time part of row 'row'.
XML related functions
virtual void writeExtraAttributes (QXmlStreamWriter *writer) const
 Override this in derived classes if they have other attributes than filter_name.
virtual bool load (XmlStreamReader *reader)
 Load from XML.
- Public Member Functions inherited from AbstractSimpleFilter
 AbstractSimpleFilter ()
 Ctor.
virtual SciDAVis::ColumnMode columnMode () const
 Return the column mode.
virtual int inputCount () const
 Default to one input port.
virtual AbstractColumnoutput (int port)
 Return a pointer to d_output_column on port 0 (don't override unless you really know what you are doing).
virtual const AbstractColumnoutput (int port) const
 Overloaded method for const access.
virtual int outputCount () const
 We manage only one output port (don't override unless you really know what you are doing).
virtual SciDAVis::PlotDesignation plotDesignation () const
 Copy plot designation of input port 0.
virtual QString textAt (int row) const
 Return the content of row 'row'.
virtual double valueAt (int row) const
 Return the double value in row 'row'.
virtual int rowCount () const
virtual QList< Interval< int > > dependentRows (Interval< int > input_range) const
virtual bool isMasked (int row) const
 Return whether a certain row is masked.
virtual bool isMasked (Interval< int > i) const
 Return whether a certain interval of rows rows is fully masked.
virtual QList< Interval< int > > maskedIntervals () const
 Return all intervals of masked rows.
virtual void clearMasks ()
 Clear all masking information.
virtual void setMasked (Interval< int > i, bool mask=true)
 Set an interval masked.
virtual void setMasked (int row, bool mask=true)
 Overloaded function for convenience.
virtual void save (QXmlStreamWriter *writer) const
 Save to XML.
- Public Member Functions inherited from AbstractFilter
 AbstractFilter (const QString &name)
 Standard constructor.
int highestConnectedInput () const
 Return the index of the highest input port that is connected.
bool input (int port, const AbstractColumn *source)
 Connect the provided data source to the specified input port.
bool input (const AbstractFilter *sources)
 Connect all outputs of the provided filter to the corresponding inputs of this filter.
const AbstractColumninput (int port) const
 Return the input currently connected to the specified port, or 0.
virtual QString inputLabel (int port) const
 Return the label associated to the given input port.
int portIndexOf (const AbstractColumn *column)
 Return the input port to which the column is connected or -1 if it's not connected.
virtual ~AbstractFilter ()
 Destructor.
- Public Member Functions inherited from AbstractAspect
 AbstractAspect (const QString &name)
void addChild (AbstractAspect *child)
 Add the given Aspect to my list of children.
QString caption () const
QString captionSpec () const
 Return the specification string used for constructing the caption().
AbstractAspectchild (int index) const
 Get a child by its position in my list of children.
int childCount () const
 Return the number of child Aspects.
QString comment () const
virtual QMenu * createContextMenu () const
 Return a new context menu.
QDateTime creationTime () const
QList< AbstractAspect * > descendantsThatInherit (const char *class_name)
 Get all descendents that inherit the given class.
future::Folderfolder ()
 Return the folder the Aspect is contained in or 0 if not.
virtual QIcon icon () const
 Return an icon to be used for decorating my views.
void importV0x0001XXCreationTime (const QString &str)
int index () const
 Return my position in my parent's list of children.
int indexOfChild (const AbstractAspect *child) const
 Return the position of child in my list of children.
void insertChild (AbstractAspect *child, int index)
 Insert the given Aspect at a specific position in my list of children.
bool isDescendantOf (AbstractAspect *other)
 Return whether the there is a path upwards to the given aspect.
void moveChild (int from, int to)
 Change the positon of a child in my list of children.
QString name () const
AbstractAspectparentAspect () const
 Return my parent Aspect or 0 if I currently don't have one.
virtual QString path () const
 Return the path that leads from the top-most Aspect (usually a Project) to me.
virtual const Projectproject () const
 Return the Project this Aspect belongs to, or 0 if it is currently not part of one.
virtual Projectproject ()
 Return the Project this Aspect belongs to, or 0 if it is currently not part of one.
virtual void removeAllChildAspects ()
 Remove all child aspects.
void removeChild (AbstractAspect *child, bool detach=false)
 Remove the given Aspect from my list of children.
void removeChild (int index)
 Remove the Aspect at the given index from my list of children.
void reparentChild (AbstractAspect *new_parent, AbstractAspect *child, int d_new_index)
 Move a child to another aspect and transfer ownership.
void reparentChild (AbstractAspect *new_parent, AbstractAspect *child)
 Move a child to another aspect and transfer ownership.
virtual ~AbstractAspect ()
virtual QUndoStack * undoStack () const
 Return the undo stack of the Project, or 0 if this Aspect is not part of a Project.
void exec (QUndoCommand *command)
 Execute the given command, pushing it on the undoStack() if available.
void beginMacro (const QString &text)
 Begin an undo stack macro (series of commands)
void endMacro ()
 End the undo stack macro.

Protected Member Functions

virtual bool inputAcceptable (int, const AbstractColumn *source)
 Using typed ports: only string inputs are accepted.
- Protected Member Functions inherited from AbstractSimpleFilter
virtual void inputPlotDesignationAboutToChange (const AbstractColumn *)
 The plot designation of an input is about to change.
virtual void inputPlotDesignationChanged (const AbstractColumn *)
 The plot designation of an input changed.
virtual void inputModeAboutToChange (const AbstractColumn *)
 The display mode and possibly the data type of an input is about to change.
virtual void inputModeChanged (const AbstractColumn *)
 The display mode and possibly the data type has changed.
virtual void inputDataAboutToChange (const AbstractColumn *)
 The data of an input is about to change.
virtual void inputDataChanged (const AbstractColumn *)
 The data of an input has changed.
virtual void inputRowsAboutToBeInserted (const AbstractColumn *source, int before, int count)
virtual void inputRowsInserted (const AbstractColumn *source, int before, int count)
virtual void inputRowsAboutToBeRemoved (const AbstractColumn *source, int first, int count)
virtual void inputRowsRemoved (const AbstractColumn *source, int first, int count)
- Protected Member Functions inherited from AbstractFilter
virtual void inputAboutToBeDisconnected (const AbstractColumn *source)
 Called whenever an input is disconnected or deleted.
- Protected Member Functions inherited from AbstractAspect
virtual void completeAspectInsertion (AbstractAspect *aspect, int index)
 Called after a new child has been inserted or added.
void info (const QString &text)
 Implementations should call this whenever status information should be given to the user.
virtual void prepareAspectRemoval (AbstractAspect *aspect)
 Called before a child is removed.
void setCreationTime (const QDateTime &time)
 Set the creation time.
bool readBasicAttributes (XmlStreamReader *reader)
 Load name, creation time and caption spec from XML.
void writeBasicAttributes (QXmlStreamWriter *writer) const
 Save name, creation time and caption spec to XML.
void writeCommentElement (QXmlStreamWriter *writer) const
 Save the comment to XML.
bool readCommentElement (XmlStreamReader *reader)
 Load comment from an XML element.

Private Attributes

QString d_format
 The format string.

Static Private Attributes

static const char * date_formats []
static const char * time_formats []

Friends

class String2DateTimeFilterSetFormatCmd

Additional Inherited Members

- Protected Attributes inherited from AbstractSimpleFilter
IntervalAttribute< bool > d_masking
SimpleFilterColumnd_output_column
- Protected Attributes inherited from AbstractFilter
QVector< const AbstractColumn * > d_inputs
 The data sources connected to my input ports.

Detailed Description

Conversion filter QString -> QDateTime.

The standard use of this filter is explicitly specifiying the date/time format of the strings on the input, either in the constructor or via setFormat(). However, if the input fails to comply to this format, String2DateTimeFilter tries to guess the format, using internal lists of common date and time formats (date_formats and time_formats).


Constructor & Destructor Documentation

String2DateTimeFilter::String2DateTimeFilter ( QString  format = "yyyy-MM-dd hh:mm:ss.zzz")
inlineexplicit

Standard constructor.


Member Function Documentation

virtual SciDAVis::ColumnDataType String2DateTimeFilter::dataType ( ) const
inlinevirtual

Return the data type of the column.

Reimplemented from AbstractSimpleFilter.

References SciDAVis::TypeQDateTime.

virtual QDate String2DateTimeFilter::dateAt ( int  row) const
inlinevirtual

Return the date part of row 'row'.

Use this only when dataType() is QDateTime

Reimplemented from AbstractSimpleFilter.

References dateTimeAt().

QDateTime String2DateTimeFilter::dateTimeAt ( int  row) const
virtual

Set the content of row 'row'.

Use this only when dataType() is QDateTime

Reimplemented from AbstractSimpleFilter.

References d_format, AbstractFilter::d_inputs, date_formats, format(), and time_formats.

Referenced by dateAt(), isInvalid(), and timeAt().

QString String2DateTimeFilter::format ( ) const
inline

Return the format string.

The default format string is "yyyy-MM-dd hh:mm:ss.zzz".

See also:
QDate::toString()

References d_format.

Referenced by dateTimeAt(), and writeExtraAttributes().

void String2DateTimeFilter::formatChanged ( )
signal
virtual bool String2DateTimeFilter::inputAcceptable ( int  ,
const AbstractColumn source 
)
inlineprotectedvirtual

Using typed ports: only string inputs are accepted.

Reimplemented from AbstractFilter.

References AbstractColumn::dataType(), and SciDAVis::TypeQString.

virtual QList< Interval<int> > String2DateTimeFilter::invalidIntervals ( ) const
inlinevirtual
virtual bool String2DateTimeFilter::isInvalid ( int  row) const
inlinevirtual

Return whether a certain row contains an invalid value.

Reimplemented from AbstractSimpleFilter.

References AbstractFilter::d_inputs, dateTimeAt(), and AbstractColumn::isInvalid().

Referenced by invalidIntervals(), and isInvalid().

virtual bool String2DateTimeFilter::isInvalid ( Interval< int >  i) const
inlinevirtual

Return whether a certain interval of rows contains only invalid values.

Reimplemented from AbstractSimpleFilter.

References AbstractFilter::d_inputs, IntervalBase< T >::end(), isInvalid(), and IntervalBase< T >::start().

bool String2DateTimeFilter::load ( XmlStreamReader reader)
virtual

Load from XML.

Reimplemented from AbstractSimpleFilter.

References AbstractSimpleFilter::load(), and setFormat().

void String2DateTimeFilter::setFormat ( const QString &  format)

Set the format string to be used for conversion.

References AbstractAspect::exec(), and String2DateTimeFilterSetFormatCmd.

Referenced by load().

virtual QTime String2DateTimeFilter::timeAt ( int  row) const
inlinevirtual

Return the time part of row 'row'.

Use this only when dataType() is QDateTime

Reimplemented from AbstractSimpleFilter.

References dateTimeAt().

void String2DateTimeFilter::writeExtraAttributes ( QXmlStreamWriter *  writer) const
virtual

Override this in derived classes if they have other attributes than filter_name.

Reimplemented from AbstractSimpleFilter.

References format().


Friends And Related Function Documentation

friend class String2DateTimeFilterSetFormatCmd
friend

Referenced by setFormat().


Member Data Documentation

QString String2DateTimeFilter::d_format
private

The format string.

Referenced by dateTimeAt(), format(), and String2DateTimeFilterSetFormatCmd::redo().

const char * String2DateTimeFilter::date_formats
staticprivate
Initial value:
{
"yyyy-M-d",
"yyyy/M/d",
"d/M/yyyy",
"d/M/yy",
"d-M-yyyy",
"d-M-yy",
"d.M.yyyy",
"d.M.yy",
"M/yyyy",
"d.M.",
"yyyyMMdd",
0
}

Referenced by dateTimeAt().

const char * String2DateTimeFilter::time_formats
staticprivate
Initial value:
{
"h",
"h ap",
"h:mm",
"h:mm ap",
"h:mm:ss",
"h:mm:ss.zzz",
"h:mm:ss:zzz",
"mm:ss.zzz",
"hmmss",
0
}

Referenced by dateTimeAt().


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