| OLD | NEW |
| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #ifndef V8_EXTENSIONS_EXPERIMENTAL_BREAK_ITERATOR_H_ | 28 #ifndef V8_EXTENSIONS_EXPERIMENTAL_BREAK_ITERATOR_H_ |
| 29 #define V8_EXTENSIONS_EXPERIMENTAL_BREAK_ITERATOR_H_ | 29 #define V8_EXTENSIONS_EXPERIMENTAL_BREAK_ITERATOR_H_ |
| 30 | 30 |
| 31 #include <v8.h> | 31 #include <v8.h> |
| 32 | 32 |
| 33 #include "unicode/uversion.h" | 33 #include "unicode/uversion.h" |
| 34 | 34 |
| 35 namespace U_ICU_NAMESPACE { | 35 namespace U_ICU_NAMESPACE { |
| 36 class BreakIterator; | 36 class BreakIterator; |
| 37 class UnicodeString; |
| 37 } | 38 } |
| 38 | 39 |
| 39 namespace v8 { | 40 namespace v8 { |
| 40 namespace internal { | 41 namespace internal { |
| 41 | 42 |
| 42 class BreakIterator { | 43 class BreakIterator { |
| 43 public: | 44 public: |
| 44 static v8::Handle<v8::Value> JSBreakIterator(const v8::Arguments& args); | 45 static v8::Handle<v8::Value> JSBreakIterator(const v8::Arguments& args); |
| 45 | 46 |
| 46 // Helper methods for various bindings. | 47 // Helper methods for various bindings. |
| 47 | 48 |
| 48 // Unpacks break iterator object from corresponding JavaScript object. | 49 // Unpacks break iterator object from corresponding JavaScript object. |
| 49 static icu::BreakIterator* UnpackBreakIterator(v8::Handle<v8::Object> obj); | 50 static icu::BreakIterator* UnpackBreakIterator(v8::Handle<v8::Object> obj); |
| 50 | 51 |
| 52 // Deletes the old value and sets the adopted text in |
| 53 // corresponding JavaScript object. |
| 54 static UnicodeString* ResetAdoptedText(v8::Handle<v8::Object> obj, |
| 55 v8::Handle<v8::Value> text_value); |
| 56 |
| 51 // Release memory we allocated for the BreakIterator once the JS object that | 57 // Release memory we allocated for the BreakIterator once the JS object that |
| 52 // holds the pointer gets garbage collected. | 58 // holds the pointer gets garbage collected. |
| 53 static void DeleteBreakIterator(v8::Persistent<v8::Value> object, | 59 static void DeleteBreakIterator(v8::Persistent<v8::Value> object, |
| 54 void* param); | 60 void* param); |
| 55 | 61 |
| 56 // Assigns new text to the iterator. | 62 // Assigns new text to the iterator. |
| 57 static v8::Handle<v8::Value> BreakIteratorAdoptText( | 63 static v8::Handle<v8::Value> BreakIteratorAdoptText( |
| 58 const v8::Arguments& args); | 64 const v8::Arguments& args); |
| 59 | 65 |
| 60 // Moves iterator to the beginning of the string and returns new position. | 66 // Moves iterator to the beginning of the string and returns new position. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 74 | 80 |
| 75 private: | 81 private: |
| 76 BreakIterator() {} | 82 BreakIterator() {} |
| 77 | 83 |
| 78 static v8::Persistent<v8::FunctionTemplate> break_iterator_template_; | 84 static v8::Persistent<v8::FunctionTemplate> break_iterator_template_; |
| 79 }; | 85 }; |
| 80 | 86 |
| 81 } } // namespace v8::internal | 87 } } // namespace v8::internal |
| 82 | 88 |
| 83 #endif // V8_EXTENSIONS_EXPERIMENTAL_BREAK_ITERATOR_H_ | 89 #endif // V8_EXTENSIONS_EXPERIMENTAL_BREAK_ITERATOR_H_ |
| OLD | NEW |