Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::cTimeParser Class Reference

#include <cTimeUnits.h>

Public Member Functions

int FindType (TIMEUNIT_TYPE t) const
 
void SetUnitFormats (const GChar_t *pszFormat)
 
StrLen_t ParseNamedUnit (const GChar_t *pszName)
 
HRESULT ParseString (const GChar_t *pszTimeString, const GChar_t *pszSeparators=nullptr)
 
bool isMatched () const
 
StrLen_t GetMatchedLength () const
 
bool TestMatchFormat (const cTimeParser &parserFormat, bool bTrimJunk=false)
 
bool TestMatch (const GChar_t *pszFormat)
 
bool TestMatches (const GChar_t **ppStrFormats=nullptr)
 
HRESULT GetTimeUnits (OUT cTimeUnits &tu) const
 
 cTimeParser ()
 
 cTimeParser (const GChar_t *pszTimeString)
 
 cTimeParser (const GChar_t *pszTimeString, const GChar_t **ppStrFormats)
 

Static Public Member Functions

static bool __stdcall TestMatchUnit (const cTimeParserUnit &u, TIMEUNIT_TYPE t)
 
static TIMEUNIT_TYPE __stdcall GetTypeFromFormatCode (GChar_t ch)
 

Public Attributes

cTimeParserUnit m_Unit [TIMEUNIT_QTY2]
 space for parsed results. More...
 
int m_iUnitsParsed
 m_Unit used. <TIMEUNIT_QTY2 More...
 
int m_iUnitsMatched
 m_iUnitsMatched <= m_iUnitsParsed and all m_Type are set. No use of TIMEUNIT_Numeric More...
 

Detailed Description

Try to interpret/parse a string as a date/time. Hold result of the first parsing pass to (perhaps) process the time string as cTimeUnits.

Constructor & Destructor Documentation

◆ cTimeParser() [1/3]

Gray::cTimeParser::cTimeParser ( )
inline

◆ cTimeParser() [2/3]

Gray::cTimeParser::cTimeParser ( const GChar_t pszTimeString)
inline

◆ cTimeParser() [3/3]

Gray::cTimeParser::cTimeParser ( const GChar_t pszTimeString,
const GChar_t **  ppStrFormats 
)
inline

Member Function Documentation

◆ FindType()

int Gray::cTimeParser::FindType ( TIMEUNIT_TYPE  t) const

◆ GetMatchedLength()

StrLen_t Gray::cTimeParser::GetMatchedLength ( ) const
inline

How much of the parsed string was consumed by the match?

◆ GetTimeUnits()

HRESULT Gray::cTimeParser::GetTimeUnits ( OUT cTimeUnits tu) const

Make a valid cTimeUnits class from what we already parsed. If i can.

◆ GetTypeFromFormatCode()

TIMEUNIT_TYPE GRAYCALL Gray::cTimeParser::GetTypeFromFormatCode ( GChar_t  ch)
static

◆ isMatched()

bool Gray::cTimeParser::isMatched ( ) const
inline

◆ ParseNamedUnit()

StrLen_t Gray::cTimeParser::ParseNamedUnit ( const GChar_t pszName)

◆ ParseString()

HRESULT Gray::cTimeParser::ParseString ( const GChar_t pszTimeString,
const GChar_t pszSeparators = nullptr 
)

parse the pszTimeString to look for things that look like a date time. parse 3 types of things: Separators, numbers and unit names (e.g. Sunday).

Returns
: m_iUnitsParsed
Todo:
parse odd time zone storage . (-03:00)
Todo:
parse odd time zone storage . (-03:00)

◆ SetUnitFormats()

void Gray::cTimeParser::SetUnitFormats ( const GChar_t pszFormat)

Similar to ParseString but assumes we just want to set units from a format string.

◆ TestMatch()

bool Gray::cTimeParser::TestMatch ( const GChar_t pszFormat)

Does pszFormat fit with data in m_Units ?

◆ TestMatches()

bool Gray::cTimeParser::TestMatches ( const GChar_t **  ppStrFormats = nullptr)

Try standard k_StrFormats to match.

◆ TestMatchFormat()

bool Gray::cTimeParser::TestMatchFormat ( const cTimeParser parserFormat,
bool  bTrimJunk = false 
)

Does parserFormat fit with data in m_Units ? Does this contain compatible units with parserFormat? if so fix m_Unit types!

  • bTrimJunk = any unrecognized stuff beyond parserFormat can just be trimmed.

◆ TestMatchUnit()

bool GRAYCALL Gray::cTimeParser::TestMatchUnit ( const cTimeParserUnit u,
TIMEUNIT_TYPE  t 
)
static

Member Data Documentation

◆ m_iUnitsMatched

int Gray::cTimeParser::m_iUnitsMatched

m_iUnitsMatched <= m_iUnitsParsed and all m_Type are set. No use of TIMEUNIT_Numeric

◆ m_iUnitsParsed

int Gray::cTimeParser::m_iUnitsParsed

m_Unit used. <TIMEUNIT_QTY2

◆ m_Unit

cTimeParserUnit Gray::cTimeParser::m_Unit[TIMEUNIT_QTY2]

space for parsed results.


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