Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more constexpr return values/references #265

Merged
merged 4 commits into from
Feb 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions ebml/EbmlElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,15 @@ class EBML_DLL_API EbmlCallbacks {
{
}

inline const EbmlId & ClassId() const { return GlobalId; }
inline constexpr const EbmlId & ClassId() const { return GlobalId; }
inline constexpr const EbmlSemanticContext & GetContext() const { return Context; }
inline const char * GetName() const { return DebugName; }
inline constexpr const char * GetName() const { return DebugName; }
inline EbmlElement & NewElement() const { return Create(); }
/// is infinite/unknown size allowed
inline bool CanHaveInfiniteSize() const { return CanInfinite; }
bool HasDefault() const { return hasDefault; }
inline constexpr bool CanHaveInfiniteSize() const { return CanInfinite; }
inline constexpr bool HasDefault() const { return hasDefault; }
// get information about supported version for this element
inline const EbmlDocVersion & GetVersions() const { return Version; }
inline constexpr const EbmlDocVersion & GetVersions() const { return Version; }

private:
EbmlElement & (* const Create)();
Expand Down Expand Up @@ -385,11 +385,11 @@ class EBML_DLL_API EbmlSemantic {
constexpr EbmlSemantic(bool aMandatory, bool aUnique, const EbmlCallbacks & aCallbacks)
:Mandatory(aMandatory), Unique(aUnique), Callbacks(aCallbacks) {}

inline bool IsMandatory() const { return Mandatory; }
inline bool IsUnique() const { return Unique; }
inline constexpr bool IsMandatory() const { return Mandatory; }
inline constexpr bool IsUnique() const { return Unique; }
inline EbmlElement & Create() const { return EBML_INFO_CREATE(Callbacks); }
inline explicit operator const EbmlCallbacks &() const { return Callbacks; }
inline EbmlCallbacks const &GetCallbacks() const { return Callbacks; }
inline constexpr EbmlCallbacks const &GetCallbacks() const { return Callbacks; }

private:
const bool Mandatory; ///< whether the element is mandatory in the context or not
Expand Down Expand Up @@ -419,9 +419,9 @@ class EBML_DLL_API EbmlSemanticContext {
(MasterElt != aElt.MasterElt));
}

inline std::size_t GetSize() const { return Size; }
inline const EbmlCallbacks* GetMaster() const { return MasterElt; }
inline const EbmlSemanticContext* Parent() const { return UpTable; }
inline constexpr std::size_t GetSize() const { return Size; }
inline constexpr const EbmlCallbacks* GetMaster() const { return MasterElt; }
inline constexpr const EbmlSemanticContext* Parent() const { return UpTable; }
const EbmlSemantic & GetSemantic(std::size_t i) const;

const _GetSemanticContext GetGlobalContext; ///< global elements supported at this level
Expand Down Expand Up @@ -482,8 +482,8 @@ class EBML_DLL_API EbmlElement {

virtual EbmlId const &GetClassId() const {return ClassInfo.ClassId();}
virtual explicit operator const EbmlId &() const { return GetClassId(); }
const char *DebugName() const {return ClassInfo.GetName();}
const EbmlSemanticContext &Context() const {return ClassInfo.GetContext();}
constexpr const char *DebugName() const {return ClassInfo.GetName();}
constexpr const EbmlSemanticContext &Context() const {return ClassInfo.GetContext();}
virtual EbmlElement & CreateElement() const = 0;

/*!
Expand Down