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.)

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

mercurial