SearchManager The majority of application data is managed
by the SearchManager. The SearchManager is a singleton that owns a collection of
Searches. The SearchManager uses a customized, re-entrant read-write lock to allow
any number of reader threads but only a single writer thread to make modifications
to the Searches collection.
The SearchManager supports client registration so that client views may register
for notification of changes to the collection of Searches or to any individual Search.
Clients interested in receiving update events implement an Objective-C protocol
to receive the events. Events are dispatched to clients using dispatch_async()
to the UI thread.
The SearchManager serves as the host of the NSTimer that is used to launch background
searches. The background search intervals are all multiples of each other so the
timer is set to fire on the shortest set interval and any Searches that are due
for an update are executed.
The SearchManager also serves as the root for data coding (serialization). The SearchManager's
settings are serialized (using keyed encoding) followed by the Searches collection.
Search The Search object maintains data related to each
individual Search: name, keywords, type of search, search interval, etc. Searches
must all have unique names.
Searches also maintain a collection of Listings and Filters. The Listings represent
CraigsList listings that were returned by the RSS feed. The Filters are created
by the user and applied to the Listings to allow additional search specificity beyond
that afforded by the RSS keywords.
Searches implement NSCoding to serialize themselves.
Listing The Listing object represents a single listing
returned by the RSS feed. A Listing contains a URL, a posting date, a title, a description,
and an indicator to remember whether or not a Listing has been read by the user.
Listings are keyed by their URL. Listings implement NSCoding to serialize themselves.
Filter Filters provide users with an additional layer
of screening to reduce the number of false hits in their Searches. For example,
a user may set up a Search for Aeron chairs, but then add a Filter to display only
Aeron listings that have "titanium" in their description. A Filter can be applied
to Listing titles, descriptions, or both.
Filters can be inclusive or exclusive. By default, all Listings in a Search are
displayed. If an inclusive Filter is applied to the Search, only Listings that pass
one or more of the inclusive Filters are displayed. If a Listing matches any exclusive
Filters, it is not displayed.
Filters can be plain text or regular expression (using NSRegularExpression).
Filters implement NSCoding to serialize themselves.
ClRssEngine The ClRssEngine forms the RSS URL, executes
the HTTP request, and initiates parsing of the response into application objects.
The results are then returned to the initiating Search.
ClRssXmlDelegate The ClRssXmlDelegate implements the
NSXMLParserDelegate to parse the RSS response into Listing objects.