本文整理汇总了C++中UnicodeString::Assign方法的典型用法代码示例。如果您正苦于以下问题:C++ UnicodeString::Assign方法的具体用法?C++ UnicodeString::Assign怎么用?C++ UnicodeString::Assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnicodeString
的用法示例。
在下文中一共展示了UnicodeString::Assign方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateInstance
HRESULT CLR_RT_FileStream::CreateInstance( CLR_RT_HeapBlock& ref, LPCSTR path, int bufferSize )
{
NATIVE_PROFILE_CLR_IO();
TINYCLR_HEADER();
CLR_RT_HeapBlock_BinaryBlob* blob;
CLR_UINT32 blobSize = sizeof(CLR_RT_FileStream);
CLR_RT_FileStream* fs;
UnicodeString pathW;
LPCSTR nameSpace;
LPCSTR relativePath;
CLR_UINT32 nameSpaceLength;
int inputBufferSize = 0;
int outputBufferSize = 0;
FileSystemVolume* driver;
STREAM_DRIVER_DETAILS* sdd;
TINYCLR_CHECK_HRESULT(CLR_RT_FileStream::SplitFilePath( path, &nameSpace, &nameSpaceLength, &relativePath ));
/// Retrieve appropriate driver that handles this namespace.
if((driver = FileSystemVolumeList::FindVolume( nameSpace, nameSpaceLength )) == NULL)
{
TINYCLR_SET_AND_LEAVE(CLR_E_VOLUME_NOT_FOUND);
}
if(!(driver->ValidateStreamDriver()))
{
TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_DRIVER);
}
sdd = driver->DriverDetails();
if(sdd->bufferingStrategy == SYSTEM_BUFFERED_IO)
{
if(bufferSize == 0)
{
inputBufferSize = (sdd->inputBufferSize > 0) ? sdd->inputBufferSize : FS_DEFAULT_BUFFER_SIZE;
outputBufferSize = (sdd->outputBufferSize > 0) ? sdd->outputBufferSize : FS_DEFAULT_BUFFER_SIZE;
}
else
{
inputBufferSize = bufferSize;
outputBufferSize = bufferSize;
}
blobSize += inputBufferSize + outputBufferSize;
}
TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_BinaryBlob::CreateInstance( ref, blobSize, NULL, CLR_RT_FileStream::RelocationHandler, 0 ));
blob = ref.DereferenceBinaryBlob();
fs = (CLR_RT_FileStream*)blob->GetData();
// Clear the memory
CLR_RT_Memory::ZeroFill( fs, blobSize );
fs->m_driver = driver;
fs->m_driverDetails = sdd;
switch(sdd->bufferingStrategy)
{
case SYSTEM_BUFFERED_IO: // I/O is asynchronous from a PAL level buffer: the runtime will alocate the necesary memory
{
BYTE* inputBuffer = (BYTE*)&(fs[ 1 ]);
BYTE* outputBuffer = inputBuffer + inputBufferSize;
TINYCLR_CHECK_HRESULT(fs->AssignStorage( inputBuffer, inputBufferSize, outputBuffer, outputBufferSize ));
}
break;
case DRIVER_BUFFERED_IO: // I/O is asynchronous from a HAL level or HW buffer: the runtime will just handle the existing memory
if((sdd->inputBuffer == NULL && sdd->canRead ) ||
(sdd->outputBuffer == NULL && sdd->canWrite))
{
TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_DRIVER);
}
TINYCLR_CHECK_HRESULT(fs->AssignStorage( sdd->inputBuffer, sdd->inputBufferSize,
sdd->outputBuffer, sdd->outputBufferSize ));
break;
}
TINYCLR_CHECK_HRESULT(pathW.Assign( relativePath ));
TINYCLR_CHECK_HRESULT(driver->Open( pathW, &(fs->m_handle) ));
TINYCLR_NOCLEANUP();
}