Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Side by Side Diff: Source/wtf/text/TextEncoding.h

Issue 999953003: Remove dedicated TextCodecUTF16 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/wtf/text/TextCodecUTF16.cpp ('k') | Source/wtf/text/TextEncodingRegistry.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 24 matching lines...) Expand all
35 35
36 class WTF_EXPORT TextEncoding { 36 class WTF_EXPORT TextEncoding {
37 public: 37 public:
38 TextEncoding() : m_name(0) { } 38 TextEncoding() : m_name(0) { }
39 TextEncoding(const char* name); 39 TextEncoding(const char* name);
40 TextEncoding(const String& name); 40 TextEncoding(const String& name);
41 41
42 bool isValid() const { return m_name; } 42 bool isValid() const { return m_name; }
43 const char* name() const { return m_name; } 43 const char* name() const { return m_name; }
44 bool usesVisualOrdering() const; 44 bool usesVisualOrdering() const;
45 bool isNonByteBasedEncoding() const;
45 const TextEncoding& closestByteBasedEquivalent() const; 46 const TextEncoding& closestByteBasedEquivalent() const;
46 const TextEncoding& encodingForFormSubmission() const; 47 const TextEncoding& encodingForFormSubmission() const;
47 48
48 String decode(const char* str, size_t length) const 49 String decode(const char* str, size_t length) const
49 { 50 {
50 bool ignored; 51 bool ignored;
51 return decode(str, length, false, ignored); 52 return decode(str, length, false, ignored);
52 } 53 }
53 String decode(const char*, size_t length, bool stopOnError, bool& sawError) const; 54 String decode(const char*, size_t length, bool stopOnError, bool& sawError) const;
54 55
55 // Encodes the string, but does *not* normalize first. 56 // Encodes the string, but does *not* normalize first.
56 CString encode(const String&, UnencodableHandling) const; 57 CString encode(const String&, UnencodableHandling) const;
57 58
58 // Applies Unicode NFC normalization, then encodes the normalized string. 59 // Applies Unicode NFC normalization, then encodes the normalized string.
59 CString normalizeAndEncode(const String&, UnencodableHandling) const; 60 CString normalizeAndEncode(const String&, UnencodableHandling) const;
60 61
61 private: 62 private:
62 bool isNonByteBasedEncoding() const;
63 bool isUTF7Encoding() const; 63 bool isUTF7Encoding() const;
64 64
65 const char* m_name; 65 const char* m_name;
66 }; 66 };
67 67
68 inline bool operator==(const TextEncoding& a, const TextEncoding& b) { return a. name() == b.name(); } 68 inline bool operator==(const TextEncoding& a, const TextEncoding& b) { return a. name() == b.name(); }
69 inline bool operator!=(const TextEncoding& a, const TextEncoding& b) { return a. name() != b.name(); } 69 inline bool operator!=(const TextEncoding& a, const TextEncoding& b) { return a. name() != b.name(); }
70 70
71 WTF_EXPORT const TextEncoding& ASCIIEncoding(); 71 WTF_EXPORT const TextEncoding& ASCIIEncoding();
72 WTF_EXPORT const TextEncoding& Latin1Encoding(); 72 WTF_EXPORT const TextEncoding& Latin1Encoding();
73 WTF_EXPORT const TextEncoding& UTF16BigEndianEncoding(); 73 WTF_EXPORT const TextEncoding& UTF16BigEndianEncoding();
74 WTF_EXPORT const TextEncoding& UTF16LittleEndianEncoding(); 74 WTF_EXPORT const TextEncoding& UTF16LittleEndianEncoding();
75 WTF_EXPORT const TextEncoding& UTF32BigEndianEncoding(); 75 WTF_EXPORT const TextEncoding& UTF32BigEndianEncoding();
76 WTF_EXPORT const TextEncoding& UTF32LittleEndianEncoding(); 76 WTF_EXPORT const TextEncoding& UTF32LittleEndianEncoding();
77 WTF_EXPORT const TextEncoding& UTF8Encoding(); 77 WTF_EXPORT const TextEncoding& UTF8Encoding();
78 WTF_EXPORT const TextEncoding& WindowsLatin1Encoding(); 78 WTF_EXPORT const TextEncoding& WindowsLatin1Encoding();
79 79
80 } // namespace WTF 80 } // namespace WTF
81 81
82 using WTF::ASCIIEncoding; 82 using WTF::ASCIIEncoding;
83 using WTF::Latin1Encoding; 83 using WTF::Latin1Encoding;
84 using WTF::UTF16BigEndianEncoding; 84 using WTF::UTF16BigEndianEncoding;
85 using WTF::UTF16LittleEndianEncoding; 85 using WTF::UTF16LittleEndianEncoding;
86 using WTF::UTF32BigEndianEncoding; 86 using WTF::UTF32BigEndianEncoding;
87 using WTF::UTF32LittleEndianEncoding; 87 using WTF::UTF32LittleEndianEncoding;
88 using WTF::UTF8Encoding; 88 using WTF::UTF8Encoding;
89 using WTF::WindowsLatin1Encoding; 89 using WTF::WindowsLatin1Encoding;
90 90
91 #endif // TextEncoding_h 91 #endif // TextEncoding_h
OLDNEW
« no previous file with comments | « Source/wtf/text/TextCodecUTF16.cpp ('k') | Source/wtf/text/TextEncodingRegistry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698