1/* -*- Mode: IDL; 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/. */
5
6#include "nsISupports.idl"
7#include "nsIFile.idl"
8
9// Note that the PrefixSet name is historical and we do properly support
10// duplicated values, so it's really a Prefix Trie.
11// All methods are thread-safe.
12[scriptable, uuid(3d8579f0-75fa-4e00-ba41-38661d5b5d17)]
13interface nsIUrlClassifierPrefixSet : nsISupports
14{
15  // Initialize the PrefixSet. Give it a name for memory reporting.
16  void init(in ACString aName);
17  // Fills the PrefixSet with the given array of prefixes.
18  // Can send an empty Array to clear the tree.
19  // Requires array to be sorted.
20  void setPrefixes([const, array, size_is(aLength)] in unsigned long aPrefixes,
21                   in unsigned long aLength);
22  void getPrefixes(out unsigned long aCount,
23                  [array, size_is(aCount), retval] out unsigned long aPrefixes);
24  // Do a lookup in the PrefixSet, return whether the value is present.
25  boolean contains(in unsigned long aPrefix);
26  boolean isEmpty();
27};
28