Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_b_prscan( <cobject>, <ntype> [, @<anames> ] ) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_B_PRSCAN( <cObject>, <nType> [, @<aNames> ] )


Parameters

<cObject>
Name of an object.

<nType>
Object type.

@<aNames>
Array to receive the names of the object's properties.


Returns

Number of properties attached to the object.

Call N_B_PRSCAN(<cObject>, <nType>) to properly size the array <aNames> 
before passing it as the optional third parameter in a second call to 
N_B_PRSCAN().

Clipper 5.x  If you initialize <aNames> to zero elements, the 
function will resize the array when you pass it as the third parameter. 
Thus you need make only one call, not two. For instance:

LOCAL aProps := {}
N_B_PRSCAN('TEST', 1, aProps)



Description

N_B_PRSCAN(<cObject>, <nType>, <aNames>) fills the array <aNames> with 
the names of the object's properties.

Before you can read the data assigned to a property, you will need to 
know whether it is an item or a set property. To get this information, 
use N_B_PRTYPE(). If it is an item property, use N_B_PRREAD(). If it is 
a set property, explode the members of the set into an array using the 
function N_B_MEMBERS().


Example

// Return an object's set properties in an array.
FUNCTION GetSets( cObject, nType )
   LOCAL aProperties := aSets := {}, i
   N_B_PRSCAN(cObject, nType, @aProperties) // Clipper 5
   FOR i = 1 TO LEN(aProperties)
      // If it's a set property...
      IF N_B_PRTYPE(cObject, nType, aProperties[i]) = 'S'
         // add an element to the array.
         AADD(aSets, aProperties[i])
      ENDIF
   NEXT i
RETURN aSets



See Also: N_B_MEMBERS() N_B_PRREAD() N_B_PRSCAN()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson