|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 #include "nsIRDFContainer.idl" |
|
8 #include "nsIRDFResource.idl" |
|
9 |
|
10 |
|
11 // Container utilities |
|
12 [scriptable, uuid(D4214E91-FB94-11D2-BDD8-00104BDE6048)] |
|
13 interface nsIRDFContainerUtils : nsISupports { |
|
14 /** |
|
15 * Returns 'true' if the property is an RDF ordinal property. |
|
16 */ |
|
17 boolean IsOrdinalProperty(in nsIRDFResource aProperty); |
|
18 |
|
19 /** |
|
20 * Convert the specified index to an ordinal property. |
|
21 */ |
|
22 nsIRDFResource IndexToOrdinalResource(in long aIndex); |
|
23 |
|
24 /** |
|
25 * Convert the specified ordinal property into an index |
|
26 */ |
|
27 long OrdinalResourceToIndex(in nsIRDFResource aOrdinal); |
|
28 |
|
29 /** |
|
30 * Return 'true' if the specified resource is a container |
|
31 */ |
|
32 boolean IsContainer(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); |
|
33 |
|
34 /** |
|
35 * Return 'true' if the specified resource is a container and it is empty |
|
36 */ |
|
37 boolean IsEmpty(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); |
|
38 |
|
39 /** |
|
40 * Return 'true' if the specified resource is a bag |
|
41 */ |
|
42 boolean IsBag(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); |
|
43 |
|
44 /** |
|
45 * Return 'true' if the specified resource is a sequence |
|
46 */ |
|
47 boolean IsSeq(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); |
|
48 |
|
49 /** |
|
50 * Return 'true' if the specified resource is an alternation |
|
51 */ |
|
52 boolean IsAlt(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); |
|
53 |
|
54 /** |
|
55 * Decorates the specified resource appropriately to make it |
|
56 * usable as an empty bag in the specified data source. |
|
57 */ |
|
58 nsIRDFContainer MakeBag(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); |
|
59 |
|
60 /** |
|
61 * Decorates the specified resource appropriately to make it |
|
62 * usable as an empty sequence in the specified data source. |
|
63 */ |
|
64 nsIRDFContainer MakeSeq(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); |
|
65 |
|
66 /** |
|
67 * Decorates the specified resource appropriately to make it |
|
68 * usable as an empty alternation in the specified data source. |
|
69 */ |
|
70 nsIRDFContainer MakeAlt(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); |
|
71 |
|
72 /** |
|
73 * Retrieve the index of element in the container. Returns -1 if |
|
74 * the element is not in the container. |
|
75 */ |
|
76 long indexOf(in nsIRDFDataSource aDataSource, in nsIRDFResource aContainer, in nsIRDFNode aElement); |
|
77 }; |
|
78 |
|
79 %{C++ |
|
80 extern nsresult |
|
81 NS_NewRDFContainerUtils(nsIRDFContainerUtils** aResult); |
|
82 %} |