| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef INCLUDE_DART_API_H_ | 5 #ifndef INCLUDE_DART_API_H_ |
| 6 #define INCLUDE_DART_API_H_ | 6 #define INCLUDE_DART_API_H_ |
| 7 | 7 |
| 8 /** \mainpage Dart Embedding API Reference | 8 /** \mainpage Dart Embedding API Reference |
| 9 * | 9 * |
| 10 * Dart is a class-based programming language for creating structured | 10 * Dart is a class-based programming language for creating structured |
| (...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 * the array of UTF-16 encoded characters. | 1477 * the array of UTF-16 encoded characters. |
| 1478 * \param length Used to pass in the length of the provided array. | 1478 * \param length Used to pass in the length of the provided array. |
| 1479 * Used to return the length of the array which was actually used. | 1479 * Used to return the length of the array which was actually used. |
| 1480 * | 1480 * |
| 1481 * \return A valid handle if no error occurs during the operation. | 1481 * \return A valid handle if no error occurs during the operation. |
| 1482 */ | 1482 */ |
| 1483 DART_EXPORT Dart_Handle Dart_StringToUTF16(Dart_Handle str, | 1483 DART_EXPORT Dart_Handle Dart_StringToUTF16(Dart_Handle str, |
| 1484 uint16_t* utf16_array, | 1484 uint16_t* utf16_array, |
| 1485 intptr_t* length); | 1485 intptr_t* length); |
| 1486 | 1486 |
| 1487 /** |
| 1488 * Gets the storage size in bytes of a String. |
| 1489 * |
| 1490 * \param str A String. |
| 1491 * \param length Returns the storage size in bytes of the String. |
| 1492 * This is the size in bytes needed to store the String. |
| 1493 * |
| 1494 * \return A valid handle if no error occurs during the operation. |
| 1495 */ |
| 1496 DART_EXPORT Dart_Handle Dart_StringStorageSize(Dart_Handle str, intptr_t* size); |
| 1497 |
| 1498 |
| 1499 /** |
| 1500 * Converts a String into an ExternalString. |
| 1501 * The original object is morphed into an external string object. |
| 1502 * |
| 1503 * \param array External space into which the string data will be |
| 1504 * copied into. This must not move. |
| 1505 * \param length The size in bytes of the provided external space (array). |
| 1506 * \param peer An external pointer to associate with this string. |
| 1507 * \param cback A callback to be called when this string is finalized. |
| 1508 * |
| 1509 * \return the converted ExternalString object if no error occurs. |
| 1510 * Otherwise returns an error handle. |
| 1511 * |
| 1512 * For example: |
| 1513 * intptr_t size; |
| 1514 * Dart_Handle result; |
| 1515 * result = DartStringStorageSize(str, &size); |
| 1516 * void* data = malloc(size); |
| 1517 * result = Dart_MakeExternalString(str, data, size, NULL, NULL); |
| 1518 * |
| 1519 */ |
| 1520 DART_EXPORT Dart_Handle Dart_MakeExternalString(Dart_Handle str, |
| 1521 void* array, |
| 1522 intptr_t length, |
| 1523 void* peer, |
| 1524 Dart_PeerFinalizer cback); |
| 1525 |
| 1487 | 1526 |
| 1488 // --- Lists --- | 1527 // --- Lists --- |
| 1489 | 1528 |
| 1490 /** | 1529 /** |
| 1491 * Is this object a List? | 1530 * Is this object a List? |
| 1492 */ | 1531 */ |
| 1493 DART_EXPORT bool Dart_IsList(Dart_Handle object); | 1532 DART_EXPORT bool Dart_IsList(Dart_Handle object); |
| 1494 | 1533 |
| 1495 /** | 1534 /** |
| 1496 * Returns a List of the desired length. | 1535 * Returns a List of the desired length. |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2732 * | 2771 * |
| 2733 * \param object An object. | 2772 * \param object An object. |
| 2734 * \param peer A value to store in the peer field. | 2773 * \param peer A value to store in the peer field. |
| 2735 * | 2774 * |
| 2736 * \return Returns an error if 'object' is a subtype of Null, num, or | 2775 * \return Returns an error if 'object' is a subtype of Null, num, or |
| 2737 * bool. | 2776 * bool. |
| 2738 */ | 2777 */ |
| 2739 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); | 2778 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); |
| 2740 | 2779 |
| 2741 #endif // INCLUDE_DART_API_H_ | 2780 #endif // INCLUDE_DART_API_H_ |
| OLD | NEW |