Improvements for const class usage
This commit is contained in:
@@ -118,9 +118,9 @@ bool MClass::IsSubClassOf(const MClass* klass) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if USE_MONO
|
#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
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public:
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="monoClass">The Mono class.</param>
|
/// <param name="monoClass">The Mono class.</param>
|
||||||
/// <returns>True if this class is a sub class of the specified class.</returns>
|
/// <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
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ bool ScriptingObject::CanCast(const ScriptingTypeHandle& from, const ScriptingTy
|
|||||||
return CanCast(from.GetType().ManagedClass, to.GetType().ManagedClass);
|
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)
|
if (!from && !to)
|
||||||
return true;
|
return true;
|
||||||
@@ -383,7 +383,7 @@ bool ScriptingObject::CanCast(MClass* from, MClass* to)
|
|||||||
|
|
||||||
#if USE_MONO
|
#if USE_MONO
|
||||||
|
|
||||||
bool ScriptingObject::CanCast(MClass* from, MonoClass* to)
|
bool ScriptingObject::CanCast(const MClass* from, const MonoClass* to)
|
||||||
{
|
{
|
||||||
if (!from && !to)
|
if (!from && !to)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -147,9 +147,9 @@ public:
|
|||||||
/// <param name="from">The object class for the cast.</param>
|
/// <param name="from">The object class for the cast.</param>
|
||||||
/// <param name="to">The destination class to the cast.</param>
|
/// <param name="to">The destination class to the cast.</param>
|
||||||
/// <returns>True if can, otherwise false.</returns>
|
/// <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
|
#if USE_MONO
|
||||||
static bool CanCast(MClass* from, MonoClass* to);
|
static bool CanCast(const MClass* from, const MonoClass* to);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -160,7 +160,7 @@ public:
|
|||||||
|
|
||||||
bool Is(const ScriptingTypeHandle& type) const;
|
bool Is(const ScriptingTypeHandle& type) const;
|
||||||
|
|
||||||
bool Is(MClass* type) const
|
bool Is(const MClass* type) const
|
||||||
{
|
{
|
||||||
return CanCast(GetClass(), type);
|
return CanCast(GetClass(), type);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user