/ Published in: Visual Basic
String FIFO class used in a production VB6 application.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
' This is a First in First Out structure for strings Option Explicit Private sColl As Collection Private curIndex As Integer Private Sub Class_Initialize() Set sColl = New Collection curIndex = 0 End Sub Private Sub Class_Terminate() Set sColl = Nothing End Sub Public Property Get Count() As Long Count = sColl.Count End Property Public Property Get NextValue() As String NextValue = CStr(sColl.item(sColl.Count)) End Property Public Sub Push(ByVal value As String) sColl.Add value End Sub Public Function Pop() As String Dim poppedval As String poppedval = CStr(sColl.item(sColl.Count)) sColl.Remove (sColl.Count) Pop = poppedval End Function Public Sub Clear() 'clears all elements Do Until sColl.Count = 0 sColl.Remove (0) Loop End Sub