|
' ******************************************************************************
' **
' ** Yahoo Finance Managed
' ** Written by Marius Häusler 2010
' ** It would be pleasant, if you contact me when you are using this code.
' ** Contact: YahooFinanceManaged@gmail.com
' ** Project Home: http://code.google.com/p/yahoo-finance-managed/
' **
' ******************************************************************************
' **
' ** Copyright 2010 Marius Häusler
' **
' ** Licensed under the Apache License, Version 2.0 (the "License");
' ** you may not use this file except in compliance with the License.
' ** You may obtain a copy of the License at
' **
' ** http://www.apache.org/licenses/LICENSE-2.0
' **
' ** Unless required by applicable law or agreed to in writing, software
' ** distributed under the License is distributed on an "AS IS" BASIS,
' ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
' ** See the License for the specific language governing permissions and
' ** limitations under the License.
' **
' ******************************************************************************
Namespace RSS
''' <summary>
''' Stores data of a rss feed item.
''' </summary>
''' <remarks></remarks>
Public Class FeedItem
Private mTitle, mDescription, mAuthor As String
Private mLink, mComments As Uri
Private mCategory As Category
Private mEnclosure As Enclosure
Private mSource As Source
Private mInsertDate, mPublishDate As Date
Private mGuid As GUID
''' <summary>
''' The title of the item.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Title() As String
Get
Return mTitle
End Get
Set(ByVal value As String)
mTitle = value
End Set
End Property
''' <summary>
''' The URL of the item.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Link() As Uri
Get
Return mLink
End Get
Set(ByVal value As Uri)
mLink = value
End Set
End Property
''' <summary>
''' The item synopsis.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Description() As String
Get
Return mDescription
End Get
Set(ByVal value As String)
mDescription = value
End Set
End Property
''' <summary>
''' Email address of the author of the item.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Author() As String
Get
Return mAuthor
End Get
Set(ByVal value As String)
mAuthor = value
End Set
End Property
''' <summary>
''' Includes the item in one or more categories.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Category() As Category
Get
Return mCategory
End Get
Set(ByVal value As Category)
mCategory = value
End Set
End Property
''' <summary>
''' URL of a page for comments relating to the item.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Comments() As Uri
Get
Return mComments
End Get
Set(ByVal value As Uri)
mComments = value
End Set
End Property
''' <summary>
''' Describes a media object that is attached to the item.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Enclosure() As Enclosure
Get
Return mEnclosure
End Get
Set(ByVal value As Enclosure)
mEnclosure = value
End Set
End Property
''' <summary>
''' A string that uniquely identifies the item.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property GUID() As GUID
Get
Return mGuid
End Get
Set(ByVal value As GUID)
mGuid = value
End Set
End Property
Public Property InsertDate() As Date
Get
Return mInsertDate
End Get
Set(ByVal value As Date)
mInsertDate = value
End Set
End Property
''' <summary>
''' Indicates when the item was published.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property PublishDate() As Date
Get
Return mPublishDate
End Get
Set(ByVal value As Date)
mPublishDate = value
End Set
End Property
''' <summary>
''' The RSS channel that the item came from.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Source() As Source
Get
Return mSource
End Get
Set(ByVal value As Source)
mSource = value
End Set
End Property
Public Sub New()
Me.Clear()
End Sub
Public Overridable Sub Clear()
Me.Title = String.Empty
Me.Link = Nothing
Me.Description = String.Empty
Me.Author = String.Empty
Me.InsertDate = #12:00:00 AM#
Me.PublishDate = #12:00:00 AM#
Me.Comments = Nothing
Me.GUID = Nothing
Me.Category = Nothing
Me.Enclosure = Nothing
Me.Source = Nothing
End Sub
Public Overridable Sub CopyValues(ByVal n As FeedItem)
With Me
.Author = n.Author
If n.Category IsNot Nothing Then
.Category = New Category
.Category.Domain = n.Category.Domain
.Category.Name = n.Category.Name
Else
.Category = Nothing
End If
.Comments = n.Comments
.Description = n.Description
If n.Enclosure IsNot Nothing Then
.Enclosure = New Enclosure
.Enclosure.Length = n.Enclosure.Length
.Enclosure.Type = n.Enclosure.Type
.Enclosure.Url = n.Enclosure.Url
Else
.Enclosure = Nothing
End If
.GUID = n.GUID
.InsertDate = n.InsertDate
.Link = n.Link
.PublishDate = n.PublishDate
.Source = n.Source
.Title = n.Title
End With
End Sub
Public Overrides Function ToString() As String
Return mTitle
End Function
End Class
''' <summary>
''' Provides information about a globally unique identifier.
''' </summary>
''' <remarks></remarks>
Public Class GUID
Private mID As String
Private mIsPermaLink As Boolean
''' <summary>
''' It's a string that uniquely identifies the item. When present, an aggregator may choose to use this string to determine if an item is new.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks>There are no rules for the syntax of a guid. Aggregators must view them as a string. It's up to the source of the feed to establish the uniqueness of the string.</remarks>
Public Property ID() As String
Get
Return mID
End Get
Set(ByVal value As String)
mID = value
End Set
End Property
''' <summary>
''' If the GUID element has an attribute named isPermaLink with a value of true, the reader may assume that it is a permalink to the item, that is, a url that can be opened in a Web browser, that points to the full item described by the FeedItem element.
''' </summary>
''' <value>If its value is FALSE, the guid may not be assumed to be a url, or a url to anything in particular.</value>
''' <returns></returns>
''' <remarks>IsPermaLink is optional, its default value is TRUE.</remarks>
Public Property IsPermaLink() As Boolean
Get
Return mIsPermaLink
End Get
Set(ByVal value As Boolean)
mIsPermaLink = value
End Set
End Property
Public Sub New()
mID = String.Empty
mIsPermaLink = True
End Sub
Public Overrides Function ToString() As String
Return mID
End Function
End Class
''' <summary>
''' Enclosure describes a media object that is attached to the item.
''' </summary>
''' <remarks></remarks>
Public Class Enclosure
Private mURL As Uri
Private mType As String
Private mLength As Long
''' <summary>
''' The location of the object.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Url() As Uri
Get
Return mURL
End Get
Set(ByVal value As Uri)
mURL = value
End Set
End Property
''' <summary>
''' The MIME type of the object.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Type() As String
Get
Return mType
End Get
Set(ByVal value As String)
mType = value
End Set
End Property
''' <summary>
''' The size in Bytes of the object.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Length() As Long
Get
Return mLength
End Get
Set(ByVal value As Long)
mLength = value
End Set
End Property
Public Sub New()
mURL = Nothing
mType = String.Empty
mLength = 0
End Sub
Public Overrides Function ToString() As String
Return mType
End Function
End Class
''' <summary>
''' Provides information about the RSS channel where the item comes from.
''' </summary>
''' <remarks></remarks>
Public Class Source
Private mTitle As String
Private mURL As Uri
''' <summary>
''' The title of the RSS channel.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Title() As String
Get
Return mTitle
End Get
Set(ByVal value As String)
mTitle = value
End Set
End Property
''' <summary>
''' The url of the RSS channel.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Url() As Uri
Get
Return mURL
End Get
Set(ByVal value As Uri)
mURL = value
End Set
End Property
Public Sub New()
mURL = Nothing
mTitle = String.Empty
End Sub
Public Overrides Function ToString() As String
Return mTitle
End Function
End Class
''' <summary>
''' Provides information about catigorization of the item.
''' </summary>
''' <remarks></remarks>
Public Class Category
Private mName As String
Private mDomain As Uri
''' <summary>
''' The name of the category.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Name() As String
Get
Return mName
End Get
Set(ByVal value As String)
mName = value
End Set
End Property
Public Property Domain() As Uri
Get
Return mDomain
End Get
Set(ByVal value As Uri)
mDomain = value
End Set
End Property
Public Sub New()
mName = String.Empty
mDomain = Nothing
End Sub
Public Overrides Function ToString() As String
Return mName
End Function
End Class
End Namespace
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.