// Convert functions // void Convert_str_time_aa_aux( const char* inStr, const DTFormat* inDTFormat, TimeEncoded& ioTime ) { if( !inStr || *inStr == 0 ) { ioTime.encoded = 0; return; } vint32 BadCharIndex = CheckTimeStringFormat( inStr, inDTFormat ); if( BadCharIndex ) { throw xValueError( ERR_TIME_VALUE_NOT_MATCH_FORMAT, String(inStr).c_str(), ToUCharPtr(BadCharIndex).c_str() ); } // Now we know that string STRICTLY correspond to expected format, // so we can do fast extracting of numbers using scanf() Convert_str_time_aa_fast( inStr, inDTFormat, ioTime ); // Final step - we check that extracted numbers fit limits: if( CheckTimeValueLimits( ioTime ) == false ) throw xValueError( ERR_TIME_VALUE_HAVE_WRONG_NUMBERS, inStr ); }
void Convert_str_date_aa_aux( const char* inStr, const DTFormat* inDTFormat, DateEncoded& ioDate ) { if( !inStr || *inStr == 0 ) { ioDate.encoded = 0; return; } vint32 BadCharIndex = CheckDateStringFormat( inStr, inDTFormat ); if( BadCharIndex ) { throw xValueError( ERR_DATE_VALUE_NOT_MATCH_FORMAT, String(inStr).c_str(), ToUCharPtr(BadCharIndex).c_str() ); } // Now we know that string STRICTLY correspond to expected format, // so we can do fast extracting of numbers using scanf() vuint16 yearDigits = Convert_str_date_aa_fast( inStr, inDTFormat, ioDate ); // Final step - we check that extracted numbers fit limits: if( CheckDateValueLimits( ioDate ) == false ) throw xValueError( ERR_DATE_VALUE_HAVE_WRONG_NUMBERS, inStr ); if( yearDigits < 4 ) { vint32 year = ioDate.decoded.y; inDTFormat->AutoCentury( year ); ioDate.decoded.y = year; } }