Skip to content

Commit

Permalink
remove operator= base types
Browse files Browse the repository at this point in the history
It requires a complicated assigment syntax for a simple thing.
  • Loading branch information
robUx4 committed Dec 31, 2023
1 parent 6855edd commit 36f028d
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 33 deletions.
3 changes: 0 additions & 3 deletions ebml/EbmlFloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ class EBML_DLL_API EbmlFloat : public EbmlElement {
}


// EbmlFloat & operator=(const float NewValue) { Value = NewValue; return *this;}
EbmlFloat & operator=(const double NewValue) { Value = NewValue; SetValueIsSet(); return *this;}

bool IsSmallerThan(const EbmlElement *Cmp) const override;

using EbmlElement::operator const EbmlId &;
Expand Down
2 changes: 0 additions & 2 deletions ebml/EbmlSInteger.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class EBML_DLL_API EbmlSInteger : public EbmlElement {
EbmlSInteger(const EbmlCallbacks &);
explicit EbmlSInteger(const EbmlCallbacks &, std::int64_t DefaultValue);

EbmlSInteger & operator = (std::int64_t NewValue) {Value = NewValue; SetValueIsSet(); return *this;}

/*!
Set the default size of the integer (usually 1,2,4 or 8)
*/
Expand Down
1 change: 0 additions & 1 deletion ebml/EbmlString.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class EBML_DLL_API EbmlString : public EbmlElement {
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;
filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;

EbmlString & operator=(const std::string &);
using EbmlElement::operator const EbmlId &;
explicit operator const std::string &() const;

Expand Down
2 changes: 0 additions & 2 deletions ebml/EbmlUInteger.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ class EBML_DLL_API EbmlUInteger : public EbmlElement {
EbmlUInteger(const EbmlCallbacks &);
explicit EbmlUInteger(const EbmlCallbacks &, std::uint64_t DefaultValue);

EbmlUInteger & operator=(std::uint64_t NewValue) {Value = NewValue; SetValueIsSet(); return *this;}

/*!
Set the default size of the integer (usually 1,2,4 or 8)
*/
Expand Down
1 change: 0 additions & 1 deletion ebml/EbmlUnicodeString.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class EBML_DLL_API EbmlUnicodeString : public EbmlElement {
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;
filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;

EbmlUnicodeString & operator=(const UTFstring &); ///< platform dependant code
using EbmlElement::operator const EbmlId &;
explicit operator const UTFstring &() const;

Expand Down
4 changes: 3 additions & 1 deletion src/EbmlFloat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ EbmlFloat::operator double() const {return (Value);}
double EbmlFloat::GetValue() const {return Value;}

EbmlFloat & EbmlFloat::SetValue(double NewValue) {
return *this = NewValue;
Value = NewValue;
SetValueIsSet();
return *this;
}

/*!
Expand Down
4 changes: 3 additions & 1 deletion src/EbmlSInteger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ EbmlSInteger::operator std::int64_t() const {return Value;}
std::int64_t EbmlSInteger::GetValue() const {return Value;}

EbmlSInteger & EbmlSInteger::SetValue(std::int64_t NewValue) {
return *this = NewValue;
Value = NewValue;
SetValueIsSet();
return *this;
}

/*!
Expand Down
13 changes: 2 additions & 11 deletions src/EbmlString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,12 @@ filepos_t EbmlString::RenderData(IOCallback & output, bool /* bForceRender */, S

EbmlString::operator const std::string &() const {return Value;}

EbmlString & EbmlString::operator=(const std::string & NewString)
{
Value = NewString;
EbmlString &EbmlString::SetValue(std::string const &NewValue) {
Value = NewValue;
SetValueIsSet();
/* done automatically
SetSize_(Value.length());
if (GetDefaultSize() > GetSize())
SetSize_(GetDefaultSize());*/
return *this;
}

EbmlString &EbmlString::SetValue(std::string const &NewValue) {
return *this = NewValue;
}

std::string EbmlString::GetValue() const {
return Value;
}
Expand Down
4 changes: 3 additions & 1 deletion src/EbmlUInteger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ EbmlUInteger::operator std::uint64_t() const {return Value;}
std::uint64_t EbmlUInteger::GetValue() const {return Value;}

EbmlUInteger & EbmlUInteger::SetValue(std::uint64_t NewValue) {
return *this = NewValue;
Value = NewValue;
SetValueIsSet();
return *this;
}

/*!
Expand Down
15 changes: 5 additions & 10 deletions src/EbmlUnicodeString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,16 @@ filepos_t EbmlUnicodeString::RenderData(IOCallback & output, bool /* bForceRende

EbmlUnicodeString::operator const UTFstring &() const {return Value;}

EbmlUnicodeString & EbmlUnicodeString::operator=(const UTFstring & NewString)
{
Value = NewString;
EbmlUnicodeString &EbmlUnicodeString::SetValue(UTFstring const &NewValue) {
Value = NewValue;
SetValueIsSet();
return *this;
}

EbmlUnicodeString &EbmlUnicodeString::SetValue(UTFstring const &NewValue) {
return *this = NewValue;
}

EbmlUnicodeString &EbmlUnicodeString::SetValueUTF8(std::string const &NewValue) {
UTFstring NewValueUTFstring;
NewValueUTFstring.SetUTF8(NewValue);
return *this = NewValueUTFstring;
Value.SetUTF8(NewValue);
SetValueIsSet();
return *this;
}

UTFstring EbmlUnicodeString::GetValue() const {
Expand Down

0 comments on commit 36f028d

Please sign in to comment.