-
-
Notifications
You must be signed in to change notification settings - Fork 487
Enable DataView feature by default #331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,244 @@ | ||
| # DataView | ||
|
|
||
| The `Napi::DataView` class corresponds to the | ||
| [JavaScript `DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) | ||
| class. | ||
|
|
||
| ## Methods | ||
|
|
||
| ### New | ||
|
|
||
| Allocates a new `Napi::DataView` instance with a given `Napi::ArrayBuffer`. | ||
|
|
||
| ```cpp | ||
| static Napi::DataView New(napi_env env, Napi::ArrayBuffer arrayBuffer); | ||
| ``` | ||
| - `[in] env`: The environment in which to create the `Napi::DataView` instance. | ||
| - `[in] arrayBuffer` : `Napi::ArrayBuffer` underlying the `Napi::DataView`. | ||
| Returns a new `Napi::DataView` instance. | ||
| ### New | ||
| Allocates a new `Napi::DataView` instance with a given `Napi::ArrayBuffer`. | ||
| ```cpp | ||
| static Napi::DataView New(napi_env env, Napi::ArrayBuffer arrayBuffer, size_t byteOffset); | ||
| ``` | ||
|
|
||
| - `[in] env`: The environment in which to create the `Napi::DataView` instance. | ||
| - `[in] arrayBuffer` : `Napi::ArrayBuffer` underlying the `Napi::DataView`. | ||
| - `[in] byteOffset` : The byte offset within the `Napi::ArrayBuffer` from which to start projecting the `Napi::DataView`. | ||
|
|
||
| Returns a new `Napi::DataView` instance. | ||
|
|
||
| ### New | ||
|
|
||
| Allocates a new `Napi::DataView` instance with a given `Napi::ArrayBuffer`. | ||
|
|
||
| ```cpp | ||
| static Napi::DataView New(napi_env env, Napi::ArrayBuffer arrayBuffer, size_t byteOffset, size_t byteLength); | ||
| ``` | ||
| - `[in] env`: The environment in which to create the `Napi::DataView` instance. | ||
| - `[in] arrayBuffer` : `Napi::ArrayBuffer` underlying the `Napi::DataView`. | ||
| - `[in] byteOffset` : The byte offset within the `Napi::ArrayBuffer` from which to start projecting the `Napi::DataView`. | ||
| - `[in] byteLength` : Number of elements in the `Napi::DataView`. | ||
| Returns a new `Napi::DataView` instance. | ||
| ### Constructor | ||
| Initializes an empty instance of the `Napi::DataView` class. | ||
| ```cpp | ||
| DataView(); | ||
| ``` | ||
|
|
||
| ### Constructor | ||
|
|
||
| Initializes a wrapper instance of an existing `Napi::DataView` instance. | ||
|
|
||
| ```cpp | ||
| DataView(napi_env env, napi_value value); | ||
| ``` | ||
| - `[in] env`: The environment in which to create the `Napi::DataView` instance. | ||
| - `[in] value`: The `Napi::DataView` reference to wrap. | ||
| ### ArrayBuffer | ||
| ```cpp | ||
| Napi::ArrayBuffer ArrayBuffer() const; | ||
| ``` | ||
|
|
||
| Returns the backing array buffer. | ||
|
|
||
| ### ByteOffset | ||
|
|
||
| ```cpp | ||
| size_t ByteOffset() const; | ||
| ``` | ||
|
|
||
| Returns the offset into the `Napi::DataView` where the array starts, in bytes. | ||
|
|
||
| ### ByteLength | ||
|
|
||
| ```cpp | ||
| size_t ByteLength() const; | ||
| ``` | ||
|
|
||
| Returns the length of the array, in bytes. | ||
|
|
||
| ### GetFloat32 | ||
|
|
||
| ```cpp | ||
| float GetFloat32(size_t byteOffset) const; | ||
| ``` | ||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
| Returns a signed 32-bit float (float) at the specified byte offset from the start of the `DataView`. | ||
| ### GetFloat64 | ||
| ```cpp | ||
| double GetFloat64(size_t byteOffset) const; | ||
| ``` | ||
|
|
||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
|
|
||
| Returns a signed 64-bit float (double) at the specified byte offset from the start of the `Napi::DataView`. | ||
|
|
||
| ### GetInt8 | ||
|
|
||
| ```cpp | ||
| int8_t GetInt8(size_t byteOffset) const; | ||
| ``` | ||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
| Returns a signed 8-bit integer (byte) at the specified byte offset from the start of the `Napi::DataView`. | ||
| ### GetInt16 | ||
| ```cpp | ||
| int16_t GetInt16(size_t byteOffset) const; | ||
| ``` | ||
|
|
||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
|
|
||
| Returns a signed 16-bit integer (short) at the specified byte offset from the start of the `Napi::DataView`. | ||
|
|
||
| ### GetInt32 | ||
|
|
||
| ```cpp | ||
| int32_t GetInt32(size_t byteOffset) const; | ||
| ``` | ||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
| Returns a signed 32-bit integer (long) at the specified byte offset from the start of the `Napi::DataView`. | ||
| ### GetUint8 | ||
| ```cpp | ||
| uint8_t GetUint8(size_t byteOffset) const; | ||
| ``` | ||
|
|
||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
|
|
||
| Returns a unsigned 8-bit integer (unsigned byte) at the specified byte offset from the start of the `Napi::DataView`. | ||
|
|
||
| ### GetUint16 | ||
|
|
||
| ```cpp | ||
| uint16_t GetUint16(size_t byteOffset) const; | ||
| ``` | ||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
| Returns a unsigned 16-bit integer (unsigned short) at the specified byte offset from the start of the `Napi::DataView`. | ||
| ### GetUint32 | ||
| ```cpp | ||
| uint32_t GetUint32(size_t byteOffset) const; | ||
| ``` | ||
|
|
||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
|
|
||
| Returns a unsigned 32-bit integer (unsigned long) at the specified byte offset from the start of the `Napi::DataView`. | ||
|
|
||
| ### SetFloat32 | ||
|
|
||
| ```cpp | ||
| void SetFloat32(size_t byteOffset, float value) const; | ||
| ``` | ||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
| - `[in] value`: The value to set. | ||
| ### SetFloat64 | ||
| ```cpp | ||
| void SetFloat64(size_t byteOffset, double value) const; | ||
| ``` | ||
|
|
||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
| - `[in] value`: The value to set. | ||
|
|
||
| ### SetInt8 | ||
|
|
||
| ```cpp | ||
| void SetInt8(size_t byteOffset, int8_t value) const; | ||
| ``` | ||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
| - `[in] value`: The value to set. | ||
| ### SetInt16 | ||
| ```cpp | ||
| void SetInt16(size_t byteOffset, int16_t value) const; | ||
| ``` | ||
|
|
||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
| - `[in] value`: The value to set. | ||
|
|
||
| ### SetInt32 | ||
|
|
||
| ```cpp | ||
| void SetInt32(size_t byteOffset, int32_t value) const; | ||
| ``` | ||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
| - `[in] value`: The value to set. | ||
| ### SetUint8 | ||
| ```cpp | ||
| void SetUint8(size_t byteOffset, uint8_t value) const; | ||
| ``` | ||
|
|
||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
| - `[in] value`: The value to set. | ||
|
|
||
| ### SetUint16 | ||
|
|
||
| ```cpp | ||
| void SetUint16(size_t byteOffset, uint16_t value) const; | ||
| ``` | ||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
| - `[in] value`: The value to set. | ||
| ### SetUint32 | ||
| ```cpp | ||
| void SetUint32(size_t byteOffset, uint32_t value) const; | ||
| ``` | ||
|
|
||
| - `[in] byteOffset`: The offset, in byte, from the start of the view where to read the data. | ||
| - `[in] value`: The value to set. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.