rdf/base/idl/nsIRDFXMLSink.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/rdf/base/idl/nsIRDFXMLSink.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,130 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/*
    1.10 +
    1.11 +  Interfaces for the RDF/XML sink, which parses RDF/XML into
    1.12 +  a graph representation.
    1.13 +
    1.14 +*/
    1.15 +
    1.16 +#include "nsISupports.idl"
    1.17 +
    1.18 +// XXX Until these get scriptable. See nsIRDFXMLSink::AddNameSpace()
    1.19 +[ptr] native nsIAtomPtr(nsIAtom);
    1.20 +[ref] native nsStringRef(nsString);
    1.21 +%{C++
    1.22 +class nsIAtom;
    1.23 +class nsString;
    1.24 +%}
    1.25 +
    1.26 +interface nsIRDFXMLSink;
    1.27 +
    1.28 +/**
    1.29 + * An observer that is notified as progress is made on the load
    1.30 + * of an RDF/XML document in an <code>nsIRDFXMLSink</code>.
    1.31 + */
    1.32 +[scriptable, uuid(EB1A5D30-AB33-11D2-8EC6-00805F29F370)]
    1.33 +interface nsIRDFXMLSinkObserver : nsISupports
    1.34 +{
    1.35 +    /**
    1.36 +     * Called when the load begins.
    1.37 +     * @param aSink the RDF/XML sink on which the load is beginning.
    1.38 +     */
    1.39 +    void onBeginLoad(in nsIRDFXMLSink aSink);
    1.40 +
    1.41 +    /**
    1.42 +     * Called when the load is suspended (e.g., for network quantization).
    1.43 +     * @param aSink the RDF/XML sink that is being interrupted.
    1.44 +     */
    1.45 +    void onInterrupt(in nsIRDFXMLSink aSink);
    1.46 +
    1.47 +    /**
    1.48 +     * Called when a suspended load is resuming.
    1.49 +     * @param aSink the RDF/XML sink that is resuming.
    1.50 +     */
    1.51 +    void onResume(in nsIRDFXMLSink aSink);
    1.52 +
    1.53 +    /**
    1.54 +     * Called when an RDF/XML load completes successfully.
    1.55 +     * @param aSink the RDF/XML sink that has finished loading.
    1.56 +     */
    1.57 +    void onEndLoad(in nsIRDFXMLSink aSink);
    1.58 +
    1.59 +    /**
    1.60 +     * Called when an error occurs during the load
    1.61 +     * @param aSink the RDF/XML sink in which the error occurred
    1.62 +     * @param aStatus the networking result code
    1.63 +     * @param aErrorMsg an error message, if applicable
    1.64 +     */
    1.65 +    void onError(in nsIRDFXMLSink aSink, in nsresult aStatus, in wstring aErrorMsg);
    1.66 +};
    1.67 +
    1.68 +
    1.69 +
    1.70 +/**
    1.71 + * A "sink" that receives and processes RDF/XML. This interface is used
    1.72 + * by the RDF/XML parser.
    1.73 + */
    1.74 +[scriptable, uuid(EB1A5D31-AB33-11D2-8EC6-00805F29F370)]
    1.75 +interface nsIRDFXMLSink : nsISupports
    1.76 +{
    1.77 +    /**
    1.78 +     * Set to <code>true</code> if the sink is read-only and cannot
    1.79 +     * be modified
    1.80 +     */
    1.81 +    attribute boolean readOnly;
    1.82 +
    1.83 +    /**
    1.84 +     * Initiate the RDF/XML load.
    1.85 +     */
    1.86 +    void beginLoad();
    1.87 +
    1.88 +    /**
    1.89 +     * Suspend the RDF/XML load.
    1.90 +     */
    1.91 +    void interrupt();
    1.92 +
    1.93 +    /**
    1.94 +     * Resume the RDF/XML load.
    1.95 +     */
    1.96 +    void resume();
    1.97 +
    1.98 +    /**
    1.99 +     * Complete the RDF/XML load.
   1.100 +     */
   1.101 +    void endLoad();
   1.102 +
   1.103 +    /**
   1.104 +     * Add namespace information to the RDF/XML sink.
   1.105 +     * @param aPrefix the namespace prefix
   1.106 +     * @param aURI the namespace URI
   1.107 +     */
   1.108 +    [noscript] void addNameSpace(in nsIAtomPtr aPrefix,
   1.109 +                                 [const] in nsStringRef aURI);
   1.110 +
   1.111 +    /**
   1.112 +     * Add an observer that will be notified as the RDF/XML load
   1.113 +     * progresses.
   1.114 +     * <p>
   1.115 +     *
   1.116 +     * Note that the sink will acquire a strong reference to the
   1.117 +     * observer, so care should be taken to avoid cyclical references
   1.118 +     * that cannot be released (i.e., if the observer holds a
   1.119 +     * reference to the sink, it should be sure that it eventually
   1.120 +     * clears the reference).
   1.121 +     *
   1.122 +     * @param aObserver the observer to add to the sink's set of
   1.123 +     * load observers.
   1.124 +     */
   1.125 +    void addXMLSinkObserver(in nsIRDFXMLSinkObserver aObserver);
   1.126 +
   1.127 +    /**
   1.128 +     * Remove an observer from the sink's set of observers.
   1.129 +     * @param aObserver the observer to remove.
   1.130 +     */
   1.131 +    void removeXMLSinkObserver(in nsIRDFXMLSinkObserver aObserver);
   1.132 +};
   1.133 +

mercurial