Visit Mozilla.org

nsITaggingService

From MDC

This article covers features introduced in Firefox 3


The nsITaggingService interfacee provides methods to tag/untag a URI,to retrieve URIs for a given tag, and to retrieve all tags for a URI.

Contents

nsITaggingService is defined in toolkit/components/places/public/nsITaggingService.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 1.9).

Inherits from: nsISupports

Implemented by: @mozilla.org/browser/tagging-service;1. To use this service, use:

var taggingSvc = Components.classes["@mozilla.org/browser/tagging-service;1"]
                           .getService(Components.interfaces.nsITaggingService);

[edit] Method overview

void tagURI(in nsIURI aURI, in nsIVariant aTags);
void untagURI(in nsIURI aURI, in nsIVariant aTags);
nsIVariant getURIsForTag(in AString aTag);
nsIVariant getTagsForURI(in nsIURI aURI);

[edit] Attributes

Attribute Type Description
allTags nsIVariant Retrieves all tags used to tag URIs in the data-base (sorted by name).
tagContainerIconSpec AUTF8String Retrieves the URL spec for the tag container icon

[edit] Methods

[edit] tagURI()

This method tags a URI with the given set of tags. Current tags set for the URL persist. Tags in aTags which are already set for the given URI are ignored.

 void tagURI(
   in nsIURI aURI, 
   in nsIVariant aTags
 );
[edit] Parameters
aURI
The URL to tag.
aTags
Array of tags to set for the given URI.

[edit] untagURI()

This method removes tags from a URI. Tags from aTags which are not set for the given URI are ignored.

 void untagURI(
   in nsIURI aURI, 
   in nsIVariant aTags
 );
[edit] Parameters
aURI
The URL to un-tag.
aTags
Array of tags to unset. Pass NULL to remove all tags from the given URI.

[edit] getURIsForTag()

This method retrieves all URIs tagged with the given tag.

 nsIVariant getURIsForTag(
   in AString aTag
 );
[edit] Parameters
aTag
The tag name.
[edit] Return value

Returns array of URIs tagged with aTag.

[edit] getTagsForURI()

This method retrieves all tags set for the given URI.

 nsIVariant getTagsForURI(
   in nsIURI aURI
 );
[edit] Parameters
aURI
A URL.
[edit] Return value

Returns array of tags (sorted by name).

[edit] See also