Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsWebDAVInternal.h File Reference
#include "prlog.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsIWebDAVListener.h"
#include "nsIWebDAVResource.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define LOG(args)   PR_LOG(gDAVLog, 4, args)
#define LOG_ENABLED()   PR_LOG_TEST(gDAVLog, 4)

Functions

nsresult NS_WD_NewOperationStreamListener (nsIWebDAVResource *resource, nsIWebDAVOperationListener *listener, nsISupports *closure, PRUint32 operation, nsIStreamListener **streamListener)
nsIStreamListenerNS_WD_NewPropfindStreamListener (nsIWebDAVResource *resource, nsIWebDAVOperationListener *listener, nsISupports *closure, PRBool isPropname)
nsIStreamListenerNS_WD_NewReportStreamListener (nsIWebDAVResource *resource, nsIWebDAVOperationListener *listener, nsISupports *closure)
nsresult NS_WD_NewGetOperationRequestObserver (nsIWebDAVResource *resource, nsIWebDAVOperationListener *listener, nsISupports *closure, nsIOutputStream *outstream, nsIRequestObserver **observer)
nsresult NS_WD_NewGetToStringOperationRequestObserver (nsIWebDAVResource *resource, nsIWebDAVOperationListener *listener, nsISupports *closure, nsIStreamListener **streamListener)
nsresult NS_WD_GetElementByTagName (nsIDOMElement *parentElt, const nsAString &tagName, nsIDOMElement **elt)
nsresult NS_WD_ElementTextChildValue (nsIDOMElement *elt, const nsAString &tagName, nsAString &value)
nsresult NS_WD_AppendElementWithNS (nsIDOMDocument *doc, nsIDOMNode *parent, const nsAString &ns, const nsAString &tagName, nsIDOMElement **child)
nsresult NS_WD_GetDocAndResponseListFromBuffer (const nsACString &buffer, nsIDOMDocument **xmldoc, nsIDOMNodeList **responseList, PRUint32 *length)

Variables

PRLogModuleInfogDAVLog

Define Documentation

#define LOG (   args)    PR_LOG(gDAVLog, 4, args)

Definition at line 62 of file nsWebDAVInternal.h.

Definition at line 63 of file nsWebDAVInternal.h.


Function Documentation

nsresult NS_WD_AppendElementWithNS ( nsIDOMDocument doc,
nsIDOMNode parent,
const nsAString &  ns,
const nsAString &  tagName,
nsIDOMElement **  child 
)

Definition at line 93 of file nsWebDAVUtils.cpp.

{
    nsresult rv;
    nsCOMPtr<nsIDOMElement> childElt;
    nsCOMPtr<nsIDOMNode> junk;

    rv = doc->CreateElementNS(ns, tagName, getter_AddRefs(childElt));
    NS_ENSURE_SUCCESS(rv, rv);
    
    rv = parent->AppendChild(childElt, getter_AddRefs(junk));
    NS_ENSURE_SUCCESS(rv, rv);
    
    *child = childElt.get();
    NS_ADDREF(*child);
    
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_WD_ElementTextChildValue ( nsIDOMElement elt,
const nsAString &  tagName,
nsAString &  value 
)

Definition at line 78 of file nsWebDAVUtils.cpp.

{
    nsCOMPtr<nsIDOMElement> childElt;
    nsresult rv = NS_WD_GetElementByTagName(elt, tagName,
                                            getter_AddRefs(childElt));
    NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr<nsIDOM3Node> node3 = do_QueryInterface(childElt, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    return node3->GetTextContent(value);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_WD_GetDocAndResponseListFromBuffer ( const nsACString &  buffer,
nsIDOMDocument **  xmldoc,
nsIDOMNodeList **  responseList,
PRUint32 length 
)

Definition at line 114 of file nsWebDAVUtils.cpp.

{
    nsresult rv;

    nsCOMPtr<nsIDOMParser>
        parser(do_CreateInstance("@mozilla.org/xmlextras/domparser;1", &rv));
    NS_ENSURE_SUCCESS(rv, rv);

    nsPromiseFlatCString flat(buffer);

    PR_LOG(gDAVLog, 5, ("XML:\n\n%*s\n\n", flat.Length(), flat.get()));

    nsCOMPtr<nsIDOMDocument> doc;
    rv = parser->ParseFromBuffer(NS_REINTERPRET_CAST(const PRUint8 *,
                                                     flat.get()),
                                 flat.Length(), "text/xml",
                                 getter_AddRefs(doc));
    NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr<nsIDOMNodeList> list;
    rv = doc->GetElementsByTagNameNS(NS_LITERAL_STRING("DAV:"),
                                     NS_LITERAL_STRING("response"),
                                     getter_AddRefs(list));
    NS_ENSURE_SUCCESS(rv, rv);

    rv = list->GetLength(length);
    NS_ENSURE_SUCCESS(rv, rv);
    NS_ENSURE_TRUE(length, NS_ERROR_UNEXPECTED);

    NS_ADDREF(*xmldoc = doc.get());
    NS_ADDREF(*responseList = list.get());
    return NS_OK;
}

Here is the call graph for this function:

nsresult NS_WD_GetElementByTagName ( nsIDOMElement parentElt,
const nsAString &  tagName,
nsIDOMElement **  elt 
)

Definition at line 57 of file nsWebDAVUtils.cpp.

{
    nsresult rv;

    nsCOMPtr<nsIDOMNodeList> list;
    rv = parentElt->GetElementsByTagNameNS(NS_LITERAL_STRING("DAV:"), tagName, getter_AddRefs(list));
    NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr<nsIDOMNode> node;
    rv = list->Item(0, getter_AddRefs(node));
    NS_ENSURE_SUCCESS(rv, rv);

    if (!node) {
        return NS_OK;
    }

    return CallQueryInterface(node, elt);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_WD_NewGetOperationRequestObserver ( nsIWebDAVResource resource,
nsIWebDAVOperationListener listener,
nsISupports *  closure,
nsIOutputStream outstream,
nsIRequestObserver **  observer 
)

Definition at line 565 of file nsOperationStreamListeners.cpp.

{
    nsCOMPtr<nsIRequestObserver> osl = 
        new OperationStreamListener(resource, listener, closure, outstream,
                                    nsIWebDAVOperationListener::GET);
    if (!osl)
        return NS_ERROR_OUT_OF_MEMORY;
    return CallQueryInterface(osl, observer);
}

Here is the call graph for this function:

nsresult NS_WD_NewGetToStringOperationRequestObserver ( nsIWebDAVResource resource,
nsIWebDAVOperationListener listener,
nsISupports *  closure,
nsIStreamListener **  streamListener 
)

Definition at line 580 of file nsOperationStreamListeners.cpp.

{
    nsCOMPtr<nsIRequestObserver> osl = 
        new GetToStringStreamListener(resource, listener, closure);
    if (!osl)
        return NS_ERROR_OUT_OF_MEMORY;
    return CallQueryInterface(osl, streamListener);
}

Here is the call graph for this function:

nsresult NS_WD_NewOperationStreamListener ( nsIWebDAVResource resource,
nsIWebDAVOperationListener listener,
nsISupports *  closure,
PRUint32  operation,
nsIStreamListener **  streamListener 
)

Definition at line 550 of file nsOperationStreamListeners.cpp.

{
    nsCOMPtr<nsIRequestObserver> osl = 
        new OperationStreamListener(resource, listener, closure, nsnull,
                                    operation);
    if (!osl)
        return NS_ERROR_OUT_OF_MEMORY;
    return CallQueryInterface(osl, streamListener);
}

Here is the call graph for this function:

nsIStreamListener* NS_WD_NewPropfindStreamListener ( nsIWebDAVResource resource,
nsIWebDAVOperationListener listener,
nsISupports *  closure,
PRBool  isPropname 
)

Definition at line 533 of file nsOperationStreamListeners.cpp.

{
    return new PropfindStreamListener(resource, listener, closure, isPropname);
}

Here is the caller graph for this function:

nsIStreamListener* NS_WD_NewReportStreamListener ( nsIWebDAVResource resource,
nsIWebDAVOperationListener listener,
nsISupports *  closure 
)

Definition at line 542 of file nsOperationStreamListeners.cpp.

{
    return new ReportStreamListener(resource, listener, closure);
}

Variable Documentation