nsIRDFContainerUtils.idl 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #include "nsISupports.idl"
  6. #include "nsIRDFContainer.idl"
  7. #include "nsIRDFResource.idl"
  8. // Container utilities
  9. [scriptable, uuid(D4214E91-FB94-11D2-BDD8-00104BDE6048)]
  10. interface nsIRDFContainerUtils : nsISupports {
  11. /**
  12. * Returns 'true' if the property is an RDF ordinal property.
  13. */
  14. boolean IsOrdinalProperty(in nsIRDFResource aProperty);
  15. /**
  16. * Convert the specified index to an ordinal property.
  17. */
  18. nsIRDFResource IndexToOrdinalResource(in long aIndex);
  19. /**
  20. * Convert the specified ordinal property into an index
  21. */
  22. long OrdinalResourceToIndex(in nsIRDFResource aOrdinal);
  23. /**
  24. * Return 'true' if the specified resource is a container
  25. */
  26. boolean IsContainer(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource);
  27. /**
  28. * Return 'true' if the specified resource is a container and it is empty
  29. */
  30. boolean IsEmpty(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource);
  31. /**
  32. * Return 'true' if the specified resource is a bag
  33. */
  34. boolean IsBag(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource);
  35. /**
  36. * Return 'true' if the specified resource is a sequence
  37. */
  38. boolean IsSeq(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource);
  39. /**
  40. * Return 'true' if the specified resource is an alternation
  41. */
  42. boolean IsAlt(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource);
  43. /**
  44. * Decorates the specified resource appropriately to make it
  45. * usable as an empty bag in the specified data source.
  46. */
  47. nsIRDFContainer MakeBag(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource);
  48. /**
  49. * Decorates the specified resource appropriately to make it
  50. * usable as an empty sequence in the specified data source.
  51. */
  52. nsIRDFContainer MakeSeq(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource);
  53. /**
  54. * Decorates the specified resource appropriately to make it
  55. * usable as an empty alternation in the specified data source.
  56. */
  57. nsIRDFContainer MakeAlt(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource);
  58. /**
  59. * Retrieve the index of element in the container. Returns -1 if
  60. * the element is not in the container.
  61. */
  62. long indexOf(in nsIRDFDataSource aDataSource, in nsIRDFResource aContainer, in nsIRDFNode aElement);
  63. };
  64. %{C++
  65. extern nsresult
  66. NS_NewRDFContainerUtils(nsIRDFContainerUtils** aResult);
  67. %}