2008-07-31 17:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/vm/classes.c
    + adding 2-nd parameter to __clsGetProperties()
      When it's TRUE then __clsGetProperties() returns also exported
      messages which have corresponding assign messages (with "_" prefix)

  * harbour/source/rtl/objfunc.prg
    + added __objGetProperties( oObject, [ lAllExported = .F. ] ) ->
                  aMsgAndValues
      This function returns list of PROPERTY message with their values,
      when 2-nd parameter is true it also returns exported messages which
      which have corresponding assign messages (with "_" prefix)
      This function is designed to use in object inspectors.
This commit is contained in:
Przemyslaw Czerpak
2008-07-31 15:42:00 +00:00
parent a244bb3484
commit 0891ca7ddc
3 changed files with 56 additions and 6 deletions

View File

@@ -8,6 +8,20 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-07-31 17:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/classes.c
+ adding 2-nd parameter to __clsGetProperties()
When it's TRUE then __clsGetProperties() returns also exported
messages which have corresponding assign messages (with "_" prefix)
* harbour/source/rtl/objfunc.prg
+ added __objGetProperties( oObject, [ lAllExported = .F. ] ) ->
aMsgAndValues
This function returns list of PROPERTY message with their values,
when 2-nd parameter is true it also returns exported messages which
which have corresponding assign messages (with "_" prefix)
This function is designed to use in object inspectors.
2008-07-31 14:50 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbmzip/hbmzip.c
* harbour/contrib/hbmzip/readme.txt

View File

@@ -279,3 +279,14 @@ FUNCTION __objDerivedFrom( oObject, xSuper )
RETURN __clsParent( oObject:ClassH, cClassName )
FUNCTION __objGetProperties( oObject, lAllExported )
LOCAL msg, aMsgList
aMsgList := __clsGetProperties( oObject:classH, lAllExported )
FOR EACH msg IN aMsgList
msg := { msg, __objSendMsg( oObject, msg ) }
NEXT
RETURN aMsgList

View File

@@ -4383,10 +4383,13 @@ HB_FUNC( __GETMSGPRF ) /* profiler: returns a method called and consumed times *
hb_stornl( 0, -1, 2 );
}
/* __ClsGetProperties( nClassHandle ) --> aPropertiesNames
/* __ClsGetProperties( nClassHandle, [ lAllExported ] ) --> aPropertiesNames
* Notice that this function works quite similar to __CLASSSEL()
* except that just returns the name of the datas and methods
* that have been declared as PROPERTY (or PERSISTENT) */
* that have been declared as PROPERTY (PERSISTENT) or also EXPORTED
* if second parameter <lAllExported> is true and message has corresponding
* assign message (with "_" prefix)
*/
HB_FUNC( __CLSGETPROPERTIES )
{
@@ -4398,14 +4401,27 @@ HB_FUNC( __CLSGETPROPERTIES )
PCLASS pClass = &s_pClasses[ uiClass ];
PMETHOD pMethod;
ULONG ulLimit, ulCount;
USHORT uiScope = HB_OO_CLSTP_PERSIST;
if( ISLOG( 2 ) && hb_parl( 2 ) )
uiScope |= HB_OO_CLSTP_EXPORTED;
ulCount = 0;
ulLimit = hb_clsMthNum( pClass );
pMethod = pClass->pMethods;
do
{
if( pMethod->pMessage && ( pMethod->uiScope & HB_OO_CLSTP_PERSIST ) )
++ulCount;
if( pMethod->pMessage && ( pMethod->uiScope & uiScope ) != 0 )
{
if( ( pMethod->uiScope & HB_OO_CLSTP_PERSIST ) != 0 )
++ulCount;
else if( pMethod->pMessage->pSymbol->szName[ 0 ] == '_' )
{
PHB_DYNS pMsg = hb_dynsymFind( pMethod->pMessage->pSymbol->szName + 1 );
if( pMsg && hb_clsFindMsg( pClass, pMsg ) )
++ulCount;
}
}
++pMethod;
}
while( --ulLimit );
@@ -4417,8 +4433,17 @@ HB_FUNC( __CLSGETPROPERTIES )
pMethod = pClass->pMethods;
do
{
if( pMethod->pMessage && ( pMethod->uiScope & HB_OO_CLSTP_PERSIST ) )
hb_arraySetC( pReturn, ++ulCount, pMethod->pMessage->pSymbol->szName );
if( pMethod->pMessage && ( pMethod->uiScope & uiScope ) != 0 )
{
if( ( pMethod->uiScope & HB_OO_CLSTP_PERSIST ) != 0 )
hb_arraySetC( pReturn, ++ulCount, pMethod->pMessage->pSymbol->szName );
else if( pMethod->pMessage->pSymbol->szName[ 0 ] == '_' )
{
PHB_DYNS pMsg = hb_dynsymFind( pMethod->pMessage->pSymbol->szName + 1 );
if( pMsg && hb_clsFindMsg( pClass, pMsg ) )
hb_arraySetC( pReturn, ++ulCount, pMethod->pMessage->pSymbol->szName + 1 );
}
}
++pMethod;
}
while( --ulLimit );