Blame lib/TypeId.cxx

Packit 8a864e
// Copyright (c) 1994 James Clark
Packit 8a864e
// See the file COPYING for copying permission.
Packit 8a864e
Packit 8a864e
#include "splib.h"
Packit 8a864e
#include "TypeId.h"
Packit 8a864e
Packit 8a864e
#ifdef SP_NAMESPACE
Packit 8a864e
namespace SP_NAMESPACE {
Packit 8a864e
#endif
Packit 8a864e
Packit 8a864e
int TypeId::isA(TypeId ti) const
Packit 8a864e
{
Packit 8a864e
  if (*this == ti)
Packit 8a864e
    return 1;
Packit 8a864e
  for (const void *const *p = bases_; *p; p++)
Packit 8a864e
    if (TypeId((const void *const *)*p).isA(ti))
Packit 8a864e
      return 1;
Packit 8a864e
  return 0;
Packit 8a864e
}
Packit 8a864e
Packit 8a864e
int TypeId::canCast(TypeId to, TypeId from) const
Packit 8a864e
{
Packit 8a864e
  return isA(to) && to.isA(from);
Packit 8a864e
}
Packit 8a864e
Packit 8a864e
#ifdef SP_NAMESPACE
Packit 8a864e
}
Packit 8a864e
#endif