Index: lib/typedObjects.js |
=================================================================== |
--- a/lib/typedObjects.js |
+++ b/lib/typedObjects.js |
@@ -150,19 +150,40 @@ |
* get(index): retrieves the array element at specified index. |
* set(index, value): sets the array element at specified index. |
* length: number of elements in the array, by default 0. Increase the length |
* to match your data size. |
* size: size of the allocated buffer in array elements, will be at least |
* equal to length. Normally you won't need to set the size explicitly. |
* However, the size won't decrease automatically if the array gets |
* smaller so you might want to set it in order to shrink the array. |
+ * |
+ * String type |
+ * ----------- |
+ * |
+ * There is a special array type called string: |
+ * |
+ * var str1 = string(); // empty string |
+ * var str2 = string(2); // "\0\0" |
+ * var str3 = string("foo"); // "foo" |
+ * var str4 = string(str3, 1, 2); // "oo" |
+ * str4.get(0); // 111 - ASCII code of "o" |
René Jeschke
2014/05/19 08:15:28
Note: 'ASCII' is not the right term here, the valu
|
+ * |
+ * Without any constructor parameters the string will be empty, a number as |
+ * parameter will set the initial string length accordingly. A JavaScript string |
+ * or another string instance as first parameter indicate that the string data |
+ * should be copied from these. Optionally, a second (offset) and third |
+ * parameter (length) can be given. |
+ * |
+ * To convert a string instance into a JavaScript string you can call the |
+ * toString() method. |
*/ |
function forwardExports(module) |
{ |
let moduleExports = require(module); |
for (let key in moduleExports) |
exports[key] = moduleExports[key]; |
} |
forwardExports("typedObjects/primitiveTypes"); |
forwardExports("typedObjects/objectTypes"); |
+forwardExports("typedObjects/stringType"); |