// 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; }
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; } }
// 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; }
I_OStream& Binary_Stream::put( const UChar* inString, tslen inLen ) { tslen Len = inLen; if( Len == -1 ) { Len = static_cast<tslen>(vu_strlen(inString)); } put(reinterpret_cast<const void*>(inString), Len * sizeof(UChar)); return *this; }
// 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; } }
// 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 ); }
// 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 ); }
// 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; } }