Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 5d8c1952e30510ee4c72521050a7b1d0211b7edc..aab5f9c524a6e27e3560a93ed01e63346f101581 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -1064,7 +1064,8 @@ class String : public Primitive { |
enum Encoding { |
UNKNOWN_ENCODING = 0x1, |
TWO_BYTE_ENCODING = 0x0, |
- ASCII_ENCODING = 0x4 |
+ ASCII_ENCODING = 0x4, |
+ ONE_BYTE_ENCODING = 0x4 |
}; |
/** |
* Returns the number of characters in this string. |
@@ -1086,6 +1087,11 @@ class String : public Primitive { |
V8EXPORT bool MayContainNonAscii() const; |
/** |
+ * Returns whether this string contains only one byte data. |
+ */ |
+ V8EXPORT bool IsOneByte() const; |
+ |
+ /** |
* Write the contents of the string to an external buffer. |
* If no arguments are given, expects the buffer to be large |
* enough to hold the entire string and NULL terminator. Copies |
@@ -1127,6 +1133,11 @@ class String : public Primitive { |
int start = 0, |
int length = -1, |
int options = NO_OPTIONS) const; |
+ // One byte characters. |
+ V8EXPORT int WriteOneByte(uint8_t* buffer, |
+ int start = 0, |
+ int length = -1, |
+ int options = NO_OPTIONS) const; |
// UTF-8 encoded characters. |
V8EXPORT int WriteUtf8(char* buffer, |
int length = -1, |
@@ -1228,6 +1239,8 @@ class String : public Primitive { |
ExternalAsciiStringResource() {} |
}; |
+ typedef ExternalAsciiStringResource ExternalOneByteStringResource; |
+ |
/** |
* If the string is an external string, return the ExternalStringResourceBase |
* regardless of the encoding, otherwise return NULL. The encoding of the |