Saturday, April 02, 2005

proposed Collection and Class modules

Hey team ... I've come up with a preliminary object and collection model for your perusal ...


=======================================================================
'project:  CLogEntry class
'programmer:  black, fairbairn, ferguson, & morton
'date:  3.30.5
'description:  describes an entry from the apache log file

'public properties:
'    .EntryNumber
'    .IP
'    .RFC
'    .UserID
'    .DateAndTime
'    .Method
'    .Resource
'    .Protocol
'    .StatusCode
'    .FileSize
'    .Referrer
'    .UserAgent

Option Explicit

    Private mstrEntryNumber As String
    Private mstrVisitorIP As String
    Private mstrRFCIdentity As String
    Private mstrUserID As String
    Private mstrDateAndTime As String
    Private mstrGMTOffset As String
    Private mstrVisitDate As String
    Private mstrVisitTime As String
    Private mstrMethodUsed As String
    Private mstrResourceRequested As String
    Private mstrProtocolUsed As String
    Private mstrHTTPStatusCode As String
    Private mstrResourceSize As String
    Private mstrHTTPReferrerHdr As String
    Private mstrHTTPUserAgent As String
    Private mstrBrowserCompat As String
    Private mstrBrowserType As String
    Private mstrBrowserName As String
    Private mstrBrowserVer As String
    Private mstrOS As String
    Private mstrOSName As String
    Private mstrOSVer As String

=======================================================================

'project:  CLogEntries
'programmer:  black, fairbairn, ferguson, & morton
'date:  3.30.5
'description:  describes the container for CLogEntry objects

Option Explicit

'////////////////////-| Collection private data members |-\\\\\\\\\\\\\\\\\\
Private mLogs As Collection

'//////////////-| private Collection properties & functions |-\\\\\\\\\\\\\\
Private Sub Class_Initialize()

'ctor

   Set mLogs = New Collection

End Sub

Private Sub Class_Terminate()

'dtor

   Set mLogs = Nothing

End Sub

Private Function NextEntryNumber() As String

'assigns the next entry number

   Static intEntryNum As Integer

   intEntryNum = intEntryNum + 1

'convert number to string and trim whitespace

   NextEntryNumber = Trim(Str(intEntryNum))

End Function

'/////////////////////-| public Collection properties |-\\\\\\\\\\\\\\\\\\\\
Public Sub Add(ByVal strTheIP As String, ByVal strRFCID As String, _
   ByVal strUserID As String, ByVal strDateTime As String, _
   ByVal strMethod As String, ByVal strResource As String, _
   ByVal strProtocol As String, ByVal strStatus As String, _
   ByVal strSize As String, ByVal strReferrer As String, _
   ByVal strUserAgent As String)

'add new member to the Collection

   Dim NewEntry As New CLogEntry

   With NewEntry
    .EntryNumber = NextEntryNumber
    .IP = strTheIP
    .RFC = strRFCID
    .UserID = strUserID
    .DateAndTime = strDateTime
    .Method = strMethod
    .Resource = strResource
    .Protocol = strProtocol
    .StatusCode = strStatus
    .FileSize = strSize
    .Referrer = strReferrer
    .UserAgent = strUserAgent
    mLogs.Add NewEntry, .EntryNumber
   End With

End Sub

Public Sub Remove(ByVal strTheNumber As String)

'removes a member from the Collection

   mLogs.Remove strTheNumber

End Sub

Public Function Item(ByVal strTheNumber As String) As CLogEntry
'Attribute Item.VB_UserMemId = 0
'returns the specified member from the Collection

' w/ insertion point in this function() set Tools | Procedure Attributes |
' Advanced ... set Procedure ID to (Default)

   Set Item = mLogs.Item(strTheNumber)

End Function

Public Function NewEnum()
'Attribute NewEnum.VB_UserMemId = -4
'Attribute NewEnum.VB_MemberFlags = "40"

'allow For Each ... Next enumeration
' w/ insertion point in this function() set Tools | Procedure Attributes |
' Advanced ... set Procedure ID to -4 and Hide this member

   Set NewEnum = mLogs.[_NewEnum]

End Function

Public Property Get Count() As Long

'return the number of members in the Collection

   Count = mLogs.Count

End Property

1 Comments:

At 1:44 PM, Blogger Mike said...

have i totally confused everyone yet?

:o)

 

Post a Comment

<< Home