当前位置: 首页>>代码示例>>C++>>正文


C++ IOCallback::readFully方法代码示例

本文整理汇总了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();
}
开发者ID:MediaArea,项目名称:libebml,代码行数:31,代码来源:EbmlFloat.cpp

示例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();
}
开发者ID:OS2World,项目名称:LIB-MM-libebml,代码行数:26,代码来源:EbmlString.cpp

示例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;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:32,代码来源:EbmlFloat.cpp

示例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;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:26,代码来源:EbmlString.cpp

示例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;
}
开发者ID:MCZarin,项目名称:libebml,代码行数:10,代码来源:MemIOCallback.cpp

示例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();
}
开发者ID:MediaArea,项目名称:libebml,代码行数:16,代码来源:EbmlUInteger.cpp

示例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();
}
开发者ID:MediaArea,项目名称:libebml,代码行数:17,代码来源:EbmlDate.cpp

示例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;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:18,代码来源:EbmlUInteger.cpp

示例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();
}
开发者ID:Azpidatziak,项目名称:mkvtoolnix,代码行数:19,代码来源:EbmlCrc32.cpp

示例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();
}
开发者ID:OS2World,项目名称:LIB-MM-libebml,代码行数:22,代码来源:EbmlSInteger.cpp


注:本文中的IOCallback::readFully方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。