Chromium Code Reviews| 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 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1456 * \param cstr Returns the String represented as a C string. | 1456 * \param cstr Returns the String represented as a C string. |
| 1457 * This C string is scope allocated and is only valid until | 1457 * This C string is scope allocated and is only valid until |
| 1458 * the next call to Dart_ExitScope. | 1458 * the next call to Dart_ExitScope. |
| 1459 * | 1459 * |
| 1460 * \return A valid handle if no error occurs during the operation. | 1460 * \return A valid handle if no error occurs during the operation. |
| 1461 */ | 1461 */ |
| 1462 DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle str, | 1462 DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle str, |
| 1463 const char** cstr); | 1463 const char** cstr); |
| 1464 | 1464 |
| 1465 /** | 1465 /** |
| 1466 * Gets the Latin-1 (ISO-8859-1) encoded representation of a string. | |
|
cshapiro
2012/12/14 00:00:36
This seems misleading, I would really like to see
siva
2012/12/14 03:30:09
I have changed the description here to word it to
| |
| 1467 * | |
| 1468 * \param str A string. | |
| 1469 * \param latin1_array Returns the String represented as Latin-1 characters | |
| 1470 * This array is scope allocated and is only valid | |
| 1471 * until the next call to Dart_ExitScope. | |
|
antonm
2012/12/14 01:31:59
there are two flavours of string data fetching: Da
siva
2012/12/14 03:30:09
I have changed Dart_StringToLatin1 to use the API
antonm
2012/12/14 03:31:30
Thanks!
On 2012/12/14 03:30:09, siva wrote:
| |
| 1472 * \param length Used to return the length of the array which was | |
| 1473 * actually used. | |
| 1474 * | |
| 1475 * \return A valid handle if no error occurs during the operation. | |
| 1476 */ | |
| 1477 DART_EXPORT Dart_Handle Dart_StringToLatin1(Dart_Handle str, | |
| 1478 uint8_t** latin1_array, | |
| 1479 intptr_t* length); | |
| 1480 | |
| 1481 /** | |
| 1466 * Gets a UTF-8 encoded representation of a String. | 1482 * Gets a UTF-8 encoded representation of a String. |
| 1467 * | 1483 * |
| 1468 * \param str A string. | 1484 * \param str A string. |
| 1469 * \param utf8_array Returns the String represented as UTF-8 code | 1485 * \param utf8_array Returns the String represented as UTF-8 code |
| 1470 * units. This UTF-8 array is scope allocated and is only valid | 1486 * units. This UTF-8 array is scope allocated and is only valid |
| 1471 * until the next call to Dart_ExitScope. | 1487 * until the next call to Dart_ExitScope. |
| 1472 * \param length Used to return the length of the array which was | 1488 * \param length Used to return the length of the array which was |
| 1473 * actually used. | 1489 * actually used. |
| 1474 * | 1490 * |
| 1475 * \return A valid handle if no error occurs during the operation. | 1491 * \return A valid handle if no error occurs during the operation. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1510 * The original object is morphed into an external string object. | 1526 * The original object is morphed into an external string object. |
| 1511 * | 1527 * |
| 1512 * \param array External space into which the string data will be | 1528 * \param array External space into which the string data will be |
| 1513 * copied into. This must not move. | 1529 * copied into. This must not move. |
| 1514 * \param length The size in bytes of the provided external space (array). | 1530 * \param length The size in bytes of the provided external space (array). |
| 1515 * \param peer An external pointer to associate with this string. | 1531 * \param peer An external pointer to associate with this string. |
| 1516 * \param cback A callback to be called when this string is finalized. | 1532 * \param cback A callback to be called when this string is finalized. |
| 1517 * | 1533 * |
| 1518 * \return the converted ExternalString object if no error occurs. | 1534 * \return the converted ExternalString object if no error occurs. |
| 1519 * Otherwise returns an error handle. | 1535 * Otherwise returns an error handle. |
| 1536 * If the object is a valid string but if it cannot be externalized | |
| 1537 * then Dart_Null() is returned and the string data is copied into | |
| 1538 * the external space specified. | |
| 1520 * | 1539 * |
| 1521 * For example: | 1540 * For example: |
| 1522 * intptr_t size; | 1541 * intptr_t size; |
| 1523 * Dart_Handle result; | 1542 * Dart_Handle result; |
| 1524 * result = DartStringStorageSize(str, &size); | 1543 * result = DartStringStorageSize(str, &size); |
| 1525 * void* data = malloc(size); | 1544 * void* data = malloc(size); |
| 1526 * result = Dart_MakeExternalString(str, data, size, NULL, NULL); | 1545 * result = Dart_MakeExternalString(str, data, size, NULL, NULL); |
| 1527 * | 1546 * |
| 1528 */ | 1547 */ |
| 1529 DART_EXPORT Dart_Handle Dart_MakeExternalString(Dart_Handle str, | 1548 DART_EXPORT Dart_Handle Dart_MakeExternalString(Dart_Handle str, |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2769 * | 2788 * |
| 2770 * \param object An object. | 2789 * \param object An object. |
| 2771 * \param peer A value to store in the peer field. | 2790 * \param peer A value to store in the peer field. |
| 2772 * | 2791 * |
| 2773 * \return Returns an error if 'object' is a subtype of Null, num, or | 2792 * \return Returns an error if 'object' is a subtype of Null, num, or |
| 2774 * bool. | 2793 * bool. |
| 2775 */ | 2794 */ |
| 2776 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); | 2795 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); |
| 2777 | 2796 |
| 2778 #endif // INCLUDE_DART_API_H_ | 2797 #endif // INCLUDE_DART_API_H_ |
| OLD | NEW |