/* * $Id$ */ /* * Harbour Project source code: * Header file for Class commands * * Copyright 1999 Antonio Linares * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). * * As a special exception, the Harbour Project gives permission for * additional uses of the text contained in its release of Harbour. * * The exception is that, if you link the Harbour libraries with other * files to produce an executable, this does not by itself cause the * resulting executable to be covered by the GNU General Public License. * Your use of that executable is in no way restricted on account of * linking the Harbour library code into it. * * This exception does not however invalidate any other reasons why * the executable file might be covered by the GNU General Public License. * * This exception applies only to the code released by the Harbour * Project under the name Harbour. If you copy code from other * Harbour Project or Free Software Foundation releases into a copy of * Harbour, as the General Public License permits, the exception does * not apply to the code that you add in this way. To avoid misleading * anyone as to the status of such modified files, you must delete * this exception notice from them. * * If you write modifications of your own for Harbour, it is your choice * whether to permit this exception to apply to your modifications. * If you do not wish that, delete this exception notice. * */ /* * The following parts are Copyright of the individual authors. * www - http://www.harbour-project.org * * Copyright 2000 JF Lefebvre and RA Cuylen * Support for Class(y), TopClass and Visual Object compatibility * Support for MI (multiple inheritance), * Scoping (Protect, Hidden and Readonly), * Delegating, DATA Shared * Support of 10 Chars limits * * See doc/license.txt for licensing terms. * */ DECLARE TClass ; New( cName AS String, OPTIONAL SuperParams ) AS CLASS TClass ; Create() AS Object; Instance() AS Object ; AddClsMthds( cName AS String, @MethodName(), nScope AS Numeric, n2 AS Numeric, n3 AS Numeric ); AddMultiClsData( cType AS String, uVal, nScope AS Numeric, aDatas AS Array OF String ); AddMultiData( cType AS String, uVal, nScope AS Numeric, aDatas AS Array OF String ); AddMethod( cName AS String, @MethodName(), nScope AS Numeric ); AddInLine( cName AS String, bBlock AS CodeBlock, nScope AS Numeric ); AddVirtual( cName AS String ) #ifndef HB_CLASS_CH_ #define HB_CLASS_CH_ #include "hbsetup.ch" #include "hboo.ch" /* You can actually define one or all the syntax, they do not collide each other */ /* There is some difference with their original form and I hope I will have enough */ /* time to document it */ /* This is work in progress ... */ /* FWOBJECT AND CLASSY compatibility are the base of this work */ /* VO is just here as I like it's way of */ /* instanciating object but there is only a very few VO keywords here :-( */ /* TOPCLASS is better implemented because I like the way some Classy command */ /* are simplified */ /* There is also a big common block extending in fact each of the four base syntax */ /* it seem actually impossible to completely separate it without creating */ /* four differents include file (what I would not see in fact ) */ /* There is also two compatibility define you can use */ /* HB_CLS_NOTOBJECT wich IF DEFINED, disable the auto inherit of tobject */ /* (wich in fact also disable the classy compatibility :new(...) => :Init(...) */ /* HB_CLS_NOAUTOINIT wich disable the (VO like) AutoInit for Logical and Numeric */ /* when not specifically initiated */ /* These two are disabled by default */ /* So Each class _inherit_ of tObject by default and */ /* Each type logical or numerical is initiated to .F. and 0 by default */ /* #define HB_CLS_NOTOBJECT */ /* Should be included in some compatibility include files as needed */ /* #define HB_CLS_NOAUTOINIT */ /* Idem */ /* #define HB_CLS_ALLOWCLASS */ /* Work in progress, don't define it now */ #ifdef HB_CLS_NOTOBJECT #define __HB_CLS_PAR __CLS_PAR00 #else #define __HB_CLS_PAR __CLS_PARAM #endif #ifdef HB_CLS_NOAUTOINIT #define __HB_CLS_NOINI .T. #else #define __HB_CLS_NOINI .F. #endif #ifndef HB_CLS_FWO #ifndef HB_CLS_CSY #ifndef HB_CLS_VO #ifndef HB_CLS_TOP /* IF NOTHING DECIDED BY THE PROGRAMER USE ALL */ #define HB_CLS_FWO #define HB_CLS_CSY #define HB_CLS_VO #define HB_CLS_TOP #endif #endif #endif #endif #xtranslate HBCLSCHOICE( , , ) => iif( , HB_OO_CLSTP_EXPORTED , iif( , HB_OO_CLSTP_PROTECTED, iif( , HB_OO_CLSTP_HIDDEN, nScope) ) ) /* CLASSY SYNTAX */ #IFDEF HB_CLS_CSY #xtranslate CREATE CLASS => CLASS #endif #ifndef HB_SHORTNAMES #xcommand CLASS [METACLASS ] [ [,] ] [] => ; _HB_CLASS ;; function () ;; static s_oClass ;; local MetaClass,nScope := HB_OO_CLSTP_EXPORTED ;; if s_oClass == NIL ;; s_oClass := IIF(<.metaClass.>, <(metaClass)> ,TClass():new( <(ClassName)> , __HB_CLS_PAR ( [ <(SuperClass1)> ] [ ,<(SuperClassN)> ] ) ) ) ;; #undef _CLASS_NAME_ ;; #define _CLASS_NAME_ ;; #translate CLSMETH () => @_() ; [ ; #translate Super( ) : => ::: ] ; [ ; #translate Super( ) : => ::: ] ; [ ; #translate Super() : => ::: ] ; [ ; #translate Super : => ::: ] ; [ ; REQUEST ] [ , ] #else #xcommand CLASS [METACLASS ] [ [,] ] [] => ; _HB_CLASS ;; function () ;; static s_oClass ;; local MetaClass,nScope := HB_OO_CLSTP_EXPORTED ;; if s_oClass == NIL ;; s_oClass := IIF(<.metaClass.>,<(metaClass)>,TClass():new(<(ClassName)>, __HB_CLS_PAR ( [ <(SuperClass1)> ] [ ,<(SuperClassN)> ] ) ) ) ;; #undef _CLASS_NAME_ ;; #define _CLASS_NAME_ ;; #translate CLSMETH () => @() ; [ ; #translate Super( ) : => ::: ] ; [ ; #translate Super( ) : => ::: ] ; [ ; #translate Super() : => ::: ] ; [ ; #translate Super : => ::: ] ; [ ; REQUEST ] [ , ] #endif /* HB_SHORTNAMES */ /* Disable the message :Class */ #ifndef HB_CLS_ALLOWCLASS /* CLASSY SYNTAX */ #IFDEF HB_CLS_CSY #xtranslate :CLASS => #xtranslate :CLASS: => : #endif #endif /* CLASSY SYNTAX */ #IFDEF HB_CLS_CSY #xcommand VAR [ TYPE ] [ ASSIGN ] [] [] [