Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: include/v8.h

Issue 7706002: Slight API change enabling opting out from null termination in String::Write*(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 * 1032 *
1033 * Copies up to length characters into the output buffer. 1033 * Copies up to length characters into the output buffer.
1034 * Only null-terminates if there is enough space in the buffer. 1034 * Only null-terminates if there is enough space in the buffer.
1035 * 1035 *
1036 * \param buffer The buffer into which the string will be copied. 1036 * \param buffer The buffer into which the string will be copied.
1037 * \param start The starting position within the string at which 1037 * \param start The starting position within the string at which
1038 * copying begins. 1038 * copying begins.
1039 * \param length The number of characters to copy from the string. For 1039 * \param length The number of characters to copy from the string. For
1040 * WriteUtf8 the number of bytes in the buffer. 1040 * WriteUtf8 the number of bytes in the buffer.
1041 * \param nchars_ref The number of characters written, can be NULL. 1041 * \param nchars_ref The number of characters written, can be NULL.
1042 * \param hints Various hints that might affect performance of this or 1042 * \param options Various hints that might affect performance of this or
Vitaly Repeshko 2011/08/23 10:55:40 Various options?
1043 * subsequent operations. 1043 * subsequent operations.
1044 * \return The number of characters copied to the buffer excluding the null 1044 * \return The number of characters copied to the buffer excluding the null
1045 * terminator. For WriteUtf8: The number of bytes copied to the buffer 1045 * terminator. For WriteUtf8: The number of bytes copied to the buffer
1046 * including the null terminator. 1046 * including the null terminator (if written).
1047 */ 1047 */
1048 enum WriteHints { 1048 enum WriteHints {
Vitaly Repeshko 2011/08/23 10:55:40 WriteOptions?
1049 NO_HINTS = 0, 1049 NO_OPTIONS = 0,
1050 HINT_MANY_WRITES_EXPECTED = 1 1050 MANY_WRITES_EXPECTED = 1,
Vitaly Repeshko 2011/08/23 10:55:40 Keep HINT_?
1051 WRITE_NO_NULL_TERMINATION = 2
Vitaly Repeshko 2011/08/23 10:55:40 Drop WRITE_?
1051 }; 1052 };
1052 1053
1053 V8EXPORT int Write(uint16_t* buffer, 1054 V8EXPORT int Write(uint16_t* buffer,
1054 int start = 0, 1055 int start = 0,
1055 int length = -1, 1056 int length = -1,
1056 WriteHints hints = NO_HINTS) const; // UTF-16 1057 int options = NO_OPTIONS) const; // UTF-16
1057 V8EXPORT int WriteAscii(char* buffer, 1058 V8EXPORT int WriteAscii(char* buffer,
1058 int start = 0, 1059 int start = 0,
1059 int length = -1, 1060 int length = -1,
1060 WriteHints hints = NO_HINTS) const; // ASCII 1061 int options = NO_OPTIONS) const; // ASCII
1061 V8EXPORT int WriteUtf8(char* buffer, 1062 V8EXPORT int WriteUtf8(char* buffer,
1062 int length = -1, 1063 int length = -1,
1063 int* nchars_ref = NULL, 1064 int* nchars_ref = NULL,
1064 WriteHints hints = NO_HINTS) const; // UTF-8 1065 int options = NO_OPTIONS) const; // UTF-8
1065 1066
1066 /** 1067 /**
1067 * A zero length string. 1068 * A zero length string.
1068 */ 1069 */
1069 V8EXPORT static v8::Local<v8::String> Empty(); 1070 V8EXPORT static v8::Local<v8::String> Empty();
1070 1071
1071 /** 1072 /**
1072 * Returns true if the string is external 1073 * Returns true if the string is external
1073 */ 1074 */
1074 V8EXPORT bool IsExternal() const; 1075 V8EXPORT bool IsExternal() const;
(...skipping 3122 matching lines...) Expand 10 before | Expand all | Expand 10 after
4197 4198
4198 4199
4199 } // namespace v8 4200 } // namespace v8
4200 4201
4201 4202
4202 #undef V8EXPORT 4203 #undef V8EXPORT
4203 #undef TYPE_CHECK 4204 #undef TYPE_CHECK
4204 4205
4205 4206
4206 #endif // V8_H_ 4207 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698