ROOT logo
// @(#)root/reflex:$Id: Base.cxx 26633 2008-12-03 16:29:58Z axel $
// Author: Stefan Roiser 2004

// Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
//
// Permission to use, copy, modify, and distribute this software for any
// purpose is hereby granted without fee, provided that this copyright and
// permissions notice appear in all copies and derivatives.
//
// This software is provided "as is" without express or implied warranty.

#ifndef REFLEX_BUILD
#define REFLEX_BUILD
#endif

#include "Reflex/Base.h"
#include "Class.h"

//-------------------------------------------------------------------------------
Reflex::Base::Base( const Type &    baseType,
                          OffsetFunction  offsetfp,
                          unsigned int    modifiers )
   : fOffsetFP( offsetfp ),
     fModifiers( modifiers ),
     fBaseType( Type() ),
     fBaseClass( 0 ) {
//-------------------------------------------------------------------------------
// Construct the information for a base. The pointer to the base class (type Class)
// is set to 0 initially and set on first access.
   fBaseType = baseType;
}


//-------------------------------------------------------------------------------
const Reflex::Class * Reflex::Base::BaseClass() const {
//-------------------------------------------------------------------------------
// Return the pointer to the base class. Set on first access.
   if ( fBaseClass ) return fBaseClass;
   if ( fBaseType ) {
      fBaseClass = dynamic_cast< const Class * >(fBaseType.ToTypeBase());
      return fBaseClass;
   }
   return 0;
}


//-------------------------------------------------------------------------------
std::string Reflex::Base::Name( unsigned int mod ) const {
//-------------------------------------------------------------------------------
// Construct the name of the base. Qualify if requested.
   std::string s;
   if ( 0 != ( mod & ( QUALIFIED | Q ))) {
      if ( IsPublic())    { s += "public "; }
      if ( IsProtected()) { s += "protected "; }
      if ( IsPrivate())   { s += "private "; }
      if ( IsVirtual())   { s += "virtual "; }
   }
   s += fBaseType.Name( mod );
   return s;
}
 Base.cxx:1
 Base.cxx:2
 Base.cxx:3
 Base.cxx:4
 Base.cxx:5
 Base.cxx:6
 Base.cxx:7
 Base.cxx:8
 Base.cxx:9
 Base.cxx:10
 Base.cxx:11
 Base.cxx:12
 Base.cxx:13
 Base.cxx:14
 Base.cxx:15
 Base.cxx:16
 Base.cxx:17
 Base.cxx:18
 Base.cxx:19
 Base.cxx:20
 Base.cxx:21
 Base.cxx:22
 Base.cxx:23
 Base.cxx:24
 Base.cxx:25
 Base.cxx:26
 Base.cxx:27
 Base.cxx:28
 Base.cxx:29
 Base.cxx:30
 Base.cxx:31
 Base.cxx:32
 Base.cxx:33
 Base.cxx:34
 Base.cxx:35
 Base.cxx:36
 Base.cxx:37
 Base.cxx:38
 Base.cxx:39
 Base.cxx:40
 Base.cxx:41
 Base.cxx:42
 Base.cxx:43
 Base.cxx:44
 Base.cxx:45
 Base.cxx:46
 Base.cxx:47
 Base.cxx:48
 Base.cxx:49
 Base.cxx:50
 Base.cxx:51
 Base.cxx:52
 Base.cxx:53
 Base.cxx:54
 Base.cxx:55
 Base.cxx:56
 Base.cxx:57
 Base.cxx:58
 Base.cxx:59
 Base.cxx:60