예제 #1
0
//	UChar*  =>  vuint64
//
vuint64 u_ustoull( const UChar* inStr )
{
    char buf[kULLongStrMaxLen + 1];

    if( inStr )
    {
        vuint32 len = (vuint32) vu_strlen(inStr);
        vu_u2a(inStr, buf, tslen( Min(len, kULLongStrMaxLen)) );
    }
    else
    {
        return 0;
    }

#ifdef _MSC_VER

    vuint64 value = 0;
    sscanf(buf, "%I64u", &value);

#else

    unsigned long long value = 0;
    sscanf(buf, "%llu", &value);

#endif //_MSC_VER

    return value;
}
예제 #2
0
FBL_Begin_Namespace


/**********************************************************************************************/
//	UChar*  =>  vint32
//
vint32 u_utol( const UChar* inStr )
{
    if( inStr )
    {
        const vuint32 buff_size = kLongStrMaxLen + 1;
        char buf[buff_size];

        vuint32 len = (vuint32) vu_strlen( inStr );

        // CONVERT to char* string
        vu_u2a( inStr, buf, (tslen) Min(len, kLongStrMaxLen) );

        // use ANSI char* library to convert to number
        return atol( buf );
    }
    else
    {
        return 0;
    }
}
예제 #3
0
//	UChar*  =>  vint64
//
vint64 u_utoll( const UChar* inStr )
{
    char buf[kLLongStrMaxLen + 1];
    if( inStr )
    {
        vuint32 len = (vuint32) vu_strlen(inStr);
        vu_u2a(inStr, buf, tslen( Min(len, kLLongStrMaxLen) ) );
    }
    else
    {
        return 0;
    }

#ifdef _MSC_VER

    vint64 value = (vint64) _atoi64( buf );

#else

    char* stopChar = nullptr;
    vint64 value = (vint64) strtoll( buf, &stopChar, 10 );

#endif //_MSC_VER

    return value;
}
예제 #4
0
// Convert functions. For HI perfomance.
//
vuint16 Convert_str_datetime_uu_fast( 
	const UChar*		inStr,
	const UChar*		inStrEnd,
	const DTFormat*		inFormat,
	DateTimeEncoded&	outDateTimeEnc )
{
	char strDateTime[kDateTimeStrMaxLength + 1];
	
	tslen len = tslen( inStrEnd - inStr );
	vu_u2a( inStr, strDateTime, len );

	return Convert_str_datetime_aa_fast( strDateTime, inFormat, outDateTimeEnc );
}
예제 #5
0
// WRAPPER, from UChar* to char* 
//
void Convert_str_time_uu_fast( 
	const UChar*		inStr, 
	const UChar*		inStrEnd, 
	const DTFormat*		inDTFormat,
	TimeEncoded&		outTimeEnc )
{
	char strTime[kTimeStrMaxLength + 1];
	
	tslen len = tslen( inStrEnd - inStr );
	vu_u2a(inStr, strTime, len);
	
	Convert_str_time_aa_fast(strTime, inDTFormat, outTimeEnc );
}
예제 #6
0
//	UChar*  =>  double
//
double u_utof( const UChar* inStr )
{
    char buf[kDoubleStrMaxLen + 1];
    if( inStr )
    {
        vuint32 len = (vuint32) vu_strlen(inStr);
        vu_u2a(inStr, buf, tslen( Min(len, kDoubleStrMaxLen) ) );

        return atof(buf);
    }
    else
    {
        return 0.0;
    }
}
예제 #7
0
// WRAPPER: UChar* => char*
//
void Convert_str_time_uu_aux( 
	const UChar*		inStr,
	const UChar*		inStrEnd,
	const DTFormat* 	inDTFormat,
	TimeEncoded&		ioTime )
{
	if( !inStr )
		return;

	char strTime[kTimeStrMaxLength + 1];
	
	tslen len = inStrEnd ? tslen(inStrEnd - inStr) : vu_strlen(inStr);
	vu_u2a(inStr, strTime, len);

	Convert_str_time_aa_aux( strTime, inDTFormat, ioTime );
}
예제 #8
0
// WRAPPER: UChar* => char*
//
void Convert_str_date_uu_aux( 
	const UChar*		inStr,
	const UChar*		inStrEnd,
	const DTFormat* 	inDTFormat,
	DateEncoded&		ioDate )
{
	if( !inStr )
		return;

	char strDate[kDateStrMaxLength + 1];

	tslen len = inStrEnd ? tslen(inStrEnd - inStr) : vu_strlen(inStr);
	vu_u2a( inStr, strDate, len );

	return Convert_str_date_aa_aux( 
					strDate, 
					inDTFormat,
					ioDate );
}
예제 #9
0
//	UChar*  =>  vuint32
//
vuint32 u_ustoul( const UChar* inStr )
{
    if( inStr )
    {
        char buf[kULongStrMaxLen + 1];

        vuint32 len = (vuint32) vu_strlen( inStr );

        // CONVERT to char* string
        vu_u2a( inStr, buf, (tslen) Min(len, kULongStrMaxLen) );

        // use ANSI char* library to convert to number
        char* stop_char = nullptr;
        return strtoul( buf, &stop_char, 10 );
    }
    else
    {
        return 0;
    }
}
예제 #10
0
FBL_Begin_Namespace


#pragma mark === Internal convert functions ===


/**********************************************************************************************/
// WRAPPER, from UChar* to char* 
//
vuint16 Convert_str_date_uu_fast( 
	const UChar*	inStr, 
	const UChar*	inStrEnd, 
	const DTFormat*	inDateFormat,
	DateEncoded&	outDateEnc )
{
	/// maybe this is a temporary solution...
	char strDate[kDateStrMaxLength + 1];

	tslen len = tslen( inStr - inStrEnd );
	vu_u2a( inStr, strDate, len );

	return Convert_str_date_aa_fast( strDate, inDateFormat, outDateEnc );
}