Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/typedObjects.js

Issue 5665229014827008: Issue 150 - [Typed objects] Implement string type (Closed)
Patch Set: Created May 19, 2014, 3:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/typedObjects/arrayTypes.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 * garbage collected. In addition, it has the following properties and methods: 148 * garbage collected. In addition, it has the following properties and methods:
149 * 149 *
150 * get(index): retrieves the array element at specified index. 150 * get(index): retrieves the array element at specified index.
151 * set(index, value): sets the array element at specified index. 151 * set(index, value): sets the array element at specified index.
152 * length: number of elements in the array, by default 0. Increase the length 152 * length: number of elements in the array, by default 0. Increase the length
153 * to match your data size. 153 * to match your data size.
154 * size: size of the allocated buffer in array elements, will be at least 154 * size: size of the allocated buffer in array elements, will be at least
155 * equal to length. Normally you won't need to set the size explicitly. 155 * equal to length. Normally you won't need to set the size explicitly.
156 * However, the size won't decrease automatically if the array gets 156 * However, the size won't decrease automatically if the array gets
157 * smaller so you might want to set it in order to shrink the array. 157 * smaller so you might want to set it in order to shrink the array.
158 *
159 * String type
160 * -----------
161 *
162 * There is a special array type called string:
163 *
164 * var str1 = string(); // empty string
165 * var str2 = string(2); // "\0\0"
166 * var str3 = string("foo"); // "foo"
167 * var str4 = string(str3, 1, 2); // "oo"
168 * str4.get(0); // 111 - character code of "o"
169 *
170 * Without any constructor parameters the string will be empty, a number as
171 * parameter will set the initial string length accordingly. A JavaScript string
172 * or another string instance as first parameter indicate that the string data
173 * should be copied from these. Optionally, a second (offset) and third
174 * parameter (length) can be given.
175 *
176 * To convert a string instance into a JavaScript string you can call the
177 * toString() method.
158 */ 178 */
159 179
160 function forwardExports(module) 180 function forwardExports(module)
161 { 181 {
162 let moduleExports = require(module); 182 let moduleExports = require(module);
163 for (let key in moduleExports) 183 for (let key in moduleExports)
164 exports[key] = moduleExports[key]; 184 exports[key] = moduleExports[key];
165 } 185 }
166 186
167 forwardExports("typedObjects/primitiveTypes"); 187 forwardExports("typedObjects/primitiveTypes");
168 forwardExports("typedObjects/objectTypes"); 188 forwardExports("typedObjects/objectTypes");
189 forwardExports("typedObjects/stringType");
OLDNEW
« no previous file with comments | « no previous file | lib/typedObjects/arrayTypes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld