| 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 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 * \param length Used to return the length of the array which was | 1472 * \param length Used to return the length of the array which was |
| 1473 * actually used. | 1473 * actually used. |
| 1474 * | 1474 * |
| 1475 * \return A valid handle if no error occurs during the operation. | 1475 * \return A valid handle if no error occurs during the operation. |
| 1476 */ | 1476 */ |
| 1477 DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str, | 1477 DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str, |
| 1478 uint8_t** utf8_array, | 1478 uint8_t** utf8_array, |
| 1479 intptr_t* length); | 1479 intptr_t* length); |
| 1480 | 1480 |
| 1481 /** | 1481 /** |
| 1482 * Gets the data corresponding to the string object. This function returns |
| 1483 * the data only for Latin-1 (ISO-8859-1) string objects. For all other |
| 1484 * string objects it return and error. |
| 1485 * |
| 1486 * \param str A string. |
| 1487 * \param latin1_array An array allocated by the caller, used to return |
| 1488 * the string data. |
| 1489 * \param length Used to pass in the length of the provided array. |
| 1490 * Used to return the length of the array which was actually used. |
| 1491 * |
| 1492 * \return A valid handle if no error occurs during the operation. |
| 1493 */ |
| 1494 DART_EXPORT Dart_Handle Dart_StringToLatin1(Dart_Handle str, |
| 1495 uint8_t* latin1_array, |
| 1496 intptr_t* length); |
| 1497 |
| 1498 /** |
| 1482 * Gets the UTF-16 encoded representation of a string. | 1499 * Gets the UTF-16 encoded representation of a string. |
| 1483 * | 1500 * |
| 1484 * \param str A string. | 1501 * \param str A string. |
| 1485 * \param utf16_array An array allocated by the caller, used to return | 1502 * \param utf16_array An array allocated by the caller, used to return |
| 1486 * the array of UTF-16 encoded characters. | 1503 * the array of UTF-16 encoded characters. |
| 1487 * \param length Used to pass in the length of the provided array. | 1504 * \param length Used to pass in the length of the provided array. |
| 1488 * Used to return the length of the array which was actually used. | 1505 * Used to return the length of the array which was actually used. |
| 1489 * | 1506 * |
| 1490 * \return A valid handle if no error occurs during the operation. | 1507 * \return A valid handle if no error occurs during the operation. |
| 1491 */ | 1508 */ |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1510 * The original object is morphed into an external string object. | 1527 * The original object is morphed into an external string object. |
| 1511 * | 1528 * |
| 1512 * \param array External space into which the string data will be | 1529 * \param array External space into which the string data will be |
| 1513 * copied into. This must not move. | 1530 * copied into. This must not move. |
| 1514 * \param length The size in bytes of the provided external space (array). | 1531 * \param length The size in bytes of the provided external space (array). |
| 1515 * \param peer An external pointer to associate with this string. | 1532 * \param peer An external pointer to associate with this string. |
| 1516 * \param cback A callback to be called when this string is finalized. | 1533 * \param cback A callback to be called when this string is finalized. |
| 1517 * | 1534 * |
| 1518 * \return the converted ExternalString object if no error occurs. | 1535 * \return the converted ExternalString object if no error occurs. |
| 1519 * Otherwise returns an error handle. | 1536 * Otherwise returns an error handle. |
| 1537 * If the object is a valid string but if it cannot be externalized |
| 1538 * then Dart_Null() is returned and the string data is copied into |
| 1539 * the external space specified. |
| 1520 * | 1540 * |
| 1521 * For example: | 1541 * For example: |
| 1522 * intptr_t size; | 1542 * intptr_t size; |
| 1523 * Dart_Handle result; | 1543 * Dart_Handle result; |
| 1524 * result = DartStringStorageSize(str, &size); | 1544 * result = DartStringStorageSize(str, &size); |
| 1525 * void* data = malloc(size); | 1545 * void* data = malloc(size); |
| 1526 * result = Dart_MakeExternalString(str, data, size, NULL, NULL); | 1546 * result = Dart_MakeExternalString(str, data, size, NULL, NULL); |
| 1527 * | 1547 * |
| 1528 */ | 1548 */ |
| 1529 DART_EXPORT Dart_Handle Dart_MakeExternalString(Dart_Handle str, | 1549 DART_EXPORT Dart_Handle Dart_MakeExternalString(Dart_Handle str, |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2769 * | 2789 * |
| 2770 * \param object An object. | 2790 * \param object An object. |
| 2771 * \param peer A value to store in the peer field. | 2791 * \param peer A value to store in the peer field. |
| 2772 * | 2792 * |
| 2773 * \return Returns an error if 'object' is a subtype of Null, num, or | 2793 * \return Returns an error if 'object' is a subtype of Null, num, or |
| 2774 * bool. | 2794 * bool. |
| 2775 */ | 2795 */ |
| 2776 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); | 2796 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); |
| 2777 | 2797 |
| 2778 #endif // INCLUDE_DART_API_H_ | 2798 #endif // INCLUDE_DART_API_H_ |
| OLD | NEW |