本文整理汇总了C++中IOCallback::writeFully方法的典型用法代码示例。如果您正苦于以下问题:C++ IOCallback::writeFully方法的具体用法?C++ IOCallback::writeFully怎么用?C++ IOCallback::writeFully使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOCallback
的用法示例。
在下文中一共展示了IOCallback::writeFully方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderData
filepos_t EbmlVoid::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault)
{
// write dummy data by 4KB chunks
static binary DummyBuf[4*1024];
uint64 SizeToWrite = GetSize();
while (SizeToWrite > 4*1024)
{
output.writeFully(DummyBuf, 4*1024);
SizeToWrite -= 4*1024;
}
output.writeFully(DummyBuf, SizeToWrite);
return GetSize();
}
示例2: RenderData
uint32 EbmlVoid::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
{
// write dummy data by 4KB chunks
static binary DummyBuf[4*1024];
uint64 SizeToWrite = Size;
while (SizeToWrite > 4*1024)
{
output.writeFully(DummyBuf, 4*1024);
SizeToWrite -= 4*1024;
}
output.writeFully(DummyBuf, SizeToWrite);
return Size;
}
示例3: RenderData
/*!
\todo handle exception on errors
\todo write all the Mandatory elements in the Context, otherwise assert
*/
filepos_t EbmlMaster::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault)
{
filepos_t Result = 0;
size_t Index;
if (!bForceRender) {
assert(CheckMandatory());
}
if (!bChecksumUsed) { // old school
for (Index = 0; Index < ElementList.size(); Index++) {
if (!bWithDefault && (ElementList[Index])->IsDefaultValue())
continue;
Result += (ElementList[Index])->Render(output, bWithDefault, false ,bForceRender);
}
} else { // new school
MemIOCallback TmpBuf(GetSize() - 6);
for (Index = 0; Index < ElementList.size(); Index++) {
if (!bWithDefault && (ElementList[Index])->IsDefaultValue())
continue;
(ElementList[Index])->Render(TmpBuf, bWithDefault, false ,bForceRender);
}
Checksum.FillCRC32(TmpBuf.GetDataBuffer(), TmpBuf.GetDataBufferSize());
Result += Checksum.Render(output, true, false ,bForceRender);
output.writeFully(TmpBuf.GetDataBuffer(), TmpBuf.GetDataBufferSize());
Result += TmpBuf.GetDataBufferSize();
}
return Result;
}
示例4: RenderData
/*!
\todo handle exception on errors
\todo handle 10 bits precision
*/
filepos_t EbmlFloat::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{
assert(GetSize() == 4 || GetSize() == 8);
if (GetSize() == 4) {
float val = Value;
int Tmp;
memcpy(&Tmp, &val, 4);
big_int32 TmpToWrite(Tmp);
output.writeFully(&TmpToWrite.endian(), GetSize());
} else if (GetSize() == 8) {
double val = Value;
int64 Tmp;
memcpy(&Tmp, &val, 8);
big_int64 TmpToWrite(Tmp);
output.writeFully(&TmpToWrite.endian(), GetSize());
}
return GetSize();
}
示例5: RenderData
filepos_t EbmlDate::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{
if (GetSize() != 0) {
assert(GetSize() == 8);
big_int64 b64(myDate);
output.writeFully(&b64.endian(),GetSize());
}
return GetSize();
}
示例6: RenderData
/*!
\todo handle exception on errors
*/
filepos_t EbmlString::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{
filepos_t Result;
output.writeFully(Value.c_str(), Value.length());
Result = Value.length();
if (Result < GetDefaultSize()) {
// pad the rest with 0
binary *Pad = new (std::nothrow) binary[GetDefaultSize() - Result];
if (Pad == NULL) {
return Result;
}
memset(Pad, 0x00, GetDefaultSize() - Result);
output.writeFully(Pad, GetDefaultSize() - Result);
Result = GetDefaultSize();
delete [] Pad;
}
return Result;
}
示例7: RenderData
/*!
\todo handle exception on errors
\todo handle 10 bits precision
*/
uint32 EbmlFloat::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
{
assert(Size == 4 || Size == 8);
if (Size == 4) {
float val = Value;
int Tmp;
memcpy(&Tmp, &val, 4);
big_int32 TmpToWrite(Tmp);
output.writeFully(&TmpToWrite.endian(), Size);
} else if (Size == 8) {
double val = Value;
int64 Tmp;
memcpy(&Tmp, &val, 8);
big_int64 TmpToWrite(Tmp);
output.writeFully(&TmpToWrite.endian(), Size);
}
return Size;
}
示例8: RenderData
/*!
\todo handle exception on errors
*/
uint32 EbmlString::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
{
uint32 Result;
output.writeFully(Value.c_str(), Value.length());
Result = Value.length();
if (Result < DefaultSize) {
// pad the rest with 0
binary *Pad = new binary[DefaultSize - Result];
if (Pad == NULL)
{
return Result;
}
memset(Pad, 0x00, DefaultSize - Result);
output.writeFully(Pad, DefaultSize - Result);
Result = DefaultSize;
delete [] Pad;
}
return Result;
}
示例9: GetDefaultSize
filepos_t EbmlCrc32::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{
filepos_t Result = 4;
if (Result != 0) {
output.writeFully(&m_crc_final, Result);
}
if (Result < GetDefaultSize()) {
// pad the rest with 0
binary *Pad = new binary[GetDefaultSize() - Result];
if (Pad != NULL) {
memset(Pad, 0x00, GetDefaultSize() - Result);
output.writeFully(Pad, GetDefaultSize() - Result);
Result = GetDefaultSize();
delete [] Pad;
}
}
return Result;
}
示例10: RenderData
/*!
\todo handle exception on errors
*/
uint32 EbmlUInteger::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
{
binary FinalData[8]; // we don't handle more than 64 bits integers
if (SizeLength > 8)
return 0; // integer bigger coded on more than 64 bits are not supported
uint64 TempValue = Value;
for (unsigned int i=0; i<Size;i++) {
FinalData[Size-i-1] = TempValue & 0xFF;
TempValue >>= 8;
}
output.writeFully(FinalData,Size);
return Size;
}
示例11: RenderData
/*!
\todo handle exception on errors
*/
filepos_t EbmlUInteger::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{
binary FinalData[8]; // we don't handle more than 64 bits integers
if (GetSizeLength() > 8)
return 0; // integer bigger coded on more than 64 bits are not supported
uint64 TempValue = Value;
for (unsigned int i=0; i<GetSize();i++) {
FinalData[GetSize()-i-1] = TempValue & 0xFF;
TempValue >>= 8;
}
output.writeFully(FinalData,GetSize());
return GetSize();
}
示例12: RenderData
/*!
\todo more optimisation is possible (render the Block head and don't copy the buffer in memory, care should be taken with the allocation of Data)
\todo the actual timecode to write should be retrieved from the Cluster from here
*/
filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault)
{
if (myBuffers.size() == 0) {
return 0;
} else {
assert(TrackNumber < 0x4000);
binary BlockHead[5], *cursor = BlockHead;
unsigned int i;
if (myBuffers.size() == 1) {
SetSize_(4);
mLacing = LACING_NONE;
} else {
if (mLacing == LACING_NONE)
mLacing = LACING_EBML; // supposedly the best of all
SetSize_(4 + 1); // 1 for the lacing head (number of laced elements)
}
if (TrackNumber > 0x80)
SetSize_(GetSize() + 1);
// write Block Head
if (TrackNumber < 0x80) {
*cursor++ = TrackNumber | 0x80; // set the first bit to 1
} else {
*cursor++ = (TrackNumber >> 8) | 0x40; // set the second bit to 1
*cursor++ = TrackNumber & 0xFF;
}
assert(ParentCluster != NULL);
int16 ActualTimecode = ParentCluster->GetBlockLocalTimecode(Timecode);
big_int16 b16(ActualTimecode);
b16.Fill(cursor);
cursor += 2;
*cursor = 0; // flags
if (mLacing == LACING_AUTO) {
mLacing = GetBestLacingType();
}
// invisible flag
if (mInvisible)
*cursor = 0x08;
if (bIsSimple) {
if (bIsKeyframe)
*cursor |= 0x80;
if (bIsDiscardable)
*cursor |= 0x01;
}
// lacing flag
switch (mLacing)
{
case LACING_XIPH:
*cursor++ |= 0x02;
break;
case LACING_EBML:
*cursor++ |= 0x06;
break;
case LACING_FIXED:
*cursor++ |= 0x04;
break;
case LACING_NONE:
break;
default:
assert(0);
}
output.writeFully(BlockHead, 4 + ((TrackNumber > 0x80) ? 1 : 0));
binary tmpValue;
switch (mLacing)
{
case LACING_XIPH:
// number of laces
tmpValue = myBuffers.size()-1;
output.writeFully(&tmpValue, 1);
// set the size of each member in the lace
for (i=0; i<myBuffers.size()-1; i++) {
tmpValue = 0xFF;
uint16 tmpSize = myBuffers[i]->Size();
while (tmpSize >= 0xFF) {
output.writeFully(&tmpValue, 1);
SetSize_(GetSize() + 1);
tmpSize -= 0xFF;
}
tmpValue = binary(tmpSize);
output.writeFully(&tmpValue, 1);
SetSize_(GetSize() + 1);
}
break;
case LACING_EBML:
// number of laces
tmpValue = myBuffers.size()-1;
//.........这里部分代码省略.........
示例13: RenderData
filepos_t EbmlBinary::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{
output.writeFully(Data,GetSize());
return GetSize();
}