本文整理汇总了C++中IOCallback::readFully方法的典型用法代码示例。如果您正苦于以下问题:C++ IOCallback::readFully方法的具体用法?C++ IOCallback::readFully怎么用?C++ IOCallback::readFully使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOCallback
的用法示例。
在下文中一共展示了IOCallback::readFully方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadData
/*!
\todo remove the hack for possible endianess pb (test on little & big endian)
*/
filepos_t EbmlFloat::ReadData(IOCallback & input, ScopeMode ReadFully)
{
if (ReadFully != SCOPE_NO_DATA) {
binary Buffer[20];
assert(GetSize() <= 20);
input.readFully(Buffer, GetSize());
if (GetSize() == 4) {
big_int32 TmpRead;
TmpRead.Eval(Buffer);
int32 tmpp = int32(TmpRead);
float val;
memcpy(&val, &tmpp, 4);
Value = val;
SetValueIsSet();
} else if (GetSize() == 8) {
big_int64 TmpRead;
TmpRead.Eval(Buffer);
int64 tmpp = int64(TmpRead);
double val;
memcpy(&val, &tmpp, 8);
Value = val;
SetValueIsSet();
}
}
return GetSize();
}
示例2: ReadData
filepos_t EbmlString::ReadData(IOCallback & input, ScopeMode ReadFully)
{
if (ReadFully != SCOPE_NO_DATA)
{
if (GetSize() == 0) {
Value = "";
SetValueIsSet();
} else {
char *Buffer = new char[GetSize() + 1];
if (Buffer == NULL) {
// unable to store the data, skip it
input.setFilePointer(GetSize(), seek_current);
} else {
input.readFully(Buffer, GetSize());
if (Buffer[GetSize()-1] != '\0') {
Buffer[GetSize()] = '\0';
}
Value = Buffer;
delete [] Buffer;
SetValueIsSet();
}
}
}
return GetSize();
}
示例3: ReadData
/*!
\todo remove the hack for possible endianess pb (test on little & big endian)
*/
uint64 EbmlFloat::ReadData(IOCallback & input, ScopeMode ReadFully)
{
if (ReadFully != SCOPE_NO_DATA)
{
binary Buffer[20];
assert(Size <= 20);
input.readFully(Buffer, Size);
if (Size == 4) {
big_int32 TmpRead;
TmpRead.Eval(Buffer);
int32 tmpp = int32(TmpRead);
float val;
memcpy(&val, &tmpp, 4);
Value = val;
bValueIsSet = true;
} else if (Size == 8) {
big_int64 TmpRead;
TmpRead.Eval(Buffer);
int64 tmpp = int64(TmpRead);
double val;
memcpy(&val, &tmpp, 8);
Value = val;
bValueIsSet = true;
}
}
return Size;
}
示例4: ReadData
uint64 EbmlString::ReadData(IOCallback & input, ScopeMode ReadFully)
{
if (ReadFully != SCOPE_NO_DATA)
{
if (Size == 0) {
Value = "";
bValueIsSet = true;
} else {
char *Buffer = new char[Size + 1];
if (Buffer == NULL) {
// unable to store the data, skip it
input.setFilePointer(Size, seek_current);
} else {
input.readFully(Buffer, Size);
if (Buffer[Size-1] != '\0') {
Buffer[Size] = '\0';
}
Value = Buffer;
delete [] Buffer;
bValueIsSet = true;
}
}
}
return Size;
}
示例5: write
uint32 MemIOCallback::write(IOCallback & IOToRead, size_t Size)
{
if (dataBufferMemorySize < dataBufferPos + Size) {
//We need more memory!
dataBuffer = (binary *)realloc((void *)dataBuffer, dataBufferPos + Size);
}
IOToRead.readFully(&dataBuffer[dataBufferPos], Size);
dataBufferTotalSize = Size;
return Size;
}
示例6: ReadData
filepos_t EbmlUInteger::ReadData(IOCallback & input, ScopeMode ReadFully)
{
if (ReadFully != SCOPE_NO_DATA) {
binary Buffer[8];
input.readFully(Buffer, GetSize());
Value = 0;
for (unsigned int i=0; i<GetSize(); i++) {
Value <<= 8;
Value |= Buffer[i];
}
SetValueIsSet();
}
return GetSize();
}
示例7: ReadData
filepos_t EbmlDate::ReadData(IOCallback & input, ScopeMode ReadFully)
{
if ((ReadFully == SCOPE_NO_DATA) || (GetSize() == 0))
return GetSize();
assert(GetSize() == 8);
binary Buffer[8];
input.readFully(Buffer, GetSize());
big_int64 b64;
b64.Eval(Buffer);
myDate = b64;
SetValueIsSet();
return GetSize();
}
示例8: ReadData
uint64 EbmlUInteger::ReadData(IOCallback & input, ScopeMode ReadFully)
{
if (ReadFully != SCOPE_NO_DATA)
{
binary Buffer[8];
input.readFully(Buffer, Size);
Value = 0;
for (unsigned int i=0; i<Size; i++)
{
Value <<= 8;
Value |= Buffer[i];
}
bValueIsSet = true;
}
return Size;
}
示例9: GetSize
filepos_t EbmlCrc32::ReadData(IOCallback & input, ScopeMode ReadFully)
{
if (ReadFully != SCOPE_NO_DATA)
{
binary *Buffer = new binary[GetSize()];
if (Buffer == NULL) {
// impossible to read, skip it
input.setFilePointer(GetSize(), seek_current);
} else {
input.readFully(Buffer, GetSize());
memcpy((void *)&m_crc_final, Buffer, 4);
delete [] Buffer;
SetValueIsSet();
}
}
return GetSize();
}
示例10: ReadData
filepos_t EbmlSInteger::ReadData(IOCallback & input, ScopeMode ReadFully)
{
if (ReadFully != SCOPE_NO_DATA)
{
binary Buffer[8];
input.readFully(Buffer, GetSize());
if (Buffer[0] & 0x80)
Value = -1; // this is a negative value
else
Value = 0; // this is a positive value
for (unsigned int i=0; i<GetSize(); i++)
{
Value <<= 8;
Value |= Buffer[i];
}
SetValueIsSet();
}
return GetSize();
}