Exemplo n.º 1
0
bool CComplexBinary::OnDeserialize (CDatum::ESerializationFormats iFormat, const CString &sTypename, IByteStream &Stream)

//	OnDeserialize
//
//	Deserialize

	{
	if (m_pData)
		{
		delete [] GetBuffer();
		m_pData = NULL;
		}

	DWORD dwLength;
	Stream.Read(&dwLength, sizeof(DWORD));

	if (dwLength > 0)
		{
		CComplexBinary Temp(Stream, dwLength);
		m_pData = Temp.m_pData;
		Temp.m_pData = NULL;
		}

	return true;
	}
Exemplo n.º 2
0
bool CDatum::DeserializeTextUTF8 (IByteStream &Stream, CDatum *retDatum)

//	DeserializeTextUTF8
//
//	Loads straight UTF-8 into a single string value.

	{
	CStringBuffer Buffer;

	//	See if we have an encoding mark

	BYTE BOM[3];
	Stream.Read(BOM, sizeof(BOM));
	if (BOM[0] == 0xef && BOM[1] == 0xbb && BOM[2] == 0xbf)
		;	//	UTF-8

	//	Otherwise, not an encoding mark, so write it to the buffer

	else
		Buffer.Write(BOM, sizeof(BOM));

	//	Write the rest

	Buffer.Write(Stream, Stream.GetStreamLength());
	return CreateStringFromHandoff(Buffer, retDatum);
	}
Exemplo n.º 3
0
CComplexBinary::CComplexBinary (IByteStream &Stream, int iLength)

//	CComplexBinary constructor

	{
	ASSERT(iLength >= 0);

	if (iLength == 0)
		m_pData = NULL;
	else
		{
		char *pPos = new char [sizeof(DWORD) + iLength + 1];

		*(DWORD *)pPos = iLength;
		pPos += sizeof(DWORD);

		m_pData = pPos;

		Stream.Read(pPos, iLength);
		pPos += iLength;

		*pPos = '\0';
		}
	}