1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is the directory index parsing code.
16 *
17 * The Initial Developer of the Original Code is
18 * Bradley Baetz.
19 * Portions created by the Initial Developer are Copyright (C) 2001
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 * Bradley Baetz <bbaetz@cs.mcgill.ca>
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39 #include "nsIStreamListener.idl"
40
41 interface nsIDirIndex;
42
43 /**
44 * This interface is used to receive contents of directory index listings
45 * from a protocol. They can then be transformed into an output format
46 * (such as rdf, html, etc)
47 */
48 [scriptable, uuid(fae4e9a8-1dd1-11b2-b53c-8f3aa1bbf8f5)]
49 interface nsIDirIndexListener : nsISupports {
50 /**
51 * Called for each directory entry
52 *
53 * @param request - the request
54 * @param ctxt - opaque parameter
55 * @param index - new index to add
56 */
57 void onIndexAvailable(in nsIRequest aRequest,
58 in nsISupports aCtxt,
59 in nsIDirIndex aIndex);
60
61 /**
62 * Called for each information line
63 *
64 * @param request - the request
65 * @param ctxt - opaque parameter
66 * @param info - new info to add
67 */
68 void onInformationAvailable(in nsIRequest aRequest,
69 in nsISupports aCtxt,
70 in AString aInfo);
71
72 };
73
74 %{C++
75 #define NS_IDIRINDEXLISTENER_KEY "@mozilla.org/dirIndexListener;1"
76 %}
77
78 /**
79 * A parser for application/http-index-format
80 */
81 [scriptable, uuid(38e3066c-1dd2-11b2-9b59-8be515c1ee3f)]
82 interface nsIDirIndexParser : nsIStreamListener {
83 /**
84 * The interface to use as a callback for new entries
85 */
86 attribute nsIDirIndexListener listener;
87
88 /**
89 * The comment given, if any
90 * This result is only valid _after_ OnStopRequest has occurred,
91 * because it can occur anywhere in the datastream
92 */
93 readonly attribute string comment;
94
95 /**
96 * The encoding to use
97 */
98 attribute string encoding;
99 };
100
101 %{C++
102 #define NS_DIRINDEXPARSER_CID \
103 { /* a0d6ad32-1dd1-11b2-aa55-a40187b54036 */ \
104 0xa0d6ad32, \
105 0x1dd1, \
106 0x11b2, \
107 { 0xaa, 0x55, 0xa4, 0x01, 0x87, 0xb5, 0x40, 0x36 } \
108 }
109
110 #define NS_DIRINDEXPARSER_CONTRACTID "@mozilla.org/dirIndexParser;1"
111
112 %}