XPCOM API Reference
出典: MDC
このページは翻訳中です。
翻訳作業に参加する場合は、履歴にある翻訳者と連絡·調整してください。
このページはXPCOMリファレンスの新しいホームであり、ここから移動してきました。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.
目次 |
[編集] 概観
このリファレンスは XPCOM ライブラリによって提供されている 凍結された インタフェースと関数について述べています。XPCOM glue ライブラリによって提供されているヘルパークラスと関数についても詳しく述べています。このリファレンスは拡張の作者と XPCOM の埋め込みを行う人向けです。
注意: 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.
[編集] 凍結されたコンポーネント
これらのコンポーネントは XPCOM コンポーネントマネジャーかサービスマネージャを使ってアクセスされます。
- nsCategoryManager
- XPCOM カテゴリマネージャ。
- nsDirectoryService
- XPCOM ディレクトリサービス。
- nsLocalFile
-
nsILocalFileを実装しているコンポーネント。 - nsObserverService
- XPCOM オブザーバサービス。
- nsScriptableInputStream
-
nsIScriptableInputStreamを実装しているコンポーネント。 - XPCOM primitive コンポーネント
- これらのコンポーネントは、単純な XPCOM 形の "box" 値である scriptable オブジェクトを実装します。また、これらのインタフェースを実装します:
nsISupportsCString,nsISupportsChar,nsISupportsDouble,nsISupportsFloat,nsISupportsID,nsISupportsInterface,nsISupportsPRBool,nsISupportsPRInt16,nsISupportsPRInt32,nsISupportsPRInt64,nsISupportsPRTime,nsISupportsPRUint16,nsISupportsPRUint32,nsISupportsPRUint64,nsISupportsPRUint8,nsISupportsString,nsISupportsVoid
[編集] 凍結された関数
これらの関数は XPCOM 共有ライブラリからエクスポートされています。
[編集] コア関数
- NS_InitXPCOM2
-
NS_InitXPCOM2関数は呼び出しプロセスの中で XPCOM の使用を始めます。
- NS_InitXPCOM3
- The
NS_InitXPCOM3関数は静的に定義された XPCOM モジュールのサポート付きで呼び出しプロセスの中で XPCOM の使用を始めます。
- NS_ShutdownXPCOM
-
NS_ShutdownXPCOM関数は呼び出しプロセスの中で XPCOM の使用を終了させます。
- NS_GetComponentManager
-
NS_GetComponentManager関数は XPCOM コンポーネントマネージャへの参照を返します。
- NS_GetComponentRegistrar
-
NS_GetComponentRegistrar関数は XPCOM コンポーネントレジスタへの参照を返します。
- NS_GetServiceManager
-
NS_GetServiceManager関数は XPCOM サービスマネージャへの参照を返します。
- NS_GetMemoryManager
-
NS_GetMemoryManager関数は XPCOM メモリマネージャへの参照を返します。
- NS_NewLocalFile
-
NS_NewLocalFile関数はファイルパスのプラットフォームに依存しない表現を提供するnsILocalFileのインスタンスを作成します。
- NS_NewNativeLocalFile
- The
NS_NewNativeLocalFile関数はファイルパスのプラットフォームに依存しない表現を提供するnsILocalFileのインスタンスを作成します。You should avoid using this function if you're not 100% certain that the full file path (not just a leaf) involved is always ASCII.
- NS_Alloc
- XPCOM メモリマネージャで使われるメモリのブロックを割り当てます。
- NS_Realloc
- XPCOM メモリマネージャで使われるメモリのブロックを再割り当てします。
- NS_Free
- XPCOM メモリマネージャで使われるメモリのブロックを開放します。
[編集] 文字列関数
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_CStringContainerInitfunction initializes ansCStringContainerinstance for use as ansACString.
- NS_CStringContainerInit2
- The
NS_CStringContainerInit2function initializes ansCStringContainerinstance for use as ansACString.
- NS_CStringContainerFinish
- The
NS_CStringContainerFinishfunction releases any memory allocated by ansCStringContainerinstance.
- NS_CStringGetData
- The
NS_CStringGetDatafunction gives the caller read access to the string's internal buffer.
- NS_CStringGetMutableData
- The
NS_CStringGetDataMutablefunction gives the caller write access to the string's internal buffer.
- NS_CStringSetData
- The
NS_CStringSetDatafunction copies data into the string's internal buffer.
- NS_CStringSetDataRange
- The
NS_CStringSetDataRangefunction copies data into a section of the string's internal buffer.
- NS_CStringCopy
- The
NS_CStringCopyfunction copies the value from onensACStringinstance to another.
- NS_CStringAppendData
- The
NS_CStringAppendDatafunction appends data to the existing value of ansACStringinstance.
- NS_CStringInsertData
- The
NS_CStringInsertDatafunction appends data to the existing value of ansACStringinstance.
- NS_CStringCutData
- The
NS_CStringCutDatafunction removes a section of the string's internal buffer.
- NS_CStringCloneData
- The
NS_CStringCloneDatafunction returns a null-terminated, heap allocated copy of the string's internal buffer.
- NS_StringContainerInit
- The
NS_StringContainerInitfunction initializes ansStringContainerinstance for use as ansAString.
- NS_StringContainerFinish
- The
NS_StringContainerFinishfunction releases any memory allocated by ansStringContainerinstance.
- NS_StringGetData
- The
NS_StringGetDatafunction gives the caller access to the string's internal buffer.
- NS_StringSetData
- The
NS_StringSetDatafunction copies data into the string's internal buffer.
- NS_StringSetDataRange
- The
NS_StringSetDataRangefunction copies data into a section of the string's internal buffer.
- NS_StringCopy
- The
NS_StringCopyfunction copies the value from onensAStringinstance to another.
- NS_StringAppendData
- The
NS_StringAppendDatafunction appends data to the existing value of ansAStringinstance.
- NS_StringInsertData
- The
NS_StringInsertDatafunction appends data to the existing value of ansACStringinstance.
- NS_StringCutData
- The
NS_StringCutDatafunction removes a section of the string's internal buffer.
- NS_StringCloneData
- The
NS_StringCloneDatafunction returns a null-terminated, heap allocated copy of the string's internal buffer.
- NS_CStringToUTF16
- The
NS_CStringToUTF16function converts the value of ansACStringinstance to UTF-16 and stores the result in ansAStringinstance.
- NS_UTF16ToCString
- The
NS_UTF16ToCStringfunction converts the value of ansAStringinstance from UTF-16 to the specified multi-byte encoding and stores the result in ansACStringinstance.
[編集] 凍結されたインターフェース
[編集] コア
- nsICategoryManager
- The
nsICategoryManagerinterface 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
nsIClassInfointerface provides information about a specific implementation class.
- nsIComponentManager
- The
nsIComponentManagerinterface provides methods to access factory objects and instantiate instances of classes.
- nsIComponentRegistrar
- The
nsIComponentRegistrarinterface provides methods to access and modify the XPCOM component registry.
- nsIFactory
- The
nsIFactoryinterface allows for the creation ofnsISupportsderived classes without specifying a concrete class type.
- nsIInterfaceRequestor
- The
nsIInterfaceRequestorinterface defines a generic interface for requesting interfaces that a given object might provide access to.
- nsIModule
- The
nsIModuleinterface must be implemented by each XPCOM component. It is the main entry point by which the system accesses an XPCOM component.
- nsIMemory
- The
nsIMemoryinterface represents a generic memory allocator.
- nsIObserver
- The
nsIObserverinterface is a generic notification callback interface that is typically used in conjunction withnsIObserverService.
- nsIObserverService
- The
nsIObserverServiceinterface provides methods to add, remove, notify, and enumerate observers of various notifications.
- nsIProgrammingLanguage
- The
nsIProgrammingLanguageinterface provides an enumeration of programming language identifiers.
- nsIProperties
- The
nsIPropertiesinterface provides methods to access a map of named XPCOM object values.
- nsIServiceManager
- The
nsIServiceManagermanager interface provides a means to obtain global services in an application.
- nsISimpleEnumerator
- The
nsISimpleEnumeratorinterface represents an enumeration of XPCOM objects and provides methods to access elements sequentially.
- nsISupports
- All XPCOM interfaces inherit the
nsISupportsinterface.
- nsISupportsWeakReference
- The
nsISupportsWeakReferenceinterface is a factory interface, which produces appropriate instances ofnsIWeakReference.
- nsIWeakReference
- The
nsIWeakReferenceinterface represents a proxy for an XPCOM object. It allows a consumer to hold an indirect, non-owning reference to an XPCOM object.
[編集] ファイルとディレクトリ
- nsIFile
- The
nsIFileinterface represents a file or directory location in a platform-independent manner.
- nsILocalFile
- The
nsILocalFileinterface represents a file or directory location in a platform-independent manner that is accessible on the local filesystem. It extends nsIFile.
- nsIDirectoryService
- The
nsIDirectoryServiceinterface provides methods to initialize and configure a directory service instance.
- nsIDirectoryServiceProvider
- The
nsIDirectoryServiceProviderinterface is used by the Directory Service to get file locations.
- nsIDirectoryServiceProvider2
- The
nsIDirectoryServiceProvider2interface is used by the Directory Service to get an enumeration of file locations.
[編集] ストリーム
- nsIInputStream
- The
nsIInputStreaminterface represents a readable data source.
- nsIOutputStream
- The
nsIOutputStreaminterface represents a writable data sink.
- nsIScriptableInputStream
- The
nsIScriptableInputStreaminterface provides scriptable access to ansIInputStreaminstance.
[編集] プリミティヴ
- nsISupportsPrimitive
- The
nsISupportsPrimitiveinterface serves as a base interface for all of thensISupports*family of interfaces.
- nsISupportsPRBool
- The
nsISupportsPRBoolinterface provides scriptable access for boolean values.
- nsISupportsChar
- The
nsISupportsCharinterface provides scriptable access for single character values (often used to store an ASCII character).
- nsISupportsPRInt16
- The
nsISupportsPRInt16interface provides scriptable access for 16-bit signed integers.
- nsISupportsPRInt32
- The
nsISupportsPRInt32interface provides scriptable access for 32-bit signed integers.
- nsISupportsPRInt64
- The
nsISupportsPRInt64interface provides scriptable access for 64-bit signed integers.
- nsISupportsPRUint16
- The
nsISupportsPRUint16interface provides scriptable access for 16-bit unsigned integers.
- nsISupportsPRUint32
- The
nsISupportsPRUint32interface provides scriptable access for 32-bit unsigned integers.
- nsISupportsPRUint64
- The
nsISupportsPRUint64interface provides scriptable access for 64-bit unsigned integers.
- nsISupportsPRUint8
- The
nsISupportsPRUint8interface provides scriptable access for 8-bit unsigned integers.
- nsISupportsDouble
- The
nsISupportsDoubleinterface provides scriptable access for double-precision floating-point values.
- nsISupportsFloat
- The
nsISupportsFloatinterface provides scriptable access for single-precision floating-point values.
- nsISupportsPRTime
- The
nsISupportsPRTimeinterface provides scriptable access for PRTime values.
- nsISupportsCString
- The
nsISupportsCStringinterface provides scriptable access for ASCII character strings.
- nsISupportsString
- The
nsISupportsStringinterface provides scriptable access for Unicode character strings.
- nsISupportsVoid
- The
nsISupportsVoidinterface provides scriptable access for generic pointers. values.
- nsISupportsID
- The
nsISupportsIDinterface provides scriptable access for boolean values.
- nsISupportsInterfacePointer
- The
nsISupportsInterfacePointerinterface provides scriptable access for XPCOM objects.
[編集] XPCOM "Glue" クラスと関数
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.
[編集] コア
- nsCOMPtr
- This utility class simplifies managing XPCOM interface references from C++ code.
- nsMemory
- The
nsMemoryclass provides static helper routines to manage memory. These routines allow easy access to XPCOM's globalnsIMemoryimplementation without having to go through the service manager to get it.
- nsSupportsWeakReference
- Inherit from this C++ class to add canonical support for
nsISupportsWeakReference.
[編集] 文字列
- nsACString
- The
nsACStringabstract 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
nsAStringabstract class represents a character string composed of double-byte storage units. This class is typically used to represent Unicode character arrays.
- nsEmbedString
- The
nsEmbedStringconcrete class provides a way to construct ansAStringobject that allocates null-terminated storage.
- nsEmbedCString
- The
nsEmbedCStringconcrete class provides a way to construct ansACStringobject that allocates null-terminated storage.
- nsString
- ...
- nsCString
- ...
- 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