Skip to content

Commit

Permalink
factorize the operator to get the usable type for the non-const type
Browse files Browse the repository at this point in the history
  • Loading branch information
robUx4 committed Dec 26, 2023
1 parent ac75c2f commit 7992b73
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 6 deletions.
2 changes: 2 additions & 0 deletions ebml/EbmlElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,8 @@ class EBML_DLL_API EbmlElementDefaultStorage : public EbmlElementDefault<T> {
return Value;
}

explicit operator const S &() const { return Value; }

protected:
S Value;
};
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 EbmlElementDefaultStorage<const char *, s
filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;

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

bool operator==(const char * const & val) const override {
return val == Value;
Expand Down
1 change: 0 additions & 1 deletion ebml/EbmlUnicodeString.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class EBML_DLL_API EbmlUnicodeString : public EbmlElementDefaultStorage<const wc
filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;

using EbmlElement::operator const EbmlId &;
explicit operator const UTFstring &() const;

EbmlUnicodeString &SetValueUTF8(std::string const &NewValue);
std::string GetValueUTF8() const;
Expand Down
2 changes: 0 additions & 2 deletions src/EbmlString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ filepos_t EbmlString::RenderData(IOCallback & output, bool /* bForceRender */, S
return Result;
}

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

std::uint64_t EbmlString::UpdateSize(ShouldWrite writeFilter, bool /* bForceRender */)
{
if (!writeFilter(*this))
Expand Down
2 changes: 0 additions & 2 deletions src/EbmlUnicodeString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ filepos_t EbmlUnicodeString::RenderData(IOCallback & output, bool /* bForceRende
return Result;
}

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

EbmlUnicodeString &EbmlUnicodeString::SetValueUTF8(std::string const &NewValue) {
UTFstring NewValueUTFstring;
NewValueUTFstring.SetUTF8(NewValue);
Expand Down

0 comments on commit 7992b73

Please sign in to comment.