content/base/src/nsContentListDeclarations.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsContentListDeclarations_h
michael@0 7 #define nsContentListDeclarations_h
michael@0 8
michael@0 9 #include <stdint.h>
michael@0 10 #include "nsCOMPtr.h"
michael@0 11 #include "nsStringFwd.h"
michael@0 12
michael@0 13 class nsContentList;
michael@0 14 class nsIAtom;
michael@0 15 class nsIContent;
michael@0 16 class nsINode;
michael@0 17
michael@0 18 // Magic namespace id that means "match all namespaces". This is
michael@0 19 // negative so it won't collide with actual namespace constants.
michael@0 20 #define kNameSpaceID_Wildcard INT32_MIN
michael@0 21
michael@0 22 // This is a callback function type that can be used to implement an
michael@0 23 // arbitrary matching algorithm. aContent is the content that may
michael@0 24 // match the list, while aNamespaceID, aAtom, and aData are whatever
michael@0 25 // was passed to the list's constructor.
michael@0 26 typedef bool (*nsContentListMatchFunc)(nsIContent* aContent,
michael@0 27 int32_t aNamespaceID,
michael@0 28 nsIAtom* aAtom,
michael@0 29 void* aData);
michael@0 30
michael@0 31 typedef void (*nsContentListDestroyFunc)(void* aData);
michael@0 32
michael@0 33 /**
michael@0 34 * A function that allocates the matching data for this
michael@0 35 * FuncStringContentList. Returning aString is perfectly fine; in
michael@0 36 * that case the destructor function should be a no-op.
michael@0 37 */
michael@0 38 typedef void* (*nsFuncStringContentListDataAllocator)(nsINode* aRootNode,
michael@0 39 const nsString* aString);
michael@0 40
michael@0 41 // If aMatchNameSpaceId is kNameSpaceID_Unknown, this will return a
michael@0 42 // content list which matches ASCIIToLower(aTagname) against HTML
michael@0 43 // elements in HTML documents and aTagname against everything else.
michael@0 44 // For any other value of aMatchNameSpaceId, the list will match
michael@0 45 // aTagname against all elements.
michael@0 46 already_AddRefed<nsContentList>
michael@0 47 NS_GetContentList(nsINode* aRootNode,
michael@0 48 int32_t aMatchNameSpaceId,
michael@0 49 const nsAString& aTagname);
michael@0 50
michael@0 51 already_AddRefed<nsContentList>
michael@0 52 NS_GetFuncStringNodeList(nsINode* aRootNode,
michael@0 53 nsContentListMatchFunc aFunc,
michael@0 54 nsContentListDestroyFunc aDestroyFunc,
michael@0 55 nsFuncStringContentListDataAllocator aDataAllocator,
michael@0 56 const nsAString& aString);
michael@0 57 already_AddRefed<nsContentList>
michael@0 58 NS_GetFuncStringHTMLCollection(nsINode* aRootNode,
michael@0 59 nsContentListMatchFunc aFunc,
michael@0 60 nsContentListDestroyFunc aDestroyFunc,
michael@0 61 nsFuncStringContentListDataAllocator aDataAllocator,
michael@0 62 const nsAString& aString);
michael@0 63
michael@0 64 #endif // nsContentListDeclarations_h

mercurial