michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIStreamListener.idl" michael@0: michael@0: interface nsIURI; michael@0: interface nsIFeedResultListener; michael@0: interface nsIInputStream; michael@0: michael@0: /** michael@0: * An nsIFeedProcessor parses feeds, triggering callbacks based on michael@0: * their contents. michael@0: */ michael@0: [scriptable, uuid(8a0b2908-21b0-45d7-b14d-30df0f92afc7)] michael@0: interface nsIFeedProcessor : nsIStreamListener { michael@0: michael@0: /** michael@0: * The listener that will respond to feed events. michael@0: */ michael@0: attribute nsIFeedResultListener listener; michael@0: michael@0: // Level is where to listen for the extension, a constant: FEED, michael@0: // ENTRY, BOTH. michael@0: // michael@0: // XXX todo void registerExtensionHandler(in michael@0: // nsIFeedExtensionHandler, in long level); michael@0: michael@0: /** michael@0: * Parse a feed from an nsIInputStream. michael@0: * michael@0: * @param stream The input stream. michael@0: * @param uri The base URI. michael@0: */ michael@0: void parseFromStream(in nsIInputStream stream, in nsIURI uri); michael@0: michael@0: /** michael@0: * Parse a feed from a string. michael@0: * michael@0: * @param str The string to parse. michael@0: * @param uri The base URI. michael@0: */ michael@0: void parseFromString(in AString str, in nsIURI uri); michael@0: michael@0: /** michael@0: * Parse a feed asynchronously. The caller must then call the michael@0: * nsIFeedProcessor's nsIStreamListener methods to drive the michael@0: * parse. Do not call the other parse methods during an asynchronous michael@0: * parse. michael@0: * michael@0: * @param requestObserver The observer to notify on start/stop. This michael@0: * argument can be null. michael@0: * @param uri The base URI. michael@0: */ michael@0: void parseAsync(in nsIRequestObserver requestObserver, in nsIURI uri); michael@0: };