1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include
"nsISupports.idl"
7 #include
"nsISupportsPrimitives.idl"
9 interface nsISimpleEnumerator
;
19 [scriptable
, builtinclass
, uuid(de021d54
-57a3
-4025-ae63
-4c8eedbe74c0
)]
20 interface nsICategoryEntry
: nsISupportsCString
22 readonly attribute ACString
entry;
24 readonly attribute ACString value
;
27 [builtinclass
, scriptable
, uuid(3275b2cd
-af6d
-429a
-80d7
-f0c5120342ac
)]
28 interface nsICategoryManager
: nsISupports
31 * Get the value for the given category's entry.
32 * @param aCategory The name of the category ("protocol")
33 * @param aEntry The entry you're looking for ("http")
36 ACString getCategoryEntry
(in ACString aCategory
, in ACString aEntry
);
39 * Add an entry to a category.
40 * @param aCategory The name of the category ("protocol")
41 * @param aEntry The entry to be added ("http")
42 * @param aValue The value for the entry ("moz.httprulez.1")
43 * @param aPersist Should this data persist between invocations?
44 * @param aReplace Should we replace an existing entry?
45 * @return Previous entry, if any
47 ACString addCategoryEntry
(in ACString aCategory
, in ACString aEntry
,
48 in ACString aValue
, in boolean aPersist
,
52 * Delete an entry from the category.
53 * @param aCategory The name of the category ("protocol")
54 * @param aEntry The entry to be added ("http")
55 * @param aPersist Delete persistent data from registry, if present?
57 void deleteCategoryEntry
(in ACString aCategory
, in ACString aEntry
,
61 * Delete a category and all entries.
62 * @param aCategory The category to be deleted.
64 void deleteCategory
(in ACString aCategory
);
67 * Enumerate the entries in a category.
68 * @param aCategory The category to be enumerated.
69 * @return a simple enumerator, each result QIs to
72 nsISimpleEnumerator enumerateCategory
(in ACString aCategory
);
76 * Enumerate all existing categories
77 * @param aCategory The category to be enumerated.
78 * @return a simple enumerator, each result QIs to
81 nsISimpleEnumerator enumerateCategories
();
86 GetCategoryEntry
(const char (&aCategory
)[N
], const nsACString
& aEntry
,
89 return GetCategoryEntry
(nsLiteralCString
(aCategory
),
93 template
<size_t N
, size_t M
>
95 GetCategoryEntry
(const char (&aCategory
)[N
], const char (&aEntry
)[M
],
98 return GetCategoryEntry
(nsLiteralCString
(aCategory
),
99 nsLiteralCString
(aEntry
),
104 AddCategoryEntry
(const nsACString
& aCategory
, const nsACString
& aEntry
,
105 const nsACString
& aValue
, bool aPersist
, bool aReplace
)
108 return AddCategoryEntry
(aCategory
, aEntry
, aValue
, aPersist
, aReplace
,
114 AddCategoryEntry
(const char (&aCategory
)[N
], const nsACString
& aEntry
,
115 const nsACString
& aValue
, bool aPersist
, bool aReplace
)
118 return AddCategoryEntry
(nsLiteralCString
(aCategory
), aEntry
, aValue
,
119 aPersist
, aReplace
, oldValue
);
124 DeleteCategoryEntry
(const char (&aCategory
)[N
], const nsACString
& aEntry
, bool aPersist
)
126 return DeleteCategoryEntry
(nsLiteralCString
(aCategory
), aEntry
, aPersist
);
132 EnumerateCategory
(const char (&aCategory
)[N
], nsISimpleEnumerator
** aResult
)
134 return EnumerateCategory
(nsLiteralCString
(aCategory
), aResult
);