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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 * Only null-terminates if there is enough space in the buffer. | 852 * Only null-terminates if there is enough space in the buffer. |
853 * | 853 * |
854 * \param buffer The buffer into which the string will be copied. | 854 * \param buffer The buffer into which the string will be copied. |
855 * \param start The starting position within the string at which | 855 * \param start The starting position within the string at which |
856 * copying begins. | 856 * copying begins. |
857 * \param length The number of bytes to copy from the string. | 857 * \param length The number of bytes to copy from the string. |
858 * \param nchars_ref The number of characters written, can be NULL. | 858 * \param nchars_ref The number of characters written, can be NULL. |
859 * \return The number of bytes copied to the buffer | 859 * \return The number of bytes copied to the buffer |
860 * excluding the NULL terminator. | 860 * excluding the NULL terminator. |
861 */ | 861 */ |
862 int Write(uint16_t* buffer, int start = 0, int length = -1) const; // UTF-16 | 862 enum WriteHints { |
863 int WriteAscii(char* buffer, int start = 0, int length = -1) const; // ASCII | 863 NO_HINTS = 0, |
| 864 HINT_MANY_WRITES_EXPECTED = 1 |
| 865 }; |
| 866 |
| 867 int Write(uint16_t* buffer, |
| 868 int start = 0, |
| 869 int length = -1, |
| 870 WriteHints hints = NO_HINTS) const; // UTF-16 |
| 871 int WriteAscii(char* buffer, |
| 872 int start = 0, |
| 873 int length = -1, |
| 874 WriteHints hints = NO_HINTS) const; // ASCII |
864 int WriteUtf8(char* buffer, | 875 int WriteUtf8(char* buffer, |
865 int length = -1, | 876 int length = -1, |
866 int* nchars_ref = NULL) const; // UTF-8 | 877 int* nchars_ref = NULL, |
867 | 878 WriteHints hints = NO_HINTS) const; // UTF-8 |
868 /** | |
869 * Flatten internal memory. Operations on the string tend to run faster | |
870 * after flattening especially if the string is a concatenation of many | |
871 * others. | |
872 */ | |
873 void Flatten(); | |
874 | 879 |
875 /** | 880 /** |
876 * A zero length string. | 881 * A zero length string. |
877 */ | 882 */ |
878 static v8::Local<v8::String> Empty(); | 883 static v8::Local<v8::String> Empty(); |
879 | 884 |
880 /** | 885 /** |
881 * Returns true if the string is external | 886 * Returns true if the string is external |
882 */ | 887 */ |
883 bool IsExternal() const; | 888 bool IsExternal() const; |
(...skipping 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3399 | 3404 |
3400 } // namespace v8 | 3405 } // namespace v8 |
3401 | 3406 |
3402 | 3407 |
3403 #undef V8EXPORT | 3408 #undef V8EXPORT |
3404 #undef V8EXPORT_INLINE | 3409 #undef V8EXPORT_INLINE |
3405 #undef TYPE_CHECK | 3410 #undef TYPE_CHECK |
3406 | 3411 |
3407 | 3412 |
3408 #endif // V8_H_ | 3413 #endif // V8_H_ |
OLD | NEW |