| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2007, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> | 3 * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #ifndef TextCodecICU_h | 27 #ifndef TextCodecICU_h |
| 28 #define TextCodecICU_h | 28 #define TextCodecICU_h |
| 29 | 29 |
| 30 #include "wtf/text/TextCodec.h" | 30 #include "wtf/text/TextCodec.h" |
| 31 #include "wtf/text/TextEncoding.h" | 31 #include "wtf/text/TextEncoding.h" |
| 32 #include <memory> | |
| 33 #include <unicode/utypes.h> | 32 #include <unicode/utypes.h> |
| 34 | 33 |
| 35 typedef struct UConverter UConverter; | 34 typedef struct UConverter UConverter; |
| 36 | 35 |
| 37 namespace WTF { | 36 namespace WTF { |
| 38 | 37 |
| 39 class TextCodecInput; | 38 class TextCodecInput; |
| 40 | 39 |
| 41 class TextCodecICU final : public TextCodec { | 40 class TextCodecICU final : public TextCodec { |
| 42 public: | 41 public: |
| 43 static void registerEncodingNames(EncodingNameRegistrar); | 42 static void registerEncodingNames(EncodingNameRegistrar); |
| 44 static void registerCodecs(TextCodecRegistrar); | 43 static void registerCodecs(TextCodecRegistrar); |
| 45 | 44 |
| 46 ~TextCodecICU() override; | 45 ~TextCodecICU() override; |
| 47 | 46 |
| 48 private: | 47 private: |
| 49 TextCodecICU(const TextEncoding&); | 48 TextCodecICU(const TextEncoding&); |
| 50 static std::unique_ptr<TextCodec> create(const TextEncoding&, const void*); | 49 static PassOwnPtr<TextCodec> create(const TextEncoding&, const void*); |
| 51 | 50 |
| 52 String decode(const char*, size_t length, FlushBehavior, bool stopOnError, b
ool& sawError) override; | 51 String decode(const char*, size_t length, FlushBehavior, bool stopOnError, b
ool& sawError) override; |
| 53 CString encode(const UChar*, size_t length, UnencodableHandling) override; | 52 CString encode(const UChar*, size_t length, UnencodableHandling) override; |
| 54 CString encode(const LChar*, size_t length, UnencodableHandling) override; | 53 CString encode(const LChar*, size_t length, UnencodableHandling) override; |
| 55 | 54 |
| 56 template<typename CharType> | 55 template<typename CharType> |
| 57 CString encodeCommon(const CharType*, size_t length, UnencodableHandling); | 56 CString encodeCommon(const CharType*, size_t length, UnencodableHandling); |
| 58 CString encodeInternal(const TextCodecInput&, UnencodableHandling); | 57 CString encodeInternal(const TextCodecInput&, UnencodableHandling); |
| 59 | 58 |
| 60 void createICUConverter() const; | 59 void createICUConverter() const; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 79 public: | 78 public: |
| 80 ICUConverterWrapper() : converter(0) { } | 79 ICUConverterWrapper() : converter(0) { } |
| 81 ~ICUConverterWrapper(); | 80 ~ICUConverterWrapper(); |
| 82 | 81 |
| 83 UConverter* converter; | 82 UConverter* converter; |
| 84 }; | 83 }; |
| 85 | 84 |
| 86 } // namespace WTF | 85 } // namespace WTF |
| 87 | 86 |
| 88 #endif // TextCodecICU_h | 87 #endif // TextCodecICU_h |
| OLD | NEW |