示例#1
0
char* Value_time_imp::get_String( 
	char*	outString, 
	tslen 	inBufferChars ) const
{
	// The size of input buffer (inBufferChars) cannot be -1 !
	// Because this is unsafe then to write to  the memory 
	// location pointed by outString - because we don't know the size !
	if( outString == nullptr || inBufferChars <= 0 )
		return nullptr;

	char* pEnd = nullptr;

	if( inBufferChars < tslen(kTimeStrMaxLength) )
	{
		String res( get_String( inBufferChars ) );
		tslen len = res.length();
		memcpy( outString, res.getBufferA(), len );
		*(outString + len) = 0;
		pEnd = outString + len;
	}
	else
	{
		const DTFormat* pDTFormat = get_DTFormat();
		Convert_time_str_aa_fast( 
			(TimeEncoded&)mValue, static_cast<char>(pDTFormat->mTimeSep), outString );

		pEnd = outString + kTimeStrMaxLength;
	}

	return pEnd;
}
示例#2
0
UChar* Value_date_imp::get_String( 
	UChar* outString, 
	tslen inBufferChars ) const
{
	// The size of input buffer (inBufferChars) cannot be -1 !
	// Because this is unsafe then to write to  the memory 
	// location pointed by outString - because we don't know the size !
	if( outString == nullptr || inBufferChars <= 0 )
		return nullptr;

	UChar* pEnd = nullptr;

	if( inBufferChars < tslen(kDateStrMaxLength) )
	{
		String res( get_String( inBufferChars ) );
		tslen len = res.length();
		memcpy( outString, res.begin(), len * sizeof(UChar) );
		*(outString + len) = 0;
		pEnd = outString + len;
	}
	else
	{
		const DTFormat* pDTFormat = get_DTFormat();

		Convert_date_str_fast( 
			(DateEncoded&)mValue, pDTFormat->mDateFormat, pDTFormat->mDateSep, outString );

		pEnd = ( ((DateEncoded&)mValue).encoded < 0 ) ? 
						outString + kDateStrMaxLength : 
						outString + kDateStrMaxLength - 1;
	}

	return pEnd;
}	
示例#3
0
UChar* Value_Raw::get_String( UChar* outString, tslen inBufferChars ) const
{
	// There is no sence to work with Binary data as with zero terminated and probably
	// multibyte string.
	// 
	return (UChar*)get_String( (char*)outString, inBufferChars );
}
示例#4
0
BOOL vmsStringList::Save(HANDLE hFile)
{
    int c = m_vList.size ();

    DWORD dw;

    if (FALSE == WriteFile (hFile, &c, sizeof (c), &dw, NULL))
        return FALSE;

    for (int i = 0; i < c; i++)
    {
        if (FALSE == fsSaveStrToFile (get_String (i), hFile))
            return FALSE;
    }

    return TRUE;
}
示例#5
0
String Value_money_imp::get_String( tslen inLimit ) const
{
	String str;
	
	if( inLimit != 0 )
	{
		tslen MaxLen = get_MaxChars();
		tslen BuffLength = MaxLen + 1;
		UChar* pBuffer = str.getBuffer( BuffLength );
		UChar* pEnd    = get_String( pBuffer, MaxLen ); // copy str into buffer.

		str.releaseBuffer( static_cast<tslen>(pEnd - pBuffer) );

		// not -1 and less than maxLen
		if( inLimit > 0 && inLimit < MaxLen )
		{
			str.truncate( inLimit );
		}
	}
	
	return str;
}