XPCOM API Reference

  • Revision slug: XPCOM_API_Reference
  • Revision title: XPCOM API Reference
  • Revision id: 102646
  • Created:
  • Creator: Ptak82
  • Is current revision? No
  • Comment pl

Revision Content

This page is the new home of the XPCOM Reference that we are migrating from here. If you are inclined to help with this migration, your help would be very much appreciated.

There may also be additional information located in Creating XPCOM Components Appendix B; it is unclear how much of the documentation in CXC overlaps with that from the to-be-migrated XPCOM reference mentioned in the last paragraph.

Please see the talk page for information about available templates and categories you should use when creating / editing pages.


Overview

This reference describes the frozen interfaces and functions provided by the XPCOM library. It also details the helper classes and functions provided by the XPCOM glue library. This reference is oriented toward extension authors and embedders of XPCOM.

NOTE: If you are working on a module in the Mozilla codebase that is compiled with MOZILLA_INTERNAL_API, then some of these APIs--the string functions and classes in particular--may differ significantly from what you should use. See the XPCOM string guide for documentation on the string API used internally within the Mozilla codebase.

Frozen Components

These components may be accessed using the XPCOM Component Manager or Service Manager.

nsCategoryManager 
The XPCOM Category Manager.
nsDirectoryService 
The XPCOM Directory Service.
nsLocalFile 
A component implementing nsILocalFile.
nsObserverService 
The XPCOM Observer Service.
nsScriptableInputStream 
A component implementing nsIScriptableInputStream.
nsSupportsID 
A component implementing nsISupportsID.
nsSupportsCString 
A component implementing nsISupportsCString.
nsSupportsString 
A component implementing nsISupportsString.
nsSupportsPRBool 
A component implementing nsISupportsPRBool.
nsSupportsPRUint8 
A component implementing nsISupportsPRUint8.
nsSupportsPRUint16 
A component implementing nsISupportsPRUint16.
nsSupportsPRUint32 
A component implementing nsISupportsPRUint32.
nsSupportsPRUint64 
A component implementing nsISupportsPRUint64.
nsSupportsPRTime 
A component implementing nsISupportsPRTime.
nsSupportsChar 
A component implementing nsISupportsChar.
nsSupportsPRInt16 
A component implementing nsISupportsPRInt16.
nsSupportsPRInt32 
A component implementing nsISupportsPRInt32.
nsSupportsPRInt64 
A component implementing nsISupportsPRInt64.
nsSupportsFloat 
A component implementing nsISupportsFloat.
nsSupportsDouble 
A component implementing nsISupportsDouble.
nsSupportsVoid 
A component implementing nsISupportsVoid.
nsSupportsInterface 
A component implementing nsISupportsInterface.

Frozen Functions

These functions are exported from the XPCOM shared library.

Core Functions

NS_InitXPCOM2 
The NS_InitXPCOM2 function initiates use of XPCOM in the calling process.
NS_InitXPCOM3 
The NS_InitXPCOM3 function initiates use of XPCOM in the calling process with support for statically defined XPCOM modules.
NS_ShutdownXPCOM 
The NS_ShutdownXPCOM function terminates use of XPCOM in the calling process.
NS_GetComponentManager 
The NS_GetComponentManager function returns a reference to the XPCOM Component Manager.
NS_GetComponentRegistrar 
The NS_GetComponentRegistrar function returns a reference to the XPCOM Component Registrar.
NS_GetServiceManager 
The NS_GetServiceManager function returns a reference to the XPCOM Service Manager.
NS_GetMemoryManager 
The NS_GetMemoryManager function returns a reference to the XPCOM Memory Manager.
NS_NewLocalFile 
The NS_NewLocalFile function creates an instance of nsILocalFile that provides a platform independent representation of a file path.
NS_NewNativeLocalFile 
The NS_NewNativeLocalFile function creates an instance of nsILocalFile that provides a platform independent representation of a file path.
NS_Alloc 
Allocates a block of memory using the XPCOM Memory Manager.
NS_Realloc 
Reallocates a block of memory using the XPCOM Memory Manager.
NS_Free 
Frees a block of memory using the XPCOM Memory Manager.

String Functions

These are the low-level "string" APIs provided by XPCOM as part of its frozen API. It is often better to use one of the string classes instead of using these functions directly.

NS_CStringContainerInit 
The NS_CStringContainerInit function initializes a nsCStringContainer instance for use as a nsACString.
NS_CStringContainerInit2 
The NS_CStringContainerInit2 function initializes a nsCStringContainer instance for use as a nsACString.
NS_CStringContainerFinish 
The NS_CStringContainerFinish function releases any memory allocated by a nsCStringContainer instance.
NS_CStringGetData 
The NS_CStringGetData function gives the caller read access to the string's internal buffer.
NS_CStringGetMutableData 
The NS_CStringGetDataMutable function gives the caller write access to the string's internal buffer.
NS_CStringSetData 
The NS_CStringSetData function copies data into the string's internal buffer.
NS_CStringSetDataRange 
The NS_CStringSetDataRange function copies data into a section of the string's internal buffer.
NS_CStringCopy 
The NS_CStringCopy function copies the value from one nsACString instance to another.
NS_CStringAppendData 
The NS_CStringAppendData function appends data to the existing value of a nsACString instance.
NS_CStringInsertData 
The NS_CStringInsertData function appends data to the existing value of a nsACString instance.
NS_CStringCutData 
The NS_CStringCutData function removes a section of the string's internal buffer.
NS_CStringCloneData 
The NS_CStringCloneData function returns a null-terminated, heap allocated copy of the string's internal buffer.
NS_StringContainerInit 
The NS_StringContainerInit function initializes a nsStringContainer instance for use as a nsAString.
NS_StringContainerInit2 
...
NS_StringContainerFinish 
The NS_StringContainerFinish function releases any memory allocated by a nsStringContainer instance.
NS_StringGetData 
The NS_StringGetData function gives the caller access to the string's internal buffer.
NS_StringGetMutableData 
...
NS_StringSetData 
The NS_StringSetData function copies data into the string's internal buffer.
NS_StringSetDataRange 
The NS_StringSetDataRange function copies data into a section of the string's internal buffer.
NS_StringCopy 
The NS_StringCopy function copies the value from one nsAString instance to another.
NS_StringAppendData 
The NS_StringAppendData function appends data to the existing value of a nsAString instance.
NS_StringInsertData 
The NS_StringInsertData function appends data to the existing value of a nsACString instance.
NS_StringCutData 
The NS_StringCutData function removes a section of the string's internal buffer.
NS_StringCloneData 
The NS_StringCloneData function returns a null-terminated, heap allocated copy of the string's internal buffer.
NS_CStringToUTF16 
The NS_CStringToUTF16 function converts the value of a nsACString instance to UTF-16 and stores the result in a nsAString instance.
NS_UTF16ToCString  
The NS_UTF16ToCString function converts the value of a nsAString instance from UTF-16 to the specified multi-byte encoding and stores the result in a nsACString instance.

Frozen Interfaces

Core

nsICategoryManager 
The nsICategoryManager interface provides access to a data structure that holds a list of name-value pairs, called categories, where each value is a list of strings.
nsIClassInfo 
The nsIClassInfo interface provides information about a specific implementation class.
nsIComponentManager 
The nsIComponentManager interface provides methods to access factory objects and instantiate instances of classes.
nsIComponentRegistrar 
The nsIComponentRegistrar interface provides methods to access and modify the XPCOM component registry.
nsIFactory 
The nsIFactory interface allows for the creation of nsISupports derived classes without specifying a concrete class type.
nsIInterfaceRequestor 
The nsIInterfaceRequestor interface defines a generic interface for requesting interfaces that a given object might provide access to.
nsIModule 
The nsIModule interface must be implemented by each XPCOM component. It is the main entry point by which the system accesses an XPCOM component.
nsIMemory 
The nsIMemory interface represents a generic memory allocator.
nsIObserver 
The nsIObserver interface is a generic notification callback interface that is typically used in conjunction with nsIObserverService.
nsIObserverService 
The nsIObserverService interface provides methods to add, remove, notify, and enumerate observers of various notifications.
nsIProgrammingLanguage 
The nsIProgrammingLanguage interface provides an enumeration of programming language identifiers.
nsIProperties 
The nsIProperties interface provides methods to access a map of named XPCOM object values.
nsIServiceManager 
The nsIServiceManager manager interface provides a means to obtain global services in an application.
nsISimpleEnumerator 
The nsISimpleEnumerator interface represents an enumeration of XPCOM objects and provides methods to access elements sequentially.
nsISupports 
All XPCOM interfaces inherit the nsISupports interface.
nsISupportsWeakReference 
The nsISupportsWeakReference interface is a factory interface, which produces appropriate instances of nsIWeakReference.
nsIWeakReference 
The nsIWeakReference interface represents a proxy for an XPCOM object. It allows a consumer to hold an indirect, non-owning reference to an XPCOM object.

Files and Directories

nsIFile 
The nsIFile interface represents a file or directory location in a platform-independent manner.
nsILocalFile 
The nsILocalFile interface represents a file or directory location in a platform-independent manner that is accessible on the local filesystem. It extends nsIFile.
nsIDirectoryService 
The nsIDirectoryService interface provides methods to initialize and configure a directory service instance.
nsIDirectoryServiceProvider 
The nsIDirectoryServiceProvider interface is used by the Directory Service to get file locations.
nsIDirectoryServiceProvider2 
The nsIDirectoryServiceProvider2 interface is used by the Directory Service to get an enumeration of file locations.

Streams

nsIInputStream 
The nsIInputStream interface represents a readable data source.
nsIOutputStream 
The nsIOutputStream interface represents a writable data sink.
nsIScriptableInputStream 
The nsIScriptableInputStream interface provides scriptable access to a nsIInputStream instance.

Primitives

nsISupportsPrimitive 
The nsISupportsPrimitive interface serves as a base interface for all of the nsISupports* family of interfaces.
nsISupportsPRBool 
The nsISupportsPRBool interface provides scriptable access for boolean values.
nsISupportsChar 
The nsISupportsChar interface provides scriptable access for single character values (often used to store an ASCII character).
nsISupportsPRInt16 
The nsISupportsPRInt16 interface provides scriptable access for 16-bit signed integers.
nsISupportsPRInt32 
The nsISupportsPRInt32 interface provides scriptable access for 32-bit signed integers.
nsISupportsPRInt64 
The nsISupportsPRInt64 interface provides scriptable access for 64-bit signed integers.
nsISupportsPRUint16 
The nsISupportsPRUint16 interface provides scriptable access for 16-bit unsigned integers.
nsISupportsPRUint32 
The nsISupportsPRUint32 interface provides scriptable access for 32-bit unsigned integers.
nsISupportsPRUint64 
The nsISupportsPRUint64 interface provides scriptable access for 64-bit unsigned integers.
nsISupportsPRUint8 
The nsISupportsPRUint8 interface provides scriptable access for 8-bit unsigned integers.
nsISupportsDouble 
The nsISupportsDouble interface provides scriptable access for double-precision floating-point values.
nsISupportsFloat 
The nsISupportsFloat interface provides scriptable access for single-precision floating-point values.
nsISupportsPRTime 
The nsISupportsPRTime interface provides scriptable access for PRTime values.
nsISupportsCString 
The nsISupportsCString interface provides scriptable access for ASCII character strings.
nsISupportsString 
The nsISupportsString interface provides scriptable access for Unicode character strings.
nsISupportsVoid 
The nsISupportsVoid interface provides scriptable access for generic pointers. values.
nsISupportsID 
The nsISupportsID interface provides scriptable access for boolean values.
nsISupportsInterfacePointer 
The nsISupportsInterfacePointer interface provides scriptable access for XPCOM objects.

XPCOM "Glue" Classes and Functions

These classes and functions are provided to simplify the use of XPCOM from C++. They are not part of the frozen XPCOM API, which means that they may evolve over time. When these classes are used by a component, it may be necessary to link the component against the XPCOM glue library.

Core

nsCOMPtr 
This utility class simplifies managing XPCOM interface references from C++ code.
nsMemory 
The nsMemory class provides static helper routines to manage memory. These routines allow easy access to XPCOM's global nsIMemory implementation without having to go through the service manager to get it.
nsSupportsWeakReference 
Inherit from this C++ class to add canonical support for nsISupportsWeakReference.

String

nsACString 
The nsACString abstract class represents a character string composed of single-byte storage units. This class is typically used to represent ASCII or UTF-8 character arrays.
nsAString 
The nsAString abstract class represents a character string composed of double-byte storage units. This class is typically used to represent Unicode character arrays.
nsEmbedString 
The nsEmbedString concrete class provides a way to construct a nsAString object that allocates null-terminated storage.
nsEmbedCString 
The nsEmbedCString concrete class provides a way to construct a nsACString object that allocates null-terminated storage.
nsString 
...
nsCString 
...
nsDependentString 
...
nsDependentCString 
...
nsDependentSubstring 
...
nsDependentCSubstring 
...
NS_ConvertASCIItoUTF16 
...
NS_ConvertUTF8toUTF16 
...
NS_ConvertUTF16toUTF8 
...
NS_LossyConvertUTF16toASCII 
...
nsLiteralCString 
...
nsLiteralString 
...
getter_Copies 
...
Substring 
...
StringHead 
...
StringTail 
...
EmptyString 
...
EmptyCString 
...

Original Document Information

  • Author: Darin Fisher
  • Last Updated Date: 2005/01/20
  • Copyright Information: Copyright © 2004-2005
{{ wiki.languages( { "ja": "ja/XPCOM_API_Reference", "pl": "pl/Dokumentacja_API_XPCOM" } ) }}

Revision Source

<p>
</p>
<div class="note">
<p>This page is the new home of the XPCOM Reference that we are migrating from <a class="external" href="http://developer.mozilla.org/xpcom/api/">here</a>. If you are inclined to help with this migration, your help would be very much appreciated.
</p><p>There may also be additional information located in <a class="external" href="http://www.mozilla.org/projects/xpcom/book/cxc/html/appB.html">Creating XPCOM Components Appendix B</a>; it is unclear how much of the documentation in <abbr title="Creating XPCOM Components">CXC</abbr> overlaps with that from the to-be-migrated XPCOM reference mentioned in the last paragraph.
</p><p>Please see the <a href="Talk:en/XPCOM_API_Reference">talk page</a> for information about available templates and categories you should use when creating / editing pages.
</p>
</div>
<p><br>
</p>
<h3 name="Overview"> Overview </h3>
<p>This reference describes the <a href="en/Interfaces/About_Frozen_Interfaces">frozen</a> interfaces and functions provided by the <a href="en/XPCOM">XPCOM</a> library.  It also details the helper classes and functions provided by the <a href="en/XPCOM_Glue">XPCOM glue</a> library.  This reference is oriented toward extension authors and embedders of XPCOM.
</p>
<div class="note">
<p><b>NOTE:</b> If you are working on a module in the Mozilla codebase that is compiled with <code>MOZILLA_INTERNAL_API</code>, then some of these APIs--the string functions and classes in particular--may differ significantly from what you should use.  See the <a href="en/XPCOM_string_guide">XPCOM string guide</a> for documentation on the string API used internally within the Mozilla codebase.
</p>
</div>
<h3 name="Frozen_Components"> Frozen Components </h3>
<p>These components may be accessed using the XPCOM Component Manager or Service Manager.
</p>
<dl><dt> <a href="en/NsCategoryManager">nsCategoryManager</a> </dt><dd> The XPCOM Category Manager.
</dd></dl>
<dl><dt> <a href="en/NsDirectoryService">nsDirectoryService</a> </dt><dd> The XPCOM Directory Service.
</dd></dl>
<dl><dt> <a href="en/NsLocalFile">nsLocalFile</a> </dt><dd> A component implementing <code>nsILocalFile</code>.
</dd></dl>
<dl><dt> <a href="en/NsObserverService">nsObserverService</a> </dt><dd> The XPCOM Observer Service.
</dd></dl>
<dl><dt> <a href="en/NsScriptableInputStream">nsScriptableInputStream</a> </dt><dd> A component implementing <code>nsIScriptableInputStream</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsID">nsSupportsID</a> </dt><dd> A component implementing <code>nsISupportsID</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsCString">nsSupportsCString</a> </dt><dd> A component implementing <code>nsISupportsCString</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsString">nsSupportsString</a> </dt><dd> A component implementing <code>nsISupportsString</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsPRBool">nsSupportsPRBool</a> </dt><dd> A component implementing <code>nsISupportsPRBool</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsPRUint8">nsSupportsPRUint8</a> </dt><dd> A component implementing <code>nsISupportsPRUint8</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsPRUint16">nsSupportsPRUint16</a> </dt><dd> A component implementing <code>nsISupportsPRUint16</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsPRUint32">nsSupportsPRUint32</a> </dt><dd> A component implementing <code>nsISupportsPRUint32</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsPRUint64">nsSupportsPRUint64</a> </dt><dd> A component implementing <code>nsISupportsPRUint64</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsPRTime">nsSupportsPRTime</a> </dt><dd> A component implementing <code>nsISupportsPRTime</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsChar">nsSupportsChar</a> </dt><dd> A component implementing <code>nsISupportsChar</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsPRInt16">nsSupportsPRInt16</a> </dt><dd> A component implementing <code>nsISupportsPRInt16</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsPRInt32">nsSupportsPRInt32</a> </dt><dd> A component implementing <code>nsISupportsPRInt32</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsPRInt64">nsSupportsPRInt64</a> </dt><dd> A component implementing <code>nsISupportsPRInt64</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsFloat">nsSupportsFloat</a> </dt><dd> A component implementing <code>nsISupportsFloat</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsDouble">nsSupportsDouble</a> </dt><dd> A component implementing <code>nsISupportsDouble</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsVoid">nsSupportsVoid</a> </dt><dd> A component implementing <code>nsISupportsVoid</code>.
</dd></dl>
<dl><dt> <a href="en/NsSupportsInterface">nsSupportsInterface</a> </dt><dd> A component implementing <code>nsISupportsInterface</code>.
</dd></dl>
<h3 name="Frozen_Functions"> Frozen Functions </h3>
<p>These functions are exported from the XPCOM shared library.
</p>
<h4 name="Core_Functions"> Core Functions </h4>
<dl><dt> <a href="en/NS_InitXPCOM2">NS_InitXPCOM2</a> </dt><dd> The <code>NS_InitXPCOM2</code> function initiates use of XPCOM in the calling process.
</dd></dl>
<dl><dt> <a href="en/NS_InitXPCOM3">NS_InitXPCOM3</a> </dt><dd> The <code>NS_InitXPCOM3</code> function initiates use of XPCOM in the calling process with support for statically defined XPCOM modules.
</dd></dl>
<dl><dt> <a href="en/NS_ShutdownXPCOM">NS_ShutdownXPCOM</a> </dt><dd> The <code>NS_ShutdownXPCOM</code> function terminates use of XPCOM in the calling process. 
</dd></dl>
<dl><dt> <a href="en/NS_GetComponentManager">NS_GetComponentManager</a> </dt><dd> The <code>NS_GetComponentManager</code> function returns a reference to the XPCOM Component Manager. 
</dd></dl>
<dl><dt> <a href="en/NS_GetComponentRegistrar">NS_GetComponentRegistrar</a> </dt><dd> The <code>NS_GetComponentRegistrar</code> function returns a reference to the XPCOM Component Registrar. 
</dd></dl>
<dl><dt> <a href="en/NS_GetServiceManager">NS_GetServiceManager</a> </dt><dd> The <code>NS_GetServiceManager</code> function returns a reference to the XPCOM Service Manager. 
</dd></dl>
<dl><dt> <a href="en/NS_GetMemoryManager">NS_GetMemoryManager</a> </dt><dd> The <code>NS_GetMemoryManager</code> function returns a reference to the XPCOM Memory Manager. 
</dd></dl>
<dl><dt> <a href="en/NS_NewLocalFile">NS_NewLocalFile</a> </dt><dd> The <code>NS_NewLocalFile</code> function creates an instance of <code>nsILocalFile</code> that provides a platform independent representation of a file path. 
</dd></dl>
<dl><dt> <a href="en/NS_NewNativeLocalFile">NS_NewNativeLocalFile</a> </dt><dd> The <code>NS_NewNativeLocalFile</code> function creates an instance of <code>nsILocalFile</code> that provides a platform independent representation of a file path.
</dd></dl>
<dl><dt> <a href="en/NS_Alloc">NS_Alloc</a> </dt><dd> Allocates a block of memory using the XPCOM Memory Manager.
</dd></dl>
<dl><dt> <a href="en/NS_Realloc">NS_Realloc</a> </dt><dd> Reallocates a block of memory using the XPCOM Memory Manager.
</dd></dl>
<dl><dt> <a href="en/NS_Free">NS_Free</a> </dt><dd> Frees a block of memory using the XPCOM Memory Manager.
</dd></dl>
<h4 name="String_Functions"> String Functions </h4>
<p>These are the low-level "string" APIs provided by XPCOM as part of its frozen API.  It is often better to use one of the <a href="#String">string classes</a> instead of using these functions directly.  
</p>
<dl><dt> <a href="en/NS_CStringContainerInit">NS_CStringContainerInit</a> </dt><dd> The <code>NS_CStringContainerInit</code> function initializes a <code>nsCStringContainer</code> instance for use as a <code>nsACString</code>.
</dd></dl>
<dl><dt> <a href="en/NS_CStringContainerInit2">NS_CStringContainerInit2</a> </dt><dd> The <code>NS_CStringContainerInit2</code> function initializes a <code>nsCStringContainer</code> instance for use as a <code>nsACString</code>.
</dd></dl>
<dl><dt> <a href="en/NS_CStringContainerFinish">NS_CStringContainerFinish</a> </dt><dd> The <code>NS_CStringContainerFinish</code> function releases any memory allocated by a <code>nsCStringContainer</code> instance.
</dd></dl>
<dl><dt> <a href="en/NS_CStringGetData">NS_CStringGetData</a> </dt><dd> The <code>NS_CStringGetData</code> function gives the caller read access to the string's internal buffer.
</dd></dl>
<dl><dt> <a href="en/NS_CStringGetMutableData">NS_CStringGetMutableData</a> </dt><dd> The <code>NS_CStringGetDataMutable</code> function gives the caller write access to the string's internal buffer.
</dd></dl>
<dl><dt> <a href="en/NS_CStringSetData">NS_CStringSetData</a> </dt><dd> The <code>NS_CStringSetData</code> function copies data into the string's internal buffer.
</dd></dl>
<dl><dt> <a href="en/NS_CStringSetDataRange">NS_CStringSetDataRange</a> </dt><dd> The <code>NS_CStringSetDataRange</code> function copies data into a section of the string's internal buffer.
</dd></dl>
<dl><dt> <a href="en/NS_CStringCopy">NS_CStringCopy</a> </dt><dd> The <code>NS_CStringCopy</code> function copies the value from one <code>nsACString</code> instance to another.
</dd></dl>
<dl><dt> <a href="en/NS_CStringAppendData">NS_CStringAppendData</a> </dt><dd> The <code>NS_CStringAppendData</code> function appends data to the existing value of a <code>nsACString</code> instance.
</dd></dl>
<dl><dt> <a href="en/NS_CStringInsertData">NS_CStringInsertData</a> </dt><dd> The <code>NS_CStringInsertData</code> function appends data to the existing value of a <code>nsACString</code> instance.
</dd></dl>
<dl><dt> <a href="en/NS_CStringCutData">NS_CStringCutData</a> </dt><dd> The <code>NS_CStringCutData</code> function removes a section of the string's internal buffer.
</dd></dl>
<dl><dt> <a href="en/NS_CStringCloneData">NS_CStringCloneData</a> </dt><dd> The <code>NS_CStringCloneData</code> function returns a null-terminated, heap allocated copy of the string's internal buffer. 
</dd></dl>
<dl><dt> <a href="en/NS_StringContainerInit">NS_StringContainerInit</a> </dt><dd> The <code>NS_StringContainerInit</code> function initializes a <code>nsStringContainer</code> instance for use as a <code>nsAString</code>.
</dd></dl>
<dl><dt> <a href="en/NS_StringContainerInit2">NS_StringContainerInit2</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NS_StringContainerFinish">NS_StringContainerFinish</a> </dt><dd> The <code>NS_StringContainerFinish</code> function releases any memory allocated by a <code>nsStringContainer</code> instance.
</dd></dl>
<dl><dt> <a href="en/NS_StringGetData">NS_StringGetData</a> </dt><dd> The <code>NS_StringGetData</code> function gives the caller access to the string's internal buffer.
</dd></dl>
<dl><dt> <a href="en/NS_StringGetMutableData">NS_StringGetMutableData</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NS_StringSetData">NS_StringSetData</a> </dt><dd> The <code>NS_StringSetData</code> function copies data into the string's internal buffer.
</dd></dl>
<dl><dt> <a href="en/NS_StringSetDataRange">NS_StringSetDataRange</a> </dt><dd> The <code>NS_StringSetDataRange</code> function copies data into a section of the string's internal buffer.
</dd></dl>
<dl><dt> <a href="en/NS_StringCopy">NS_StringCopy</a> </dt><dd> The <code>NS_StringCopy</code> function copies the value from one <code>nsAString</code> instance to another.
</dd></dl>
<dl><dt> <a href="en/NS_StringAppendData">NS_StringAppendData</a> </dt><dd> The <code>NS_StringAppendData</code> function appends data to the existing value of a <code>nsAString</code> instance.
</dd></dl>
<dl><dt> <a href="en/NS_StringInsertData">NS_StringInsertData</a> </dt><dd> The <code>NS_StringInsertData</code> function appends data to the existing value of a <code>nsACString</code> instance.
</dd></dl>
<dl><dt> <a href="en/NS_StringCutData">NS_StringCutData</a> </dt><dd> The <code>NS_StringCutData</code> function removes a section of the string's internal buffer.
</dd></dl>
<dl><dt> <a href="en/NS_StringCloneData">NS_StringCloneData</a> </dt><dd> The <code>NS_StringCloneData</code> function returns a null-terminated, heap allocated copy of the string's internal buffer. 
</dd></dl>
<dl><dt> <a href="en/NS_CStringToUTF16">NS_CStringToUTF16</a> </dt><dd> The <code>NS_CStringToUTF16</code> function converts the value of a <code>nsACString</code> instance to UTF-16 and stores the result in a <code>nsAString</code> instance.
</dd></dl>
<dl><dt> <a href="en/NS_UTF16ToCString">NS_UTF16ToCString</a>   </dt><dd> The <code>NS_UTF16ToCString</code> function converts the value of a <code>nsAString</code> instance from UTF-16 to the specified multi-byte encoding and stores the result in a <code>nsACString</code> instance.
</dd></dl>
<h3 name="Frozen_Interfaces"> Frozen Interfaces </h3>
<h4 name="Core"> Core </h4>
<dl><dt> <a href="en/NsICategoryManager">nsICategoryManager</a> </dt><dd> The <code>nsICategoryManager</code> interface provides access to a data structure that holds a list of name-value pairs, called categories, where each value is a list of strings. 
</dd></dl>
<dl><dt> <a href="en/NsIClassInfo">nsIClassInfo</a> </dt><dd> The <code>nsIClassInfo</code> interface provides information about a specific implementation class. 
</dd></dl>
<dl><dt> <a href="en/NsIComponentManager">nsIComponentManager</a> </dt><dd> The <code>nsIComponentManager</code> interface provides methods to access factory objects and instantiate instances of classes. 
</dd></dl>
<dl><dt> <a href="en/NsIComponentRegistrar">nsIComponentRegistrar</a> </dt><dd> The <code>nsIComponentRegistrar</code> interface provides methods to access and modify the XPCOM component registry. 
</dd></dl>
<dl><dt> <a href="en/NsIFactory">nsIFactory</a> </dt><dd> The <code>nsIFactory</code> interface allows for the creation of <code>nsISupports</code> derived classes without specifying a concrete class type. 
</dd></dl>
<dl><dt> <a href="en/NsIInterfaceRequestor">nsIInterfaceRequestor</a> </dt><dd> The <code>nsIInterfaceRequestor</code> interface defines a generic interface for requesting interfaces that a given object might provide access to. 
</dd></dl>
<dl><dt> <a href="en/NsIModule">nsIModule</a> </dt><dd> The <code>nsIModule</code> interface must be implemented by each XPCOM component. It is the main entry point by which the system accesses an XPCOM component. 
</dd></dl>
<dl><dt> <a href="en/NsIMemory">nsIMemory</a> </dt><dd> The <code>nsIMemory</code> interface represents a generic memory allocator. 
</dd></dl>
<dl><dt> <a href="en/NsIObserver">nsIObserver</a> </dt><dd> The <code>nsIObserver</code> interface is a generic notification callback interface that is typically used in conjunction with <code>nsIObserverService</code>. 
</dd></dl>
<dl><dt> <a href="en/NsIObserverService">nsIObserverService</a> </dt><dd> The <code>nsIObserverService</code> interface provides methods to add, remove, notify, and enumerate observers of various notifications. 
</dd></dl>
<dl><dt> <a href="en/NsIProgrammingLanguage">nsIProgrammingLanguage</a> </dt><dd> The <code>nsIProgrammingLanguage</code> interface provides an enumeration of programming language identifiers. 
</dd></dl>
<dl><dt> <a href="en/NsIProperties">nsIProperties</a> </dt><dd> The <code>nsIProperties</code> interface provides methods to access a map of named XPCOM object values. 
</dd></dl>
<dl><dt> <a href="en/NsIServiceManager">nsIServiceManager</a> </dt><dd> The <code>nsIServiceManager</code> manager interface provides a means to obtain global services in an application. 
</dd></dl>
<dl><dt> <a href="en/NsISimpleEnumerator">nsISimpleEnumerator</a> </dt><dd> The <code>nsISimpleEnumerator</code> interface represents an enumeration of XPCOM objects and provides methods to access elements sequentially. 
</dd></dl>
<dl><dt> <a href="en/NsISupports">nsISupports</a> </dt><dd> All XPCOM interfaces inherit the <code>nsISupports</code> interface. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsWeakReference">nsISupportsWeakReference</a> </dt><dd> The <code>nsISupportsWeakReference</code> interface is a factory interface, which produces appropriate instances of <code>nsIWeakReference</code>. 
</dd></dl>
<dl><dt> <a href="en/NsIWeakReference">nsIWeakReference</a> </dt><dd> The <code>nsIWeakReference</code> interface represents a proxy for an XPCOM object. It allows a consumer to hold an indirect, non-owning reference to an XPCOM object.
</dd></dl>
<h4 name="Files_and_Directories"> Files and Directories </h4>
<dl><dt> <a href="en/NsIFile">nsIFile</a> </dt><dd> The <code>nsIFile</code> interface represents a file or directory location in a platform-independent manner. 
</dd></dl>
<dl><dt> <a href="en/NsILocalFile">nsILocalFile</a> </dt><dd> The <code>nsILocalFile</code> interface represents a file or directory location in a platform-independent manner that is accessible on the local filesystem. It extends nsIFile. 
</dd></dl>
<dl><dt> <a href="en/NsIDirectoryService">nsIDirectoryService</a> </dt><dd> The <code>nsIDirectoryService</code> interface provides methods to initialize and configure a directory service instance. 
</dd></dl>
<dl><dt> <a href="en/NsIDirectoryServiceProvider">nsIDirectoryServiceProvider</a> </dt><dd> The <code>nsIDirectoryServiceProvider</code> interface is used by the Directory Service to get file locations. 
</dd></dl>
<dl><dt> <a href="en/NsIDirectoryServiceProvider2">nsIDirectoryServiceProvider2</a> </dt><dd> The <code>nsIDirectoryServiceProvider2</code> interface is used by the Directory Service to get an enumeration of file locations.
</dd></dl>
<h4 name="Streams"> Streams </h4>
<dl><dt> <a href="en/NsIInputStream">nsIInputStream</a> </dt><dd> The <code>nsIInputStream</code> interface represents a readable data source. 
</dd></dl>
<dl><dt> <a href="en/NsIOutputStream">nsIOutputStream</a> </dt><dd> The <code>nsIOutputStream</code> interface represents a writable data sink. 
</dd></dl>
<dl><dt> <a href="en/NsIScriptableInputStream">nsIScriptableInputStream</a> </dt><dd> The <code>nsIScriptableInputStream</code> interface provides scriptable access to a <code>nsIInputStream</code> instance.
</dd></dl>
<h4 name="Primitives"> Primitives </h4>
<dl><dt> <a href="en/NsISupportsPrimitive">nsISupportsPrimitive</a> </dt><dd> The <code>nsISupportsPrimitive</code> interface serves as a base interface for all of the <code>nsISupports*</code> family of interfaces. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsPRBool">nsISupportsPRBool</a> </dt><dd> The <code>nsISupportsPRBool</code> interface provides scriptable access for boolean values. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsChar">nsISupportsChar</a> </dt><dd> The <code>nsISupportsChar</code> interface provides scriptable access for single character values (often used to store an ASCII character). 
</dd></dl>
<dl><dt> <a href="en/NsISupportsPRInt16">nsISupportsPRInt16</a> </dt><dd> The <code>nsISupportsPRInt16</code> interface provides scriptable access for 16-bit signed integers.
</dd></dl>
<dl><dt> <a href="en/NsISupportsPRInt32">nsISupportsPRInt32</a> </dt><dd> The <code>nsISupportsPRInt32</code> interface provides scriptable access for 32-bit signed integers. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsPRInt64">nsISupportsPRInt64</a> </dt><dd> The <code>nsISupportsPRInt64</code> interface provides scriptable access for 64-bit signed integers. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsPRUint16">nsISupportsPRUint16</a> </dt><dd> The <code>nsISupportsPRUint16</code> interface provides scriptable access for 16-bit unsigned integers. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsPRUint32">nsISupportsPRUint32</a> </dt><dd> The <code>nsISupportsPRUint32</code> interface provides scriptable access for 32-bit unsigned integers. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsPRUint64">nsISupportsPRUint64</a> </dt><dd> The <code>nsISupportsPRUint64</code> interface provides scriptable access for 64-bit unsigned integers. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsPRUint8">nsISupportsPRUint8</a> </dt><dd> The <code>nsISupportsPRUint8</code> interface provides scriptable access for 8-bit unsigned integers. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsDouble">nsISupportsDouble</a> </dt><dd> The <code>nsISupportsDouble</code> interface provides scriptable access for double-precision floating-point values. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsFloat">nsISupportsFloat</a> </dt><dd> The <code>nsISupportsFloat</code> interface provides scriptable access for single-precision floating-point values. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsPRTime">nsISupportsPRTime</a> </dt><dd> The <code>nsISupportsPRTime</code> interface provides scriptable access for PRTime values. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsCString">nsISupportsCString</a> </dt><dd> The <code>nsISupportsCString</code> interface provides scriptable access for ASCII character strings. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsString">nsISupportsString</a> </dt><dd> The <code>nsISupportsString</code> interface provides scriptable access for Unicode character strings. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsVoid">nsISupportsVoid</a> </dt><dd> The <code>nsISupportsVoid</code> interface provides scriptable access for generic pointers. values. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsID">nsISupportsID</a> </dt><dd> The <code>nsISupportsID</code> interface provides scriptable access for boolean values. 
</dd></dl>
<dl><dt> <a href="en/NsISupportsInterfacePointer">nsISupportsInterfacePointer</a> </dt><dd> The <code>nsISupportsInterfacePointer</code> interface provides scriptable access for XPCOM objects.
</dd></dl>
<h3 name="XPCOM_.22Glue.22_Classes_and_Functions"> XPCOM "Glue" Classes and Functions </h3>
<p>These classes and functions are provided to simplify the use of XPCOM from C++. They are not part of the frozen XPCOM API, which means that they may evolve over time. When these classes are used by a component, it may be necessary to link the component against the XPCOM glue library.
</p>
<h4 name="Core_2"> Core </h4>
<dl><dt> <a href="en/NsCOMPtr">nsCOMPtr</a> </dt><dd> This utility class simplifies managing XPCOM interface references from C++ code. 
</dd></dl>
<dl><dt> <a href="en/NsMemory">nsMemory</a> </dt><dd> The <code>nsMemory</code> class provides static helper routines to manage memory. These routines allow easy access to XPCOM's global <code>nsIMemory</code> implementation without having to go through the service manager to get it. 
</dd></dl>
<dl><dt> <a href="en/NsSupportsWeakReference">nsSupportsWeakReference</a> </dt><dd> Inherit from this C++ class to add canonical support for <code>nsISupportsWeakReference</code>.
</dd></dl>
<h4 name="String"> String </h4>
<dl><dt> <a href="en/NsACString">nsACString</a> </dt><dd> The <code>nsACString</code> abstract class represents a character string composed of single-byte storage units. This class is typically used to represent ASCII or UTF-8 character arrays. 
</dd></dl>
<dl><dt> <a href="en/NsAString">nsAString</a> </dt><dd> The <code>nsAString</code> abstract class represents a character string composed of double-byte storage units. This class is typically used to represent Unicode character arrays. 
</dd></dl>
<dl><dt> <a href="en/NsEmbedString">nsEmbedString</a> </dt><dd> The <code>nsEmbedString</code> concrete class provides a way to construct a <code>nsAString</code> object that allocates null-terminated storage. 
</dd></dl>
<dl><dt> <a href="en/NsEmbedCString">nsEmbedCString</a> </dt><dd> The <code>nsEmbedCString</code> concrete class provides a way to construct a <code>nsACString</code> object that allocates null-terminated storage.
</dd></dl>
<dl><dt> <a href="en/NsString">nsString</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NsCString">nsCString</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NsDependentString">nsDependentString</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NsDependentCString">nsDependentCString</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NsDependentSubstring">nsDependentSubstring</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NsDependentCSubstring">nsDependentCSubstring</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NS_ConvertASCIItoUTF16">NS_ConvertASCIItoUTF16</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NS_ConvertUTF8toUTF16">NS_ConvertUTF8toUTF16</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NS_ConvertUTF16toUTF8">NS_ConvertUTF16toUTF8</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NS_LossyConvertUTF16toASCII">NS_LossyConvertUTF16toASCII</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NsLiteralCString">nsLiteralCString</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/NsLiteralString">nsLiteralString</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/Getter_Copies">getter_Copies</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/Substring">Substring</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/StringHead">StringHead</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/StringTail">StringTail</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/EmptyString">EmptyString</a> </dt><dd> ...
</dd></dl>
<dl><dt> <a href="en/EmptyCString">EmptyCString</a> </dt><dd> ...
</dd></dl>
<div class="originaldocinfo">
<h3 name="Original_Document_Information"> Original Document Information </h3>
<ul><li> Author: Darin Fisher
</li><li> Last Updated Date: 2005/01/20
</li><li> Copyright Information: Copyright © 2004-2005
</li></ul>
</div>
{{ wiki.languages( { "ja": "ja/XPCOM_API_Reference", "pl": "pl/Dokumentacja_API_XPCOM" } ) }}
Revert to this revision