Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsIStreamListener.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIURI; |
michael@0 | 9 | interface nsIFeedResultListener; |
michael@0 | 10 | interface nsIInputStream; |
michael@0 | 11 | |
michael@0 | 12 | /** |
michael@0 | 13 | * An nsIFeedProcessor parses feeds, triggering callbacks based on |
michael@0 | 14 | * their contents. |
michael@0 | 15 | */ |
michael@0 | 16 | [scriptable, uuid(8a0b2908-21b0-45d7-b14d-30df0f92afc7)] |
michael@0 | 17 | interface nsIFeedProcessor : nsIStreamListener { |
michael@0 | 18 | |
michael@0 | 19 | /** |
michael@0 | 20 | * The listener that will respond to feed events. |
michael@0 | 21 | */ |
michael@0 | 22 | attribute nsIFeedResultListener listener; |
michael@0 | 23 | |
michael@0 | 24 | // Level is where to listen for the extension, a constant: FEED, |
michael@0 | 25 | // ENTRY, BOTH. |
michael@0 | 26 | // |
michael@0 | 27 | // XXX todo void registerExtensionHandler(in |
michael@0 | 28 | // nsIFeedExtensionHandler, in long level); |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * Parse a feed from an nsIInputStream. |
michael@0 | 32 | * |
michael@0 | 33 | * @param stream The input stream. |
michael@0 | 34 | * @param uri The base URI. |
michael@0 | 35 | */ |
michael@0 | 36 | void parseFromStream(in nsIInputStream stream, in nsIURI uri); |
michael@0 | 37 | |
michael@0 | 38 | /** |
michael@0 | 39 | * Parse a feed from a string. |
michael@0 | 40 | * |
michael@0 | 41 | * @param str The string to parse. |
michael@0 | 42 | * @param uri The base URI. |
michael@0 | 43 | */ |
michael@0 | 44 | void parseFromString(in AString str, in nsIURI uri); |
michael@0 | 45 | |
michael@0 | 46 | /** |
michael@0 | 47 | * Parse a feed asynchronously. The caller must then call the |
michael@0 | 48 | * nsIFeedProcessor's nsIStreamListener methods to drive the |
michael@0 | 49 | * parse. Do not call the other parse methods during an asynchronous |
michael@0 | 50 | * parse. |
michael@0 | 51 | * |
michael@0 | 52 | * @param requestObserver The observer to notify on start/stop. This |
michael@0 | 53 | * argument can be null. |
michael@0 | 54 | * @param uri The base URI. |
michael@0 | 55 | */ |
michael@0 | 56 | void parseAsync(in nsIRequestObserver requestObserver, in nsIURI uri); |
michael@0 | 57 | }; |