| 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> |
| 32 #include <unicode/utypes.h> | 33 #include <unicode/utypes.h> |
| 33 | 34 |
| 34 typedef struct UConverter UConverter; | 35 typedef struct UConverter UConverter; |
| 35 | 36 |
| 36 namespace WTF { | 37 namespace WTF { |
| 37 | 38 |
| 38 class TextCodecInput; | 39 class TextCodecInput; |
| 39 | 40 |
| 40 class TextCodecICU final : public TextCodec { | 41 class TextCodecICU final : public TextCodec { |
| 41 public: | 42 public: |
| 42 static void registerEncodingNames(EncodingNameRegistrar); | 43 static void registerEncodingNames(EncodingNameRegistrar); |
| 43 static void registerCodecs(TextCodecRegistrar); | 44 static void registerCodecs(TextCodecRegistrar); |
| 44 | 45 |
| 45 ~TextCodecICU() override; | 46 ~TextCodecICU() override; |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 TextCodecICU(const TextEncoding&); | 49 TextCodecICU(const TextEncoding&); |
| 49 static PassOwnPtr<TextCodec> create(const TextEncoding&, const void*); | 50 static std::unique_ptr<TextCodec> create(const TextEncoding&, const void*); |
| 50 | 51 |
| 51 String decode(const char*, size_t length, FlushBehavior, bool stopOnError, b
ool& sawError) override; | 52 String decode(const char*, size_t length, FlushBehavior, bool stopOnError, b
ool& sawError) override; |
| 52 CString encode(const UChar*, size_t length, UnencodableHandling) override; | 53 CString encode(const UChar*, size_t length, UnencodableHandling) override; |
| 53 CString encode(const LChar*, size_t length, UnencodableHandling) override; | 54 CString encode(const LChar*, size_t length, UnencodableHandling) override; |
| 54 | 55 |
| 55 template<typename CharType> | 56 template<typename CharType> |
| 56 CString encodeCommon(const CharType*, size_t length, UnencodableHandling); | 57 CString encodeCommon(const CharType*, size_t length, UnencodableHandling); |
| 57 CString encodeInternal(const TextCodecInput&, UnencodableHandling); | 58 CString encodeInternal(const TextCodecInput&, UnencodableHandling); |
| 58 | 59 |
| 59 void createICUConverter() const; | 60 void createICUConverter() const; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 78 public: | 79 public: |
| 79 ICUConverterWrapper() : converter(0) { } | 80 ICUConverterWrapper() : converter(0) { } |
| 80 ~ICUConverterWrapper(); | 81 ~ICUConverterWrapper(); |
| 81 | 82 |
| 82 UConverter* converter; | 83 UConverter* converter; |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 } // namespace WTF | 86 } // namespace WTF |
| 86 | 87 |
| 87 #endif // TextCodecICU_h | 88 #endif // TextCodecICU_h |
| OLD | NEW |