v1/v2: rename bKeepIntact to bWithDefault for more clarity in the API
git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@123 a6f86f6d-0131-4f8e-9e7b-e335508773d5
This commit is contained in:
parent
be6a37df06
commit
769a6c3ab7
@ -64,9 +64,9 @@ class EBML_DLL_API EbmlBinary : public EbmlElement {
|
||||
|
||||
virtual bool ValidateSize() const {return true;} // we don't mind about what's inside
|
||||
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
|
||||
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||
filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false);
|
||||
|
||||
void SetBuffer(const binary *Buffer, const uint32 BufferSize) {
|
||||
Data = (binary *) Buffer;
|
||||
|
@ -58,9 +58,9 @@ DECLARE_EBML_BINARY(EbmlCrc32)
|
||||
public:
|
||||
EbmlCrc32(const EbmlCrc32 & ElementToClone);
|
||||
virtual bool ValidateSize() const {return (GetSize() == 4);}
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
|
||||
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||
// filepos_t UpdateSize(bool bKeepIntact = false);
|
||||
// filepos_t UpdateSize(bool bWithDefault = false);
|
||||
|
||||
bool IsDefaultValue() const {
|
||||
return false;
|
||||
|
@ -65,7 +65,7 @@ class EBML_DLL_API EbmlDate : public EbmlElement {
|
||||
/*!
|
||||
\note no Default date handled
|
||||
*/
|
||||
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false) {
|
||||
filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false) {
|
||||
if(!ValueIsSet())
|
||||
SetSize_(0);
|
||||
else
|
||||
@ -86,7 +86,7 @@ class EBML_DLL_API EbmlDate : public EbmlElement {
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
|
||||
|
||||
int64 myDate; ///< internal format of the date
|
||||
|
||||
|
@ -384,11 +384,11 @@ class EBML_DLL_API EbmlElement {
|
||||
return ElementPosition;
|
||||
}
|
||||
|
||||
uint64 ElementSize(bool bKeepIntact = false) const; /// return the size of the header+data, before writing
|
||||
uint64 ElementSize(bool bWithDefault = false) const; /// return the size of the header+data, before writing
|
||||
|
||||
filepos_t Render(IOCallback & output, bool bKeepIntact = false, bool bKeepPosition = false, bool bForceRender = false);
|
||||
filepos_t Render(IOCallback & output, bool bWithDefault = false, bool bKeepPosition = false, bool bForceRender = false);
|
||||
|
||||
virtual filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false) = 0; /// update the Size of the Data stored
|
||||
virtual filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false) = 0; /// update the Size of the Data stored
|
||||
virtual filepos_t GetSize() const {return Size;} /// return the size of the data stored in the element, on reading
|
||||
|
||||
virtual filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) = 0;
|
||||
@ -421,7 +421,7 @@ class EBML_DLL_API EbmlElement {
|
||||
/*!
|
||||
\brief void the content of the element (replace by EbmlVoid)
|
||||
*/
|
||||
uint32 VoidMe(IOCallback & output, bool bKeepIntact = false);
|
||||
uint32 VoidMe(IOCallback & output, bool bWithDefault = false);
|
||||
|
||||
bool DefaultISset() const {return DefaultIsSet;}
|
||||
virtual bool IsDefaultValue() const = 0;
|
||||
@ -445,13 +445,13 @@ class EBML_DLL_API EbmlElement {
|
||||
*/
|
||||
static EbmlElement *CreateElementUsingContext(const EbmlId & aID, const EbmlSemanticContext & Context, int & LowLevel, bool IsGlobalContext, bool bAllowDummy = false, unsigned int MaxLowerLevel = 1);
|
||||
|
||||
filepos_t RenderHead(IOCallback & output, bool bForceRender, bool bKeepIntact = false, bool bKeepPosition = false);
|
||||
filepos_t RenderHead(IOCallback & output, bool bForceRender, bool bWithDefault = false, bool bKeepPosition = false);
|
||||
filepos_t MakeRenderHead(IOCallback & output, bool bKeepPosition);
|
||||
|
||||
/*!
|
||||
\brief prepare the data before writing them (in case it's not already done by default)
|
||||
*/
|
||||
virtual filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false) = 0;
|
||||
virtual filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false) = 0;
|
||||
|
||||
/*!
|
||||
\brief special constructor for cloning
|
||||
|
@ -61,9 +61,9 @@ class EBML_DLL_API EbmlFloat : public EbmlElement {
|
||||
return (GetSize() == 4 || GetSize() == 8);
|
||||
}
|
||||
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
|
||||
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||
filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false);
|
||||
|
||||
void SetPrecision(const EbmlFloat::Precision prec = FLOAT_32)
|
||||
{
|
||||
|
@ -63,9 +63,9 @@ class EBML_DLL_API EbmlMaster : public EbmlElement {
|
||||
*/
|
||||
virtual ~EbmlMaster();
|
||||
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
|
||||
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully);
|
||||
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||
filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false);
|
||||
|
||||
/*!
|
||||
\brief Set wether the size is finite (size is known in advance when writing, or infinite size is not known on writing)
|
||||
@ -150,7 +150,7 @@ class EBML_DLL_API EbmlMaster : public EbmlElement {
|
||||
\brief facility for Master elements to write only the head and force the size later
|
||||
\warning
|
||||
*/
|
||||
filepos_t WriteHead(IOCallback & output, int SizeLength, bool bKeepIntact = false);
|
||||
filepos_t WriteHead(IOCallback & output, int SizeLength, bool bWithDefault = false);
|
||||
|
||||
void EnableChecksum(bool bIsEnabled = true) { bChecksumUsed = bIsEnabled; }
|
||||
bool HasChecksum() const {return bChecksumUsed;}
|
||||
|
@ -65,9 +65,9 @@ class EBML_DLL_API EbmlSInteger : public EbmlElement {
|
||||
virtual void SetDefaultSize(uint64 nDefaultSize = DEFAULT_INT_SIZE) {SetSize_(nDefaultSize);}
|
||||
|
||||
virtual bool ValidateSize() const {return (GetSize() <= 8);}
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
|
||||
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||
filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false);
|
||||
|
||||
virtual bool IsSmallerThan(const EbmlElement *Cmp) const;
|
||||
|
||||
|
@ -56,9 +56,9 @@ class EBML_DLL_API EbmlString : public EbmlElement {
|
||||
virtual ~EbmlString() {}
|
||||
|
||||
virtual bool ValidateSize() const {return true;} // any size is possible
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
|
||||
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||
filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false);
|
||||
|
||||
EbmlString & operator=(const std::string &);
|
||||
operator const std::string &() const {return Value;}
|
||||
|
@ -63,9 +63,9 @@ class EBML_DLL_API EbmlUInteger : public EbmlElement {
|
||||
virtual void SetDefaultSize(uint64 nDefaultSize = DEFAULT_UINT_SIZE) {SetSize_(nDefaultSize);}
|
||||
|
||||
virtual bool ValidateSize() const {return (GetSize() <= 8);}
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
|
||||
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||
filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false);
|
||||
|
||||
virtual bool IsSmallerThan(const EbmlElement *Cmp) const;
|
||||
|
||||
|
@ -105,9 +105,9 @@ class EBML_DLL_API EbmlUnicodeString : public EbmlElement {
|
||||
virtual ~EbmlUnicodeString() {}
|
||||
|
||||
virtual bool ValidateSize() const {return true;} // any size is possible
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
|
||||
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||
filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false);
|
||||
|
||||
EbmlUnicodeString & operator=(const UTFstring &); ///< platform dependant code
|
||||
operator const UTFstring &() const {return Value;}
|
||||
|
@ -53,17 +53,17 @@ DECLARE_EBML_BINARY(EbmlVoid)
|
||||
/*!
|
||||
\note overwrite to write fake data
|
||||
*/
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
|
||||
|
||||
/*!
|
||||
\brief Replace the void element content (written) with this one
|
||||
*/
|
||||
uint64 ReplaceWith(EbmlElement & EltToReplaceWith, IOCallback & output, bool ComeBackAfterward = true, bool bKeepIntact = false);
|
||||
uint64 ReplaceWith(EbmlElement & EltToReplaceWith, IOCallback & output, bool ComeBackAfterward = true, bool bWithDefault = false);
|
||||
|
||||
/*!
|
||||
\brief Void the content of an element
|
||||
*/
|
||||
uint64 Overwrite(const EbmlElement & EltToVoid, IOCallback & output, bool ComeBackAfterward = true, bool bKeepIntact = false);
|
||||
uint64 Overwrite(const EbmlElement & EltToVoid, IOCallback & output, bool ComeBackAfterward = true, bool bWithDefault = false);
|
||||
|
||||
EBML_CONCRETE_CLASS(EbmlVoid)
|
||||
};
|
||||
|
@ -61,7 +61,7 @@ EbmlBinary::~EbmlBinary(void) {
|
||||
free(Data);
|
||||
}
|
||||
|
||||
filepos_t EbmlBinary::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||
filepos_t EbmlBinary::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault)
|
||||
{
|
||||
output.writeFully(Data,GetSize());
|
||||
|
||||
@ -71,7 +71,7 @@ filepos_t EbmlBinary::RenderData(IOCallback & output, bool bForceRender, bool bK
|
||||
/*!
|
||||
\note no Default binary value handled
|
||||
*/
|
||||
uint64 EbmlBinary::UpdateSize(bool bKeepIntact, bool bForceRender)
|
||||
uint64 EbmlBinary::UpdateSize(bool bWithDefault, bool bForceRender)
|
||||
{
|
||||
return GetSize();
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ bool EbmlCrc32::CheckElementCRC32(EbmlElement &ElementToCRC)
|
||||
return CheckCRC(m_crc_final, memoryBuffer.GetDataBuffer(), memoryBuffer.GetDataBufferSize());
|
||||
};
|
||||
|
||||
filepos_t EbmlCrc32::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||
filepos_t EbmlCrc32::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault)
|
||||
{
|
||||
filepos_t Result = DIGESTSIZE;
|
||||
|
||||
|
@ -65,7 +65,7 @@ filepos_t EbmlDate::ReadData(IOCallback & input, ScopeMode ReadFully)
|
||||
return GetSize();
|
||||
}
|
||||
|
||||
filepos_t EbmlDate::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||
filepos_t EbmlDate::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault)
|
||||
{
|
||||
if (GetSize() != 0) {
|
||||
assert(GetSize() == 8);
|
||||
|
@ -573,19 +573,19 @@ EbmlElement *EbmlElement::CreateElementUsingContext(const EbmlId & aID, const Eb
|
||||
/*!
|
||||
\todo verify that the size written is the same as the data written
|
||||
*/
|
||||
filepos_t EbmlElement::Render(IOCallback & output, bool bKeepIntact, bool bKeepPosition, bool bForceRender)
|
||||
filepos_t EbmlElement::Render(IOCallback & output, bool bWithDefault, bool bKeepPosition, bool bForceRender)
|
||||
{
|
||||
assert(bValueIsSet || (bKeepIntact && DefaultISset())); // an element is been rendered without a value set !!!
|
||||
assert(bValueIsSet || (bWithDefault && DefaultISset())); // an element is been rendered without a value set !!!
|
||||
// it may be a mandatory element without a default value
|
||||
try {
|
||||
if (!bKeepIntact && IsDefaultValue()) {
|
||||
if (!bWithDefault && IsDefaultValue()) {
|
||||
return 0;
|
||||
}
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
uint64 SupposedSize = UpdateSize(bKeepIntact, bForceRender);
|
||||
uint64 SupposedSize = UpdateSize(bWithDefault, bForceRender);
|
||||
#endif // _DEBUG
|
||||
filepos_t result = RenderHead(output, bForceRender, bKeepIntact, bKeepPosition);
|
||||
uint64 WrittenSize = RenderData(output, bForceRender, bKeepIntact);
|
||||
filepos_t result = RenderHead(output, bForceRender, bWithDefault, bKeepPosition);
|
||||
uint64 WrittenSize = RenderData(output, bForceRender, bWithDefault);
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
if (SupposedSize != (0-1)) assert(WrittenSize == SupposedSize);
|
||||
#endif // DEBUG
|
||||
@ -603,12 +603,12 @@ filepos_t EbmlElement::Render(IOCallback & output, bool bKeepIntact, bool bKeepP
|
||||
\todo handle exceptions on errors
|
||||
\todo handle CodeSize bigger than 5 bytes
|
||||
*/
|
||||
filepos_t EbmlElement::RenderHead(IOCallback & output, bool bForceRender, bool bKeepIntact, bool bKeepPosition)
|
||||
filepos_t EbmlElement::RenderHead(IOCallback & output, bool bForceRender, bool bWithDefault, bool bKeepPosition)
|
||||
{
|
||||
if (EBML_ID_LENGTH(EbmlId(*this)) <= 0 || EBML_ID_LENGTH(EbmlId(*this)) > 4)
|
||||
return 0;
|
||||
|
||||
UpdateSize(bKeepIntact, bForceRender);
|
||||
UpdateSize(bWithDefault, bForceRender);
|
||||
|
||||
return MakeRenderHead(output, bKeepPosition);
|
||||
}
|
||||
@ -634,9 +634,9 @@ filepos_t EbmlElement::MakeRenderHead(IOCallback & output, bool bKeepPosition)
|
||||
return FinalHeadSize;
|
||||
}
|
||||
|
||||
uint64 EbmlElement::ElementSize(bool bKeepIntact) const
|
||||
uint64 EbmlElement::ElementSize(bool bWithDefault) const
|
||||
{
|
||||
if (!bKeepIntact && IsDefaultValue())
|
||||
if (!bWithDefault && IsDefaultValue())
|
||||
return 0; // won't be saved
|
||||
return Size + EBML_ID_LENGTH(EbmlId(*this)) + CodedSizeLength(Size, SizeLength, bSizeIsFinite);
|
||||
}
|
||||
@ -692,14 +692,14 @@ filepos_t EbmlElement::OverwriteHead(IOCallback & output, bool bKeepPosition)
|
||||
return Result;
|
||||
}
|
||||
|
||||
uint32 EbmlElement::VoidMe(IOCallback & output, bool bKeepIntact)
|
||||
uint32 EbmlElement::VoidMe(IOCallback & output, bool bWithDefault)
|
||||
{
|
||||
if (ElementPosition == 0) {
|
||||
return 0; // the element has not been written
|
||||
}
|
||||
|
||||
EbmlVoid Dummy;
|
||||
return Dummy.Overwrite(*this, output, bKeepIntact);
|
||||
return Dummy.Overwrite(*this, output, bWithDefault);
|
||||
}
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
@ -78,7 +78,7 @@ const double EbmlFloat::DefaultVal() const
|
||||
\todo handle exception on errors
|
||||
\todo handle 10 bits precision
|
||||
*/
|
||||
filepos_t EbmlFloat::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||
filepos_t EbmlFloat::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault)
|
||||
{
|
||||
assert(GetSize() == 4 || GetSize() == 8);
|
||||
|
||||
@ -99,9 +99,9 @@ filepos_t EbmlFloat::RenderData(IOCallback & output, bool bForceRender, bool bKe
|
||||
return GetSize();
|
||||
}
|
||||
|
||||
uint64 EbmlFloat::UpdateSize(bool bKeepIntact, bool bForceRender)
|
||||
uint64 EbmlFloat::UpdateSize(bool bWithDefault, bool bForceRender)
|
||||
{
|
||||
if (!bKeepIntact && IsDefaultValue())
|
||||
if (!bWithDefault && IsDefaultValue())
|
||||
return 0;
|
||||
return GetSize();
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ EbmlMaster::~EbmlMaster()
|
||||
\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 bKeepIntact)
|
||||
filepos_t EbmlMaster::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault)
|
||||
{
|
||||
filepos_t Result = 0;
|
||||
size_t Index;
|
||||
@ -98,16 +98,16 @@ filepos_t EbmlMaster::RenderData(IOCallback & output, bool bForceRender, bool bK
|
||||
|
||||
if (!bChecksumUsed) { // old school
|
||||
for (Index = 0; Index < ElementList.size(); Index++) {
|
||||
if (!bKeepIntact && (ElementList[Index])->IsDefaultValue())
|
||||
if (!bWithDefault && (ElementList[Index])->IsDefaultValue())
|
||||
continue;
|
||||
Result += (ElementList[Index])->Render(output, bKeepIntact, false ,bForceRender);
|
||||
Result += (ElementList[Index])->Render(output, bWithDefault, false ,bForceRender);
|
||||
}
|
||||
} else { // new school
|
||||
MemIOCallback TmpBuf(GetSize() - 6);
|
||||
for (Index = 0; Index < ElementList.size(); Index++) {
|
||||
if (!bKeepIntact && (ElementList[Index])->IsDefaultValue())
|
||||
if (!bWithDefault && (ElementList[Index])->IsDefaultValue())
|
||||
continue;
|
||||
(ElementList[Index])->Render(TmpBuf, bKeepIntact, false ,bForceRender);
|
||||
(ElementList[Index])->Render(TmpBuf, bWithDefault, false ,bForceRender);
|
||||
}
|
||||
Checksum.FillCRC32(TmpBuf.GetDataBuffer(), TmpBuf.GetDataBufferSize());
|
||||
Result += Checksum.Render(output, true, false ,bForceRender);
|
||||
@ -127,7 +127,7 @@ bool EbmlMaster::PushElement(EbmlElement & element)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64 EbmlMaster::UpdateSize(bool bKeepIntact, bool bForceRender)
|
||||
uint64 EbmlMaster::UpdateSize(bool bWithDefault, bool bForceRender)
|
||||
{
|
||||
SetSize_(0);
|
||||
|
||||
@ -141,10 +141,10 @@ uint64 EbmlMaster::UpdateSize(bool bKeepIntact, bool bForceRender)
|
||||
size_t Index;
|
||||
|
||||
for (Index = 0; Index < ElementList.size(); Index++) {
|
||||
if (!bKeepIntact && (ElementList[Index])->IsDefaultValue())
|
||||
if (!bWithDefault && (ElementList[Index])->IsDefaultValue())
|
||||
continue;
|
||||
(ElementList[Index])->UpdateSize(bKeepIntact, bForceRender);
|
||||
uint64 SizeToAdd = (ElementList[Index])->ElementSize(bKeepIntact);
|
||||
(ElementList[Index])->UpdateSize(bWithDefault, bForceRender);
|
||||
uint64 SizeToAdd = (ElementList[Index])->ElementSize(bWithDefault);
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
if (SizeToAdd == (0-1))
|
||||
return (0-1);
|
||||
@ -158,10 +158,10 @@ uint64 EbmlMaster::UpdateSize(bool bKeepIntact, bool bForceRender)
|
||||
return GetSize();
|
||||
}
|
||||
|
||||
filepos_t EbmlMaster::WriteHead(IOCallback & output, int nSizeLength, bool bKeepIntact)
|
||||
filepos_t EbmlMaster::WriteHead(IOCallback & output, int nSizeLength, bool bWithDefault)
|
||||
{
|
||||
SetSizeLength(nSizeLength);
|
||||
return RenderHead(output, false, bKeepIntact);
|
||||
return RenderHead(output, false, bWithDefault);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -58,7 +58,7 @@ EbmlSInteger::EbmlSInteger(const EbmlSInteger & ElementToClone)
|
||||
/*!
|
||||
\todo handle exception on errors
|
||||
*/
|
||||
filepos_t EbmlSInteger::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||
filepos_t EbmlSInteger::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault)
|
||||
{
|
||||
binary FinalData[8]; // we don't handle more than 64 bits integers
|
||||
unsigned int i;
|
||||
@ -77,9 +77,9 @@ filepos_t EbmlSInteger::RenderData(IOCallback & output, bool bForceRender, bool
|
||||
return GetSize();
|
||||
}
|
||||
|
||||
uint64 EbmlSInteger::UpdateSize(bool bKeepIntact, bool bForceRender)
|
||||
uint64 EbmlSInteger::UpdateSize(bool bWithDefault, bool bForceRender)
|
||||
{
|
||||
if (!bKeepIntact && IsDefaultValue())
|
||||
if (!bWithDefault && IsDefaultValue())
|
||||
return 0;
|
||||
|
||||
if (Value <= 0x7F && Value >= (-0x80)) {
|
||||
|
@ -87,7 +87,7 @@ const std::string & EbmlString::DefaultVal() const
|
||||
/*!
|
||||
\todo handle exception on errors
|
||||
*/
|
||||
filepos_t EbmlString::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||
filepos_t EbmlString::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault)
|
||||
{
|
||||
filepos_t Result;
|
||||
output.writeFully(Value.c_str(), Value.length());
|
||||
@ -120,9 +120,9 @@ EbmlString & EbmlString::operator=(const std::string & NewString)
|
||||
return *this;
|
||||
}
|
||||
|
||||
uint64 EbmlString::UpdateSize(bool bKeepIntact, bool bForceRender)
|
||||
uint64 EbmlString::UpdateSize(bool bWithDefault, bool bForceRender)
|
||||
{
|
||||
if (!bKeepIntact && IsDefaultValue())
|
||||
if (!bWithDefault && IsDefaultValue())
|
||||
return 0;
|
||||
|
||||
if (Value.length() < GetDefaultSize()) {
|
||||
|
@ -74,7 +74,7 @@ const uint64 EbmlUInteger::DefaultVal() const
|
||||
/*!
|
||||
\todo handle exception on errors
|
||||
*/
|
||||
filepos_t EbmlUInteger::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||
filepos_t EbmlUInteger::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault)
|
||||
{
|
||||
binary FinalData[8]; // we don't handle more than 64 bits integers
|
||||
|
||||
@ -92,9 +92,9 @@ filepos_t EbmlUInteger::RenderData(IOCallback & output, bool bForceRender, bool
|
||||
return GetSize();
|
||||
}
|
||||
|
||||
uint64 EbmlUInteger::UpdateSize(bool bKeepIntact, bool bForceRender)
|
||||
uint64 EbmlUInteger::UpdateSize(bool bWithDefault, bool bForceRender)
|
||||
{
|
||||
if (!bKeepIntact && IsDefaultValue())
|
||||
if (!bWithDefault && IsDefaultValue())
|
||||
return 0;
|
||||
|
||||
if (Value <= 0xFF) {
|
||||
|
@ -242,7 +242,7 @@ const UTFstring & EbmlUnicodeString::DefaultVal() const
|
||||
\note limited to UCS-2
|
||||
\todo handle exception on errors
|
||||
*/
|
||||
filepos_t EbmlUnicodeString::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||
filepos_t EbmlUnicodeString::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault)
|
||||
{
|
||||
uint32 Result = Value.GetUTF8().length();
|
||||
|
||||
@ -275,9 +275,9 @@ EbmlUnicodeString & EbmlUnicodeString::operator=(const UTFstring & NewString)
|
||||
/*!
|
||||
\note limited to UCS-2
|
||||
*/
|
||||
uint64 EbmlUnicodeString::UpdateSize(bool bKeepIntact, bool bForceRender)
|
||||
uint64 EbmlUnicodeString::UpdateSize(bool bWithDefault, bool bForceRender)
|
||||
{
|
||||
if (!bKeepIntact && IsDefaultValue())
|
||||
if (!bWithDefault && IsDefaultValue())
|
||||
return 0;
|
||||
|
||||
SetSize_(Value.GetUTF8().length());
|
||||
|
@ -45,7 +45,7 @@ EbmlVoid::EbmlVoid()
|
||||
SetValueIsSet();
|
||||
}
|
||||
|
||||
filepos_t EbmlVoid::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||
filepos_t EbmlVoid::RenderData(IOCallback & output, bool bForceRender, bool bWithDefault)
|
||||
{
|
||||
// write dummy data by 4KB chunks
|
||||
static binary DummyBuf[4*1024];
|
||||
@ -60,9 +60,9 @@ filepos_t EbmlVoid::RenderData(IOCallback & output, bool bForceRender, bool bKee
|
||||
return GetSize();
|
||||
}
|
||||
|
||||
uint64 EbmlVoid::ReplaceWith(EbmlElement & EltToReplaceWith, IOCallback & output, bool ComeBackAfterward, bool bKeepIntact)
|
||||
uint64 EbmlVoid::ReplaceWith(EbmlElement & EltToReplaceWith, IOCallback & output, bool ComeBackAfterward, bool bWithDefault)
|
||||
{
|
||||
EltToReplaceWith.UpdateSize(bKeepIntact);
|
||||
EltToReplaceWith.UpdateSize(bWithDefault);
|
||||
if (HeadSize() + GetSize() < EltToReplaceWith.GetSize() + EltToReplaceWith.HeadSize()) {
|
||||
// the element can't be written here !
|
||||
return INVALID_FILEPOS_T;
|
||||
@ -75,7 +75,7 @@ uint64 EbmlVoid::ReplaceWith(EbmlElement & EltToReplaceWith, IOCallback & output
|
||||
uint64 CurrentPosition = output.getFilePointer();
|
||||
|
||||
output.setFilePointer(GetElementPosition());
|
||||
EltToReplaceWith.Render(output, bKeepIntact);
|
||||
EltToReplaceWith.Render(output, bWithDefault);
|
||||
|
||||
if (HeadSize() + GetSize() - EltToReplaceWith.GetSize() - EltToReplaceWith.HeadSize() > 1) {
|
||||
// fill the rest with another void element
|
||||
@ -87,7 +87,7 @@ uint64 EbmlVoid::ReplaceWith(EbmlElement & EltToReplaceWith, IOCallback & output
|
||||
if (HeadBefore != HeadAfter) {
|
||||
aTmp.SetSizeLength(CodedSizeLength(aTmp.GetSize(), aTmp.GetSizeLength(), aTmp.IsFiniteSize()) - (HeadAfter - HeadBefore));
|
||||
}
|
||||
aTmp.RenderHead(output, false, bKeepIntact); // the rest of the data is not rewritten
|
||||
aTmp.RenderHead(output, false, bWithDefault); // the rest of the data is not rewritten
|
||||
}
|
||||
|
||||
if (ComeBackAfterward) {
|
||||
@ -97,9 +97,9 @@ uint64 EbmlVoid::ReplaceWith(EbmlElement & EltToReplaceWith, IOCallback & output
|
||||
return GetSize() + HeadSize();
|
||||
}
|
||||
|
||||
uint64 EbmlVoid::Overwrite(const EbmlElement & EltToVoid, IOCallback & output, bool ComeBackAfterward, bool bKeepIntact)
|
||||
uint64 EbmlVoid::Overwrite(const EbmlElement & EltToVoid, IOCallback & output, bool ComeBackAfterward, bool bWithDefault)
|
||||
{
|
||||
// EltToVoid.UpdateSize(bKeepIntact);
|
||||
// EltToVoid.UpdateSize(bWithDefault);
|
||||
if (EltToVoid.GetElementPosition() == 0) {
|
||||
// this element has never been written
|
||||
return 0;
|
||||
@ -125,7 +125,7 @@ uint64 EbmlVoid::Overwrite(const EbmlElement & EltToVoid, IOCallback & output, b
|
||||
}
|
||||
|
||||
if (GetSize() != 0) {
|
||||
RenderHead(output, false, bKeepIntact); // the rest of the data is not rewritten
|
||||
RenderHead(output, false, bWithDefault); // the rest of the data is not rewritten
|
||||
}
|
||||
|
||||
if (ComeBackAfterward) {
|
||||
|
Loading…
Reference in New Issue
Block a user