From b95a4104aa06691f6465a884063e2a0fbaba6257 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 4 Sep 2012 07:36:48 +0000 Subject: [PATCH] Provide GetValue() and SetValue() functions for EbmlFloat/SInteger/UInteger git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@840 a6f86f6d-0131-4f8e-9e7b-e335508773d5 --- ebml/EbmlFloat.h | 3 +++ ebml/EbmlSInteger.h | 3 +++ ebml/EbmlUInteger.h | 3 +++ src/EbmlFloat.cpp | 5 +++++ src/EbmlSInteger.cpp | 6 ++++++ src/EbmlUInteger.cpp | 5 +++++ 6 files changed, 25 insertions(+) diff --git a/ebml/EbmlFloat.h b/ebml/EbmlFloat.h index 540ee1a..24fcb46 100644 --- a/ebml/EbmlFloat.h +++ b/ebml/EbmlFloat.h @@ -82,6 +82,9 @@ class EBML_DLL_API EbmlFloat : public EbmlElement { operator float() const; operator double() const; + EbmlFloat &SetValue(double NewValue); + double GetValue() const; + void SetDefaultValue(double); double DefaultVal() const; diff --git a/ebml/EbmlSInteger.h b/ebml/EbmlSInteger.h index 62fed03..ec670e0 100644 --- a/ebml/EbmlSInteger.h +++ b/ebml/EbmlSInteger.h @@ -76,6 +76,9 @@ class EBML_DLL_API EbmlSInteger : public EbmlElement { operator int32() const; operator int64() const; + EbmlSInteger &SetValue(int64 NewValue); + int64 GetValue() const; + void SetDefaultValue(int64 aValue) {assert(!DefaultISset()); DefaultValue = aValue; SetDefaultIsSet();} int64 DefaultVal() const {assert(DefaultISset()); return DefaultValue;} diff --git a/ebml/EbmlUInteger.h b/ebml/EbmlUInteger.h index 9f83ffb..1d01a4a 100644 --- a/ebml/EbmlUInteger.h +++ b/ebml/EbmlUInteger.h @@ -74,6 +74,9 @@ class EBML_DLL_API EbmlUInteger : public EbmlElement { operator uint32() const; operator uint64() const; + EbmlUInteger &SetValue(uint64 NewValue); + uint64 GetValue() const; + void SetDefaultValue(uint64); uint64 DefaultVal() const; diff --git a/src/EbmlFloat.cpp b/src/EbmlFloat.cpp index d84cbf3..6b184ef 100644 --- a/src/EbmlFloat.cpp +++ b/src/EbmlFloat.cpp @@ -76,6 +76,11 @@ double EbmlFloat::DefaultVal() const EbmlFloat::operator float() const {return float(Value);} EbmlFloat::operator double() const {return double(Value);} +double EbmlFloat::GetValue() const {return Value;} + +EbmlFloat & EbmlFloat::SetValue(double NewValue) { + return *this = NewValue; +} /*! \todo handle exception on errors diff --git a/src/EbmlSInteger.cpp b/src/EbmlSInteger.cpp index 9da6704..4adc93b 100644 --- a/src/EbmlSInteger.cpp +++ b/src/EbmlSInteger.cpp @@ -60,6 +60,12 @@ EbmlSInteger::operator int16() const {return int16(Value);} EbmlSInteger::operator int32() const {return int32(Value);} EbmlSInteger::operator int64() const {return Value;} +int64 EbmlSInteger::GetValue() const {return Value;} + +EbmlSInteger & EbmlSInteger::SetValue(int64 NewValue) { + return *this = NewValue; +} + /*! \todo handle exception on errors */ diff --git a/src/EbmlUInteger.cpp b/src/EbmlUInteger.cpp index 452e8fd..1bc6267 100644 --- a/src/EbmlUInteger.cpp +++ b/src/EbmlUInteger.cpp @@ -75,6 +75,11 @@ EbmlUInteger::operator uint16() const {return uint16(Value);} EbmlUInteger::operator uint32() const {return uint32(Value);} EbmlUInteger::operator uint64() const {return Value;} +uint64 EbmlUInteger::GetValue() const {return Value;} + +EbmlUInteger & EbmlUInteger::SetValue(uint64 NewValue) { + return *this = NewValue; +} /*! \todo handle exception on errors