|
of_destroy
|
|
Full name
|
pfc_n_cst_linkedlistbase.of_destroy
|
Access
|
public
|
Extend of
|
long
|
Return value
|
long
|
Prototype
|
public function long of_destroy()
|
Name
|
Datatype
|
li_cnt
|
long
|
lnv_node
|
n_cst_linkedlistnode
|
lnv_prev
|
n_cst_linkedlistnode
|
public function long of_destroy ();//////////////////////////////////////////////////////////////////////////////
//
// Function: of_Destroy
//
// Access: public
//
// Arguments : None
//
// Returns:
// long : the number of nodes destroyed in the list
// -1 error.
//
// Description:
// Destroys all of the nodes in the list
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
long li_cnt
n_cst_linkedlistnode lnv_node
n_cst_linkedlistnode lnv_prev
// Confirm that there is a valid tail.
if isnull(inv_tail) or not isvalid(inv_tail) then return 0
// Loop destroying from tail to the head.
lnv_node = inv_tail
do while isvalid(lnv_node)
// Get the previous node prior to Removing/Destroying the current Tail.
lnv_node.of_getprev(lnv_prev)
// Remove the current tail.
If of_remove(lnv_node) <= 0 Then Return -1
// Destroy the current tail.
If IsValid(lnv_node) Then destroy lnv_node
// Keep track of the destroyed nodes.
li_cnt ++
// Go after the new Tail.
lnv_node = lnv_prev
loop
return li_cnt
end function