PBDR.COM

About   -   Contact   -   Purchase   -   Search   -   What's New

 
 
Ancestry Check Function
This function will check if an object inherits from the past in class name. Submitted by Erik Toft.
///////////////////////////////////////////////////////////////////////// 
// 
// Global service function: f_is_a 
// 
// Purpose: Allows a program to check the ancestry of any 
//          object to ensure that it is derived from an 
//          expected ancestor, therefore having an 
//          expected interface. 
// 
//          Usefull in dynamic scripting, generic code, 
//          and inspective/intorspective applications. 
// 
// Programmer: Erik Toft 
// Date: 03/24/2003 
// 
///////////////////////////////////////////////////////////////////////// 

boolean lb_ret = false 
classdefinition lcd_class_def 

if isnull(apo_to_check) then return false 
if not isvalid(apo_to_check) then return false 
if isnull(apo_to_check.classdefinition) then return false 
if not isvalid(apo_to_check.classdefinition) then return false 
lcd_class_def = apo_to_check.classdefinition 

do while not isnull(lcd_class_def) and isvalid(lcd_class_def) 
        if upper(lcd_class_def.name) = upper(as_class_name) then 
                lb_ret = true 
                exit //the loop 
        end if 
        lcd_class_def = lcd_class_def.ancestor 
loop 

return lb_ret
 

Top of Page

Legal Notice

Ken Howe 2011