Module cRowIdArray.pkg

     1// cRowIdArray.pkg
     2// Class: cRowIdArray
     3//
     4// This is a private class that is used by db-grid classes (dbGrid & dbList - code in datalist.pkg) to store
     5// Rowids for each row in the grid. None of these messages in this class should ever be directly accessed from
     6// any of the developer's classes or objects. There should be public messages in the db-grid classes to do
     7// whatever a developer needs to do. Directly using these messages can result in instabilities.
     8//
     9// This class is private. It's existance, implementation and interface is likely to change.
    10// If a developer finds that they need a similar type of capability (a set class that stores and
    11// retrieves an array of Rowids) they may wish to use this class as a model for creating their
    12// own custom class. It is quite simple. All we are doing is serializing every value coming into the object
    13// and deserializing every value coming out of the object. This is needed because the array class cannot
    14// store rowId data-types. (Note that the native array data-type, could do this.)
    15//
    16
    17Use set.pkg
    18
    19{ ClassType=Abstract Visibility=Private ClassLibrary=Windows }
    20Class cRowIdArray is a set
    21
    22    Procedure Set RowId_Value integer iIndex RowId riRec
    23        Set Value iIndex to (SerializeRowId(riRec))
    24    End_Procedure
    25
    26    Function RowId_Value integer iIndex Returns RowId
    27        string sRowId
    28        Get Value iIndex to sRowId
    29        Function_return (DeSerializeRowId(sRowId))
    30    End_Procedure
    31
    32    Procedure Insert_RowId integer iIndex RowId riRec
    33        Send Insert_item iIndex (SerializeRowId(riRec))
    34    End_Procedure
    35
    36    Procedure Delete_RowId integer iIndex
    37        Send delete_Item iIndex
    38    End_Procedure
    39
    40    Function Find_RowId RowId riId returns integer
    41        integer iItem
    42        Get Find_element (SerializeRowid(riId)) to iItem
    43        function_return iItem
    44    end_function
    45
    46    Function Add_RowId RowId riId returns integer
    47        integer iItem
    48        get msg_Add_Element (SerializeRowid(riId)) to iItem
    49        function_return iItem
    50    end_Function
    51
    52    Procedure Remove_RowId rowId riId
    53        Send Remove_Element (SerializeRowId(riId))
    54    end_procedure
    55
    56end_Class
    57
    58