OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 */ | 985 */ |
986 V8EXPORT int Utf8Length() const; | 986 V8EXPORT int Utf8Length() const; |
987 | 987 |
988 /** | 988 /** |
989 * Write the contents of the string to an external buffer. | 989 * Write the contents of the string to an external buffer. |
990 * If no arguments are given, expects the buffer to be large | 990 * If no arguments are given, expects the buffer to be large |
991 * enough to hold the entire string and NULL terminator. Copies | 991 * enough to hold the entire string and NULL terminator. Copies |
992 * the contents of the string and the NULL terminator into the | 992 * the contents of the string and the NULL terminator into the |
993 * buffer. | 993 * buffer. |
994 * | 994 * |
| 995 * WriteUtf8 will not write partial UTF-8 sequences, preferring to stop |
| 996 * before the end of the buffer. |
| 997 * |
995 * Copies up to length characters into the output buffer. | 998 * Copies up to length characters into the output buffer. |
996 * Only null-terminates if there is enough space in the buffer. | 999 * Only null-terminates if there is enough space in the buffer. |
997 * | 1000 * |
998 * \param buffer The buffer into which the string will be copied. | 1001 * \param buffer The buffer into which the string will be copied. |
999 * \param start The starting position within the string at which | 1002 * \param start The starting position within the string at which |
1000 * copying begins. | 1003 * copying begins. |
1001 * \param length The number of bytes to copy from the string. | 1004 * \param length The number of characters to copy from the string. For |
| 1005 * WriteUtf8 the number of bytes in the buffer. |
1002 * \param nchars_ref The number of characters written, can be NULL. | 1006 * \param nchars_ref The number of characters written, can be NULL. |
1003 * \param hints Various hints that might affect performance of this or | 1007 * \param hints Various hints that might affect performance of this or |
1004 * subsequent operations. | 1008 * subsequent operations. |
1005 * \return The number of bytes copied to the buffer | 1009 * \return The number of characters copied to the buffer excluding the null |
1006 * excluding the NULL terminator. | 1010 * terminator. For WriteUtf8: The number of bytes copied to the buffer |
| 1011 * including the null terminator. |
1007 */ | 1012 */ |
1008 enum WriteHints { | 1013 enum WriteHints { |
1009 NO_HINTS = 0, | 1014 NO_HINTS = 0, |
1010 HINT_MANY_WRITES_EXPECTED = 1 | 1015 HINT_MANY_WRITES_EXPECTED = 1 |
1011 }; | 1016 }; |
1012 | 1017 |
1013 V8EXPORT int Write(uint16_t* buffer, | 1018 V8EXPORT int Write(uint16_t* buffer, |
1014 int start = 0, | 1019 int start = 0, |
1015 int length = -1, | 1020 int length = -1, |
1016 WriteHints hints = NO_HINTS) const; // UTF-16 | 1021 WriteHints hints = NO_HINTS) const; // UTF-16 |
(...skipping 2745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3762 | 3767 |
3763 | 3768 |
3764 } // namespace v8 | 3769 } // namespace v8 |
3765 | 3770 |
3766 | 3771 |
3767 #undef V8EXPORT | 3772 #undef V8EXPORT |
3768 #undef TYPE_CHECK | 3773 #undef TYPE_CHECK |
3769 | 3774 |
3770 | 3775 |
3771 #endif // V8_H_ | 3776 #endif // V8_H_ |
OLD | NEW |