pjs/xpcom/components/nsICategoryManager.idl

123 строки
4.5 KiB
Plaintext

/* -*- Mode: idl; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
#include "nsIEnumerator.idl"
#include "nsICategoryHandler.idl"
#include "nsIFactory.idl"
[scriptable, uuid(5a1e1a2c-1dd2-11b2-a72f-967357e43a00)]
interface nsICategoryManager : nsISupports
{
/**
* Get the value for the given category's entry.
* @param aCategory The name of the category ("protocol")
* @param aEntry The entry you're looking for ("http")
* @return The value.
*/
string getCategoryEntry(in string aCategory, in string aEntry);
/**
* As above, but do not permit overriding. This is useful to allow
* an override handler to get at the ``normal'' category contents.
*/
string getCategoryEntryRaw(in string aCategory, in string aEntry);
/**
* Add an entry to a category.
* @param aCategory The name of the category ("protocol")
* @param aEntry The entry to be added ("http")
* @param aValue The value for the entry ("moz.httprulez.1")
* @param aPersist Should we persist between invocations?
* @param aReplace Should we replace an existing entry?
* @return Previous entry, if any
*/
string addCategoryEntry(in string aCategory, in string aEntry,
in string aValue, in boolean aPersist,
in boolean aReplace);
/**
* Delete an entry from the category.
* @param aCategory The name of the category ("protocol")
* @param aEntry The entry to be added ("http")
* @param aPersist Delete entry from registry, if present?
* @return Previous entry, null if none.
*/
string deleteCategoryEntry(in string aCategory, in string aEntry,
in boolean aPersist);
/**
* Delete a category and all entries.
* @param aCategory The category to be deleted.
* @param aPersist Delete the category from the registry?
*/
void deleteCategory(in string aCategory);
/**
* Enumerate the entries in a category.
* @param aCategory The category to be enumerated.
*/
nsISimpleEnumerator enumerateCategory(in string aCategory);
/**
* Get all the category contents.
*/
void getCategoryContents(in string category,
[array, size_is(count)] out string entries,
[array, size_is(count)] out string values,
[retval] out unsigned long count);
const long OVERRIDE = 0;
const long FALLBACK = 1;
/*
* Register a category handler for override or fallback when
* searching a given category.
* @param aCategory The name of the category ("protocol")
* @param aHandler The handler to be installed
* @param aMode override or fallback?
* @return The previously-installed category handler, if any
*/
nsICategoryHandler registerCategoryHandler(in string aCategory,
in nsICategoryHandler aHandler,
in long aMode);
/*
* Unregister a category handler for the given category.
* XXX will this cause shutdown problems? Who has owning refs on whom?
* @param category The name of the category ("protocol")
* @param handler The handler to be unregistered.
* @param previous The handler that this one replaced, typically the
* return from the registerCategoryHandler call.
*/
void unregisterCategoryHandler(in string category,
in nsICategoryHandler handler,
in nsICategoryHandler previous);
};
%{C++
#define NS_CATEGORYMANAGER_CONTRACTID "@mozilla.org/categorymanager;1"
#define NS_CATEGORYMANAGER_CLASSNAME "Category Manager"
/* 16d222a6-1dd2-11b2-b693-f38b02c021b2 */
#define NS_CATEGORYMANAGER_CID \
{ 0x16d222a6, 0x1dd2, 0x11b2, \
{0xb6, 0x93, 0xf3, 0x8b, 0x02, 0xc0, 0x21, 0xb2} }
extern "C" NS_EXPORT nsresult NS_CategoryManagerGetFactory( nsIFactory** );
%}