| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 bool MakeExternal(ExternalAsciiStringResource* resource); | 876 bool MakeExternal(ExternalAsciiStringResource* resource); |
| 877 | 877 |
| 878 /** Creates an undetectable string from the supplied ascii or utf-8 data.*/ | 878 /** Creates an undetectable string from the supplied ascii or utf-8 data.*/ |
| 879 static Local<String> NewUndetectable(const char* data, int length = -1); | 879 static Local<String> NewUndetectable(const char* data, int length = -1); |
| 880 | 880 |
| 881 /** Creates an undetectable string from the supplied utf-16 data.*/ | 881 /** Creates an undetectable string from the supplied utf-16 data.*/ |
| 882 static Local<String> NewUndetectable(const uint16_t* data, int length = -1); | 882 static Local<String> NewUndetectable(const uint16_t* data, int length = -1); |
| 883 | 883 |
| 884 /** | 884 /** |
| 885 * Converts an object to a utf8-encoded character array. Useful if | 885 * Converts an object to a utf8-encoded character array. Useful if |
| 886 * you want to print the object. | 886 * you want to print the object. If conversion to a string fails |
| 887 * (eg. due to an exception in the toString() method of the object) |
| 888 * then the length() method returns 0 and the * operator returns |
| 889 * NULL. |
| 887 */ | 890 */ |
| 888 class V8EXPORT Utf8Value { | 891 class V8EXPORT Utf8Value { |
| 889 public: | 892 public: |
| 890 explicit Utf8Value(Handle<v8::Value> obj); | 893 explicit Utf8Value(Handle<v8::Value> obj); |
| 891 ~Utf8Value(); | 894 ~Utf8Value(); |
| 892 char* operator*() const { return str_; } | 895 char* operator*() const { return str_; } |
| 893 int length() { return length_; } | 896 int length() { return length_; } |
| 894 private: | 897 private: |
| 895 char* str_; | 898 char* str_; |
| 896 int length_; | 899 int length_; |
| 897 | 900 |
| 898 // Disallow copying and assigning. | 901 // Disallow copying and assigning. |
| 899 Utf8Value(const Utf8Value&); | 902 Utf8Value(const Utf8Value&); |
| 900 void operator=(const Utf8Value&); | 903 void operator=(const Utf8Value&); |
| 901 }; | 904 }; |
| 902 | 905 |
| 903 /** | 906 /** |
| 904 * Converts an object to an ascii string. | 907 * Converts an object to an ascii string. |
| 905 * Useful if you want to print the object. | 908 * Useful if you want to print the object. |
| 909 * If conversion to a string fails (eg. due to an exception in the toString() |
| 910 * method of the object) then the length() method returns 0 and the * operator |
| 911 * returns NULL. |
| 906 */ | 912 */ |
| 907 class V8EXPORT AsciiValue { | 913 class V8EXPORT AsciiValue { |
| 908 public: | 914 public: |
| 909 explicit AsciiValue(Handle<v8::Value> obj); | 915 explicit AsciiValue(Handle<v8::Value> obj); |
| 910 ~AsciiValue(); | 916 ~AsciiValue(); |
| 911 char* operator*() const { return str_; } | 917 char* operator*() const { return str_; } |
| 912 int length() { return length_; } | 918 int length() { return length_; } |
| 913 private: | 919 private: |
| 914 char* str_; | 920 char* str_; |
| 915 int length_; | 921 int length_; |
| 916 | 922 |
| 917 // Disallow copying and assigning. | 923 // Disallow copying and assigning. |
| 918 AsciiValue(const AsciiValue&); | 924 AsciiValue(const AsciiValue&); |
| 919 void operator=(const AsciiValue&); | 925 void operator=(const AsciiValue&); |
| 920 }; | 926 }; |
| 921 | 927 |
| 922 /** | 928 /** |
| 923 * Converts an object to a two-byte string. | 929 * Converts an object to a two-byte string. |
| 930 * If conversion to a string fails (eg. due to an exception in the toString() |
| 931 * method of the object) then the length() method returns 0 and the * operator |
| 932 * returns NULL. |
| 924 */ | 933 */ |
| 925 class V8EXPORT Value { | 934 class V8EXPORT Value { |
| 926 public: | 935 public: |
| 927 explicit Value(Handle<v8::Value> obj); | 936 explicit Value(Handle<v8::Value> obj); |
| 928 ~Value(); | 937 ~Value(); |
| 929 uint16_t* operator*() const { return str_; } | 938 uint16_t* operator*() const { return str_; } |
| 930 int length() { return length_; } | 939 int length() { return length_; } |
| 931 private: | 940 private: |
| 932 uint16_t* str_; | 941 uint16_t* str_; |
| 933 int length_; | 942 int length_; |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2520 | 2529 |
| 2521 } // namespace v8 | 2530 } // namespace v8 |
| 2522 | 2531 |
| 2523 | 2532 |
| 2524 #undef V8EXPORT | 2533 #undef V8EXPORT |
| 2525 #undef V8EXPORT_INLINE | 2534 #undef V8EXPORT_INLINE |
| 2526 #undef TYPE_CHECK | 2535 #undef TYPE_CHECK |
| 2527 | 2536 |
| 2528 | 2537 |
| 2529 #endif // V8_H_ | 2538 #endif // V8_H_ |
| OLD | NEW |