Improvements for const class usage

This commit is contained in:
Wojciech Figat
2022-09-05 14:34:16 +02:00
parent 2736363d93
commit 74fe176d2d
4 changed files with 8 additions and 8 deletions

View File

@@ -118,9 +118,9 @@ bool MClass::IsSubClassOf(const MClass* klass) const
}
#if USE_MONO
bool MClass::IsSubClassOf(MonoClass* monoClass) const
bool MClass::IsSubClassOf(const MonoClass* monoClass) const
{
return monoClass && mono_class_is_subclass_of(_monoClass, monoClass, true) != 0;
return monoClass && mono_class_is_subclass_of(_monoClass, (MonoClass*)monoClass, true) != 0;
}
#endif

View File

@@ -151,7 +151,7 @@ public:
/// </summary>
/// <param name="monoClass">The Mono class.</param>
/// <returns>True if this class is a sub class of the specified class.</returns>
bool IsSubClassOf(MonoClass* monoClass) const;
bool IsSubClassOf(const MonoClass* monoClass) const;
#endif
/// <summary>

View File

@@ -367,7 +367,7 @@ bool ScriptingObject::CanCast(const ScriptingTypeHandle& from, const ScriptingTy
return CanCast(from.GetType().ManagedClass, to.GetType().ManagedClass);
}
bool ScriptingObject::CanCast(MClass* from, MClass* to)
bool ScriptingObject::CanCast(const MClass* from, const MClass* to)
{
if (!from && !to)
return true;
@@ -383,7 +383,7 @@ bool ScriptingObject::CanCast(MClass* from, MClass* to)
#if USE_MONO
bool ScriptingObject::CanCast(MClass* from, MonoClass* to)
bool ScriptingObject::CanCast(const MClass* from, const MonoClass* to)
{
if (!from && !to)
return true;

View File

@@ -147,9 +147,9 @@ public:
/// <param name="from">The object class for the cast.</param>
/// <param name="to">The destination class to the cast.</param>
/// <returns>True if can, otherwise false.</returns>
static bool CanCast(MClass* from, MClass* to);
static bool CanCast(const MClass* from, const MClass* to);
#if USE_MONO
static bool CanCast(MClass* from, MonoClass* to);
static bool CanCast(const MClass* from, const MonoClass* to);
#endif
template<typename T>
@@ -160,7 +160,7 @@ public:
bool Is(const ScriptingTypeHandle& type) const;
bool Is(MClass* type) const
bool Is(const MClass* type) const
{
return CanCast(GetClass(), type);
}