morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::table::DateParser Class Referenceabstract

Parses text to dates and date-times for Date and DateTime columns that hold text, and for filter values on those columns. More...

#include <data_source.hpp>

Inheritance diagram for morph::table::DateParser:
morph::table::IsoDateParser

Public Member Functions

virtual std::optional< std::int64_t > parseDate (std::string_view text, std::string_view format) const =0
 Parses a date.
virtual std::optional< std::int64_t > parseDateTime (std::string_view text, std::string_view format) const =0
 Parses a date-time.
virtual std::shared_ptr< DateParser const > cloneForTask () const
 An instance for one task to use alone.

Detailed Description

Parses text to dates and date-times for Date and DateTime columns that hold text, and for filter values on those columns.

The same thread-safety contract as TextCollator.

Definition at line 292 of file data_source.hpp.

Member Function Documentation

◆ parseDate()

virtual std::optional< std::int64_t > morph::table::DateParser::parseDate ( std::string_view text,
std::string_view format ) const
nodiscardpure virtual

Parses a date.

Parameters
textThe text.
formatThe column's format; empty for the parser's default.
Returns
Days since 1970-01-01, or nothing when text is not a date.

Implemented in morph::table::IsoDateParser.

◆ parseDateTime()

virtual std::optional< std::int64_t > morph::table::DateParser::parseDateTime ( std::string_view text,
std::string_view format ) const
nodiscardpure virtual

Parses a date-time.

Parameters
textThe text.
formatThe column's format; empty for the parser's default.
Returns
UTC seconds since the epoch, or nothing when text is not a date-time.

Implemented in morph::table::IsoDateParser.

◆ cloneForTask()

virtual std::shared_ptr< DateParser const > morph::table::DateParser::cloneForTask ( ) const
inlinenodiscardvirtual

An instance for one task to use alone.

Returns
Null when this instance is safe to call concurrently, else a copy.

Definition at line 313 of file data_source.hpp.


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